aimsdata 6.0.0
Neuroimaging data handling
affinetransformation3d.h
Go to the documentation of this file.
1/* This software and supporting documentation are distributed by
2 * Institut Federatif de Recherche 49
3 * CEA/NeuroSpin, Batiment 145,
4 * 91191 Gif-sur-Yvette cedex
5 * France
6 *
7 * This software is governed by the CeCILL-B license under
8 * French law and abiding by the rules of distribution of free software.
9 * You can use, modify and/or redistribute the software under the
10 * terms of the CeCILL-B license as circulated by CEA, CNRS
11 * and INRIA at the following URL "http://www.cecill.info".
12 *
13 * As a counterpart to the access to the source code and rights to copy,
14 * modify and redistribute granted by the license, users are provided only
15 * with a limited warranty and the software's author, the holder of the
16 * economic rights, and the successive licensors have only limited
17 * liability.
18 *
19 * In this respect, the user's attention is drawn to the risks associated
20 * with loading, using, modifying and/or developing or reproducing the
21 * software by the user in light of its specific status of free software,
22 * that may mean that it is complicated to manipulate, and that also
23 * therefore means that it is reserved for developers and experienced
24 * professionals having in-depth computer knowledge. Users are therefore
25 * encouraged to load and test the software's suitability as regards their
26 * requirements in conditions enabling the security of their systems and/or
27 * data to be ensured and, more generally, to use and operate it in the
28 * same conditions as regards security.
29 *
30 * The fact that you are presently reading this means that you have had
31 * knowledge of the CeCILL-B license and that you accept its terms.
32 */
33
34/*
35 * Non elastic AffineTransformation3d ( rotation + translation )
36 */
37#ifndef AIMS_TRANSFORMATION_AFFINETRANSFORMATION3D_H
38#define AIMS_TRANSFORMATION_AFFINETRANSFORMATION3D_H
39
41#include <soma-io/transformation/affinetransformation3d_base.h>
42#include <cartodata/volume/volume.h>
43#include <iosfwd>
44
45namespace aims
46{
48 class PythonHeader;
49 class Quaternion;
50
53 const Point3df & pmin1, const Point3df & pmax1, Point3df & pmin2,
54 Point3df & pmax2 );
55
56 //---------------------------------------------------------------------------
57
58 //--------------------------//
59 // AffineTransformation3d //
60 //--------------------------//
61 //--------------------------------------------------------------------------
148 {
149 public:
150
156 explicit AffineTransformation3d( const std::vector<float> & mat );
161 virtual AffineTransformation3d &
163 virtual AffineTransformation3d &
164 operator = ( const std::vector<float> & mat );
165 virtual AffineTransformation3d &
167 virtual AffineTransformation3d &
169
170 virtual bool operator == ( const AffineTransformation3d & ) const;
171 virtual bool operator != ( const AffineTransformation3d & ) const;
172
175 // AffineTransformation3d & operator += ( const AffineTransformation3d & trans );
177
178 std::unique_ptr<AffineTransformation3d> inverse() const;
179 std::unique_ptr<Transformation> getInverse() const CARTO_OVERRIDE;
180
181 inline Point3df translation();
182 inline Point3df translation() const;
183
184 inline carto::VolumeRef<float> rotation();
185 inline const carto::VolumeRef<float> rotation() const;
186
187 // get the matrix as a volume
188 inline carto::VolumeRef<float> affine();
189 inline const carto::VolumeRef<float> affine() const;
190
191 virtual void setMatrix(const carto::VolumeRef<float> & mat);
192 virtual void setRotationAffine( float rx, float ry, float rz,
193 const Point3df &cg = Point3df( 0.0 ) );
194 //virtual void setRotationVectorial( const Point3df& v1, const Point3df& v2 );
195
196 static carto::VolumeRef<float> rotationaroundx(float rx) ;
197 static carto::VolumeRef<float> rotationaroundy(float ry) ;
198 static carto::VolumeRef<float> rotationaroundz(float rz) ;
199
202 float tz );
205 const std::vector<float> & t );
206
207 };
208
209 // Compose AffineTransformation3d
211 operator * ( const AffineTransformation3d& affineTransformation3d1,
212 const AffineTransformation3d& affineTransformation3d2 );
213
215 {
216 return Point3df( _matrix[12], _matrix[13], _matrix[14] );
217 }
218
220 {
221 return Point3df( _matrix[12], _matrix[13], _matrix[14] );
222 }
223
225 {
226 // return a 3x3 view into the 4x4 matrix
228 new carto::Volume<float>( 4, 4, 1, 1, &*_matrix.begin() ) );
229
232 carto::Volume<float>::Position4Di( 3, 3, 1, 1 ) );
233
234 return view;
235 }
236
238 {
239 // return a 3x3 view into the 4x4 matrix
241 new carto::Volume<float>( 4, 4, 1, 1,
242 const_cast<float *>( &*_matrix.begin() ) ) );
245 carto::Volume<float>::Position4Di( 3, 3, 1, 1 ) );
246
247 return view;
248 }
249
256
258 {
260 new carto::Volume<float>( 4, 4, 1, 1,
261 const_cast<float *>( &*_matrix.begin() ) ) );
262 return matrix;
263 }
264
265}
266
267
268
269
270#ifndef DOXYGEN_HIDE_INTERNAL_CLASSES
271
272namespace carto
273{
274
275 template <> class DataTypeCode< aims::AffineTransformation3d >
276 {
277 public:
278 static std::string objectType()
279 { return "AffineTransformation3d"; }
280 static std::string dataType()
281 { return "VOID"; }
282 static std::string name()
283 {
284 return "AffineTransformation3d";
285 }
286 };
287
288}
289
290#endif // DOXYGEN_HIDE_INTERNAL_CLASSES
291
292#endif
#define CARTO_OVERRIDE
virtual void setRotationAffine(float rx, float ry, float rz, const Point3df &cg=Point3df(0.0))
carto::VolumeRef< float > affine()
std::unique_ptr< Transformation > getInverse() const CARTO_OVERRIDE
virtual AffineTransformation3d operator-() const
std::unique_ptr< AffineTransformation3d > inverse() const
virtual bool operator!=(const AffineTransformation3d &) const
virtual AffineTransformation3d & operator=(const AffineTransformation3d &other)
AffineTransformation3d & operator*=(const AffineTransformation3dBase &trans)
AffineTransformation3d()
Create an identity transformation.
AffineTransformation3d(const carto::Object mat)
Create a AffineTransformation3d from a 4x4 matrix given as a line vector in an Object.
AffineTransformation3d(const aims::Quaternion &quat)
AffineTransformation3d(const AffineTransformation3dBase &other)
carto::VolumeRef< float > rotation()
AffineTransformation3d(const AffineTransformation3d &other)
virtual void setMatrix(const carto::VolumeRef< float > &mat)
static carto::VolumeRef< float > rotationaroundy(float ry)
static carto::VolumeRef< float > rotationaroundx(float rx)
virtual bool operator==(const AffineTransformation3d &) const
static carto::VolumeRef< float > rotationaroundz(float rz)
AffineTransformation3d(const std::vector< float > &mat)
Create a AffineTransformation3d from a 4x4 matrix given as a line vector.
static AffineTransformation3d translationTransform(float tx, float ty, float tz)
convenient function which returns a translation transformation
Attributed python-like header, stores all needed information about an object, currently used for volu...
Definition pheader.h:52
The class for EcatSino data write operation.
void transformBoundingBox(const AffineTransformation3d &AffineTransformation3d, const Point3df &pmin1, const Point3df &pmax1, Point3df &pmin2, Point3df &pmax2)
STL namespace.
AimsVector< float, 3 > Point3df