ML Reference
mlMedicalImageProperties.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef ML_MEDICAL_IMAGE_PROPERTIES_H
14 #define ML_MEDICAL_IMAGE_PROPERTIES_H
15 
19 
20 // ML-includes
21 #include "mlDateTime.h"
22 #include "mlImageProperties.h"
23 #include "mlLinearAlgebra.h"
25 
26 #ifdef _MSC_VER
27 // Save warning state.
28 #pragma warning( push )
29 
30 // Warning disabled: 'warning C4275': non DLL-interface
31 // Reason: Exporting is done manually or as inline functions for the
32 // template class ImageProperties.
33 #pragma warning(disable : 4275 )
34 #endif
35 
36 ML_START_NAMESPACE
37 
38 // Use incomplete type to reduce header file dependencies.
39 class RuntimeType;
40 
41 //-------------------------------------------------------------------------
67 //-------------------------------------------------------------------------
69 {
70 
71 public:
72 
73  //-------------------------------------------------------------------
76  //-------------------------------------------------------------------
81 
84 
87  MedicalImageProperties(const MedicalImageProperties& medicalImageProperties);
88 
91  MedicalImageProperties &operator=(const MedicalImageProperties& medicalImageProperties);
92 
96  void setImageProperties(const MedicalImageProperties& medicalImageProperties);
98 
99  //-------------------------------------------------------------------
102  //-------------------------------------------------------------------
104  bool operator==(const MedicalImageProperties& medicalImageProperties) const;
105 
107  bool operator!=(const MedicalImageProperties& medicalImageProperties) const;
109 
110  //-------------------------------------------------------------------
113  //-------------------------------------------------------------------
116 
118  void setVoxelSize(const Vector3& voxelSize);
119 
122 
126 
130 
132 
133  //-------------------------------------------------------------------
136  //-------------------------------------------------------------------
147 
150  void setVoxelToWorldMatrixValid(bool valid);
151 
154 
156  void setVoxelToWorldMatrix(const Matrix4& matrix);
157 
160 
162  Vector3 mapVoxelToWorld(const Vector3& voxelPosition) const;
163 
165  Vector3 mapWorldToVoxel(const Vector3& worldPosition) const;
166 
169  void scaleVoxelToWorldMatrix(const Vector3& scaleFactors);
170 
172  void translateVoxelToWorldMatrix(const Vector3& offsetVector);
173 
175 
176  //--------------------------------------------------------------------------------
179  //--------------------------------------------------------------------------------
198  std::vector<std::string>& getCDimensionInfos() { return _cDimInfos; };
199  std::vector<DateTime>& getTDimensionInfos() { return _tDimInfos; };
200  std::vector<std::string>& getUDimensionInfos() { return _uDimInfos; };
201 
202  const std::vector<std::string>& getCDimensionInfos() const { return _cDimInfos; };
203  const std::vector<DateTime>& getTDimensionInfos() const { return _tDimInfos; };
204  const std::vector<std::string>& getUDimensionInfos() const { return _uDimInfos; };
205 
207 
208  //--------------------------------------------------------------------------------
211  //--------------------------------------------------------------------------------
213  ImagePropertyExtensionContainer& getImagePropertyContainer() { return _imagePropertyExtensions; }
214  const ImagePropertyExtensionContainer& getConstImagePropertyContainer() const { return _imagePropertyExtensions; }
216 
217 
218 private:
219 
220  //-------------------------------------------------------------------
223  //-------------------------------------------------------------------
226  void updateVoxelSizeFromToWorldMatrix();
227 
233  void updateToWorldMatrixFromVoxelSize();
234 
238  void correctToWorldMatrix();
240 
241 
247  void _assignMembers(const MedicalImageProperties& medicalImageProperties);
248 
249  //-------------------------------------------------------------------
252  //-------------------------------------------------------------------
254  MLdouble _x_VoxelSize;
255 
257  MLdouble _y_VoxelSize;
258 
260  MLdouble _z_VoxelSize;
261 
263  Matrix4 _toWorldMatrix;
264 
267  Matrix4 _toVoxelMatrix;
268 
271  bool _isToWorldMatrixValid;
273 
274  //-------------------------------------------------------------------
277  //-------------------------------------------------------------------
280  std::vector<std::string> _cDimInfos;
281  std::vector<DateTime> _tDimInfos;
282  std::vector<std::string> _uDimInfos;
284 
285 
286  //-------------------------------------------------------------------
290  //-------------------------------------------------------------------
291  ImagePropertyExtensionContainer _imagePropertyExtensions;
293 };
294 
295 
296 #ifdef _MSC_VER
298 #pragma warning( pop )
299 #endif
300 
301 
302 ML_END_NAMESPACE
303 
304 
305 
306 
307 
308 #endif //of __mlMedicalImageProperties_H
309 
310 
311 
This class represents basic image properties:
This class is a container for extended image properties derived from ImagePropertyExtension.
This class encapsulates basic medical image properties:
void setVoxelSize(const Vector3 &voxelSize)
Sets the voxel size to voxelSize. The transformation matrix is adapted adequately.
std::vector< std::string > & getUDimensionInfos()
Vector3 getVoxelSize() const
Returns the voxel size.
MedicalImageProperties()
Constructor.
const Matrix4 & getVoxelToWorldMatrix() const
Returns the voxelToWorld matrix.
bool isVoxelToWorldMatrixValid() const
Shows the validity state of the VoxelToWorldMatrix (default=true=valid).
void setVoxelToWorldMatrix(const Matrix4 &matrix)
Sets the matrix that transforms voxel to world coordinates to matrix.
void setImageProperties(const MedicalImageProperties &medicalImageProperties)
Sets a copy of the passed image properties medicalImageProperties.
std::vector< DateTime > & getTDimensionInfos()
Vector3 mapWorldToVoxel(const Vector3 &worldPosition) const
Maps the worldPosition vector to voxel coordinates and returns it.
const Matrix4 & getWorldToVoxelMatrix() const
Returns the worlToVoxel matrix.
bool operator!=(const MedicalImageProperties &medicalImageProperties) const
Returns true if *this and medicalImageProperties differ; otherwise, it returns false.
const ImagePropertyExtensionContainer & getConstImagePropertyContainer() const
const std::vector< DateTime > & getTDimensionInfos() const
bool operator==(const MedicalImageProperties &medicalImageProperties) const
Returns true if *this and medicalImageProperties are identical; otherwise, it returns false.
void setVoxelToWorldMatrixValid(bool valid)
Validates/Invalidates the voxelToWorld matrix by passing true/false as valid.
~MedicalImageProperties() override
Destructor. Cleans up dynamically allocated memory.
void setVoxelSize(MLdouble dx, MLdouble dy, MLdouble dz)
Sets the voxel size to dx, dy, and dz. This changes the voxelToWorld matrix.
double getVoxelVolumeInMilliliters() const
Returns the volume of a single voxel in milliliters (ml).
std::vector< std::string > & getCDimensionInfos()
Permits access to the additional information for subimages on the c-, t-, and u-dimensions.
Vector3 mapVoxelToWorld(const Vector3 &voxelPosition) const
Maps the voxelPosition vector to world coordinates and returns it.
const std::vector< std::string > & getCDimensionInfos() const
ImagePropertyExtensionContainer & getImagePropertyContainer()
Permits access to the container for user image properties.
const std::vector< std::string > & getUDimensionInfos() const
MedicalImageProperties(const MedicalImageProperties &medicalImageProperties)
Copy constructor from an existing medicalImageProperties object to get a copy.
void translateVoxelToWorldMatrix(const Vector3 &offsetVector)
Translates the voxelToWorld matrix by the offsetVector.
void scaleVoxelToWorldMatrix(const Vector3 &scaleFactors)
Scales the voxelToWorld matrix by the vector scaleFactors and updates the image's voxel size.
MedicalImageProperties & operator=(const MedicalImageProperties &medicalImageProperties)
Assignment operator from an existing edicalImageProperties object to get a copy.
double getVoxelVolumeInCubicMillimeters() const
Returns the volume of a single voxel in cubic millimeters (mm^3).
#define MLEXPORT
To export symbols from a DLL/shared object, we need to mark them with the MLEXPORT symbol.
double MLdouble
Definition: mlTypeDefs.h:217