MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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
37
38// Use incomplete type to reduce header file dependencies.
39class RuntimeType;
40
41//-------------------------------------------------------------------------
67//-------------------------------------------------------------------------
69{
70
71public:
72 //-------------------------------------------------------------------
75 //-------------------------------------------------------------------
80
83
87
91
97
98 //-------------------------------------------------------------------
101 //-------------------------------------------------------------------
104
108
109 //-------------------------------------------------------------------
112 //-------------------------------------------------------------------
115
117 void setVoxelSize(const Vector3& voxelSize);
118
121
125
129
131
132 //-------------------------------------------------------------------
135 //-------------------------------------------------------------------
146
150
153
155 void setVoxelToWorldMatrix(const Matrix4& matrix);
156
159
161 Vector3 mapVoxelToWorld(const Vector3& voxelPosition) const;
162
164 Vector3 mapWorldToVoxel(const Vector3& worldPosition) const;
165
169
172
174
175 //--------------------------------------------------------------------------------
178 //--------------------------------------------------------------------------------
197 std::vector<std::string>& getCDimensionInfos()
198 {
199 return _cDimInfos;
200 };
201 std::vector<DateTime>& getTDimensionInfos()
202 {
203 return _tDimInfos;
204 };
205 std::vector<std::string>& getUDimensionInfos()
206 {
207 return _uDimInfos;
208 };
209
210 const std::vector<std::string>& getCDimensionInfos() const
211 {
212 return _cDimInfos;
213 };
214 const std::vector<DateTime>& getTDimensionInfos() const
215 {
216 return _tDimInfos;
217 };
218 const std::vector<std::string>& getUDimensionInfos() const
219 {
220 return _uDimInfos;
221 };
222
224
225 //--------------------------------------------------------------------------------
228 //--------------------------------------------------------------------------------
231 {
232 return _imagePropertyExtensions;
233 }
235 {
236 return _imagePropertyExtensions;
237 }
239
240
241private:
242 //-------------------------------------------------------------------
245 //-------------------------------------------------------------------
248 void updateVoxelSizeFromToWorldMatrix();
249
255 void updateToWorldMatrixFromVoxelSize();
256
260 void correctToWorldMatrix();
262
263
269 void _assignMembers(const MedicalImageProperties& medicalImageProperties);
270
271 //-------------------------------------------------------------------
274 //-------------------------------------------------------------------
276 MLdouble _x_VoxelSize;
277
279 MLdouble _y_VoxelSize;
280
282 MLdouble _z_VoxelSize;
283
285 Matrix4 _toWorldMatrix;
286
289 Matrix4 _toVoxelMatrix;
290
293 bool _isToWorldMatrixValid;
295
296 //-------------------------------------------------------------------
299 //-------------------------------------------------------------------
302 std::vector<std::string> _cDimInfos;
303 std::vector<DateTime> _tDimInfos;
304 std::vector<std::string> _uDimInfos;
306
307
308 //-------------------------------------------------------------------
312 //-------------------------------------------------------------------
313 ImagePropertyExtensionContainer _imagePropertyExtensions;
315};
316
317
318#ifdef _MSC_VER
320#pragma warning(pop)
321#endif
322
323
325
326
327#endif // of __mlMedicalImageProperties_H
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.
Vector3 getVoxelSize() const
Returns the voxel size.
const std::vector< std::string > & getUDimensionInfos() const
ImagePropertyExtensionContainer & getImagePropertyContainer()
Permits access to the container for user image properties.
MedicalImageProperties()
Constructor.
const Matrix4 & getWorldToVoxelMatrix() const
Returns the worlToVoxel matrix.
bool isVoxelToWorldMatrixValid() const
Shows the validity state of the VoxelToWorldMatrix (default=true=valid).
std::vector< DateTime > & getTDimensionInfos()
void setVoxelToWorldMatrix(const Matrix4 &matrix)
Sets the matrix that transforms voxel to world coordinates to matrix.
const ImagePropertyExtensionContainer & getConstImagePropertyContainer() const
void setImageProperties(const MedicalImageProperties &medicalImageProperties)
Sets a copy of the passed image properties medicalImageProperties.
const std::vector< std::string > & getCDimensionInfos() const
const std::vector< DateTime > & getTDimensionInfos() const
Vector3 mapWorldToVoxel(const Vector3 &worldPosition) const
Maps the worldPosition vector to voxel coordinates and returns it.
std::vector< std::string > & getUDimensionInfos()
MedicalImageProperties & operator=(const MedicalImageProperties &medicalImageProperties)
Assignment operator from an existing edicalImageProperties object to get a copy.
bool operator!=(const MedicalImageProperties &medicalImageProperties) const
Returns true if *this and medicalImageProperties differ; otherwise, it returns false.
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.
std::vector< std::string > & getCDimensionInfos()
Permits access to the additional information for subimages on the c-, t-, and u-dimensions.
double getVoxelVolumeInMilliliters() const
Returns the volume of a single voxel in milliliters (ml).
Vector3 mapVoxelToWorld(const Vector3 &voxelPosition) const
Maps the voxelPosition vector to world coordinates and returns it.
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.
double getVoxelVolumeInCubicMillimeters() const
Returns the volume of a single voxel in cubic millimeters (mm^3).
const Matrix4 & getVoxelToWorldMatrix() const
Returns the voxelToWorld matrix.
#define MLEXPORT
To export symbols from a DLL/shared object, we need to mark them with the MLEXPORT symbol.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
double MLdouble
Definition mlTypeDefs.h:217