MeVisLab Toolbox Reference
ml::MedicalImageProperties Class Reference

This class encapsulates basic medical image properties: More...

#include <mlMedicalImageProperties.h>

Inheritance diagram for ml::MedicalImageProperties:
ml::ImageProperties ml::PagedImage ml::PagedImageProperties

Public Member Functions

Constructors
 MedicalImageProperties ()
 Constructor. More...
 
 ~MedicalImageProperties () override
 Destructor. Cleans up dynamically allocated memory. More...
 
 MedicalImageProperties (const MedicalImageProperties &medicalImageProperties)
 Copy constructor from an existing medicalImageProperties object to get a copy. More...
 
MedicalImagePropertiesoperator= (const MedicalImageProperties &medicalImageProperties)
 Assignment operator from an existing edicalImageProperties object to get a copy. More...
 
void setImageProperties (const MedicalImageProperties &medicalImageProperties)
 Sets a copy of the passed image properties medicalImageProperties. More...
 
Comparison.
bool operator== (const MedicalImageProperties &medicalImageProperties) const
 Returns true if *this and medicalImageProperties are identical, otherwise false. More...
 
bool operator!= (const MedicalImageProperties &medicalImageProperties) const
 Returns true if *this and medicalImageProperties differ, otherwise false. More...
 
Size of voxels
void setVoxelSize (MLdouble dx, MLdouble dy, MLdouble dz)
 Sets the voxel size to dx, dy and dz. This changes the voxelToWorld matrix. More...
 
void setVoxelSize (const Vector3 &voxelSize)
 Sets the voxel size to voxelSize. The transformation matrix is adapted adequately. More...
 
Vector3 getVoxelSize () const
 Returns the voxel size. More...
 
double getVoxelVolumeInCubicMillimeters () const
 Returns the volume of a single voxel in cubic millimeters (mm3). More...
 
double getVoxelVolumeInMilliliters () const
 Returns the volume of a single voxel in milliliters (ml). More...
 
Transformation matrix
bool isVoxelToWorldMatrixValid () const
 Shows the validity state of the VoxelToWorldMatrix (default=true=valid). More...
 
void setVoxelToWorldMatrixValid (bool valid)
 Validates/Invalidates the VoxelToWorld matrix by passing true/false as valid. More...
 
const Matrix4getVoxelToWorldMatrix () const
 Returns the voxelToWorld matrix. More...
 
void setVoxelToWorldMatrix (const Matrix4 &matrix)
 Sets the matrix which transforms voxel to world coordinates to matrix. More...
 
const Matrix4getWorldToVoxelMatrix () const
 Returns the worlToVoxel matrix. More...
 
Vector3 mapVoxelToWorld (const Vector3 &voxelPosition) const
 Maps the voxelPosition vector to world coordinates and returns it. More...
 
Vector3 mapWorldToVoxel (const Vector3 &worldPosition) const
 Maps the worldPosition vector to voxel coordinates and returns it. More...
 
void scaleVoxelToWorldMatrix (const Vector3 &scaleFactors)
 Scales the voxelToWorld matrix by the vector scaleFactors and updates the image's voxel size. More...
 
void translateVoxelToWorldMatrix (const Vector3 &offsetVector)
 Translates the voxelToWorld matrix by the offsetVector. More...
 
Information about higher dimensional subimages/channels.
std::vector< std::string > & getCDimensionInfos ()
 Permits access to the additional information for subimages on the c-, t- and u-dimensions. More...
 
std::vector< DateTime > & getTDimensionInfos ()
 
std::vector< std::string > & getUDimensionInfos ()
 
const std::vector< std::string > & getCDimensionInfos () const
 
const std::vector< DateTime > & getTDimensionInfos () const
 
const std::vector< std::string > & getUDimensionInfos () const
 
ImagePropertyExtensionContainergetImagePropertyContainer ()
 Permits access to the container for user image properties. More...
 
const ImagePropertyExtensionContainergetConstImagePropertyContainer () const
 
- Public Member Functions inherited from ml::ImageProperties
MLEXPORT ImageProperties ()
 Constructor. More...
 
virtual MLEXPORT ~ImageProperties ()
 Virtual destructor to suppress compiler warnings. More...
 
MLEXPORT ImageProperties (ImageVector extent, MLDataType dataType, MLdouble minValue, MLdouble maxValue)
 Constructor to set extent to extent, data type to dataType, minimum value to minValue and maximum value to maxValue. More...
 
MLEXPORT ImageProperties (const ImageProperties &imageProperties)
 Copy constructor from an existing imageProperties object to get an identical copy. More...
 
MLEXPORT ImagePropertiesoperator= (const ImageProperties &imageProperties)
 Assignment operator from an existing imageProperties object to get an identical copy. More...
 
MLEXPORT void setImageProperties (const ImageProperties &imageProperties)
 Copy property parameters from another image property instance imageProperties. More...
 
MLEXPORT bool operator== (const ImageProperties &imageProperties) const
 Returns true if *this and imageProperties are identical, otherwise false. More...
 
MLEXPORT bool operator!= (const ImageProperties &imageProperties) const
 Returns true if *this and imageProperties differ, otherwise false. More...
 
MLEXPORT void setImageExtent (const ImageVector &extent)
 Sets the extent of the (sub)image. More...
 
ImageVector getImageExtent () const
 Returns the extent of the (sub)image. More...
 
SubImageBox getBoxFromImageExtent () const
 Returns size of image as box with origin 0. More...
 
bool hasValidExtent () const
 Returns if the image has a valid extent (which means that all components are greater than 0). More...
 
MLint getNumVoxels () const
 Returns number of voxels in (sub)image. More...
 
MLint getSizeInBytes () const
 Returns number of potential bytes in (sub)image. More...
 
virtual MLEXPORT void setDataType (MLDataType dataType)
 Sets type of data to dataType. More...
 
MLDataType getDataType () const
 Returns the data type of the image. More...
 
void setMinVoxelValue (MLdouble minval)
 Sets assumed minimum value to minval. More...
 
MLdouble getMinVoxelValue () const
 Returns the assumed minimum value in data. More...
 
void setMaxVoxelValue (MLdouble maxval)
 Sets assumed maximum value to maxval. More...
 
MLdouble getMaxVoxelValue () const
 Returns the assumed maximum value in data. More...
 

Detailed Description

This class encapsulates basic medical image properties:

The following properties are available:

  • All properties inherited from ImageProperties
  • A 3d voxel size
  • A 4x4 homogeneous matrix to describe image translations and rotations. It is used to define a 3d affine transformation between voxel coordinates and world (patient) coordinates.
  • Three lists of channel information:
    • to describe color channel contents (for 4d image extent)
    • to describe time channel contents (for 5d image extent)
    • to describe u-dimension contents (for 6d image extent)
  • A void pointer to the DICOM tag list of the original image (if available).

World coordinates are defined in the source image, e.g., loaded into the ML (usually the patient coordinate system) Changes of this coordinate system, e.g., by rotations, scales, size clamping, etc., require adoptions of the transformation matrix. So the real world positions of image voxels can be always calculated from voxel position and transformation matrix. Obviously the inverse projection is also available by inverting the transformation matrix.

Definition at line 68 of file mlMedicalImageProperties.h.

Constructor & Destructor Documentation

◆ MedicalImageProperties() [1/2]

ml::MedicalImageProperties::MedicalImageProperties ( )

Constructor.

Voxel size is set to (1,1,1), DICOM tag list is set to NULL, the transformation matrix is set to the 4d unit matrix and the three channel list are initialized empty.

◆ ~MedicalImageProperties()

ml::MedicalImageProperties::~MedicalImageProperties ( )
override

Destructor. Cleans up dynamically allocated memory.

◆ MedicalImageProperties() [2/2]

ml::MedicalImageProperties::MedicalImageProperties ( const MedicalImageProperties medicalImageProperties)

Copy constructor from an existing medicalImageProperties object to get a copy.

The validity flag of ImageProperties is also copied.

Member Function Documentation

◆ getCDimensionInfos() [1/2]

std::vector<std::string>& ml::MedicalImageProperties::getCDimensionInfos ( )
inline

Permits access to the additional information for subimages on the c-, t- and u-dimensions.

By default these lists are empty. If not they may contain additional information e.g., about the subimages at c=0, c=1, ... c=ext.c-1, and the subimages in the t and u dimension, respectively. Note that the usage and contents are still not clearly defined and the list may not have the length of the image extents in the corresponding dimension. As a hint: -The cDimensionInfos list may be used for color channel information. Use constants defined in the mlDataTypes.h header file. -The tDimensionsInfos list may be used for temporal information - that's the reason for the "DateTime" contents. So t subimages can get information about creation time or time points, e.g., for movie playbacks. -The uDimensionInfos list may contain arbitrary user information or as an alternative information about the unit/modality which created the subimage. So multi modality information can be handled from e.g., "PET", "CT", "US" (ultrasound), "XR" (X-Ray), "MR", "MR_T1", "MR_T2", "MR_T2*", "MR_FLAIR", "MR_IR", "MR_PD" (Proton density), "MR_DW" (diffusion weighted), etc. Try to use these strings if adequate.

Definition at line 199 of file mlMedicalImageProperties.h.

◆ getCDimensionInfos() [2/2]

const std::vector<std::string>& ml::MedicalImageProperties::getCDimensionInfos ( ) const
inline

Definition at line 203 of file mlMedicalImageProperties.h.

◆ getConstImagePropertyContainer()

const ImagePropertyExtensionContainer& ml::MedicalImageProperties::getConstImagePropertyContainer ( ) const
inline

Definition at line 215 of file mlMedicalImageProperties.h.

◆ getImagePropertyContainer()

ImagePropertyExtensionContainer& ml::MedicalImageProperties::getImagePropertyContainer ( )
inline

Permits access to the container for user image properties.

Definition at line 214 of file mlMedicalImageProperties.h.

Referenced by ml::PagedImageProperties::PagedImageProperties().

◆ getTDimensionInfos() [1/2]

std::vector<DateTime>& ml::MedicalImageProperties::getTDimensionInfos ( )
inline

Definition at line 200 of file mlMedicalImageProperties.h.

◆ getTDimensionInfos() [2/2]

const std::vector<DateTime>& ml::MedicalImageProperties::getTDimensionInfos ( ) const
inline

Definition at line 204 of file mlMedicalImageProperties.h.

◆ getUDimensionInfos() [1/2]

std::vector<std::string>& ml::MedicalImageProperties::getUDimensionInfos ( )
inline

Definition at line 201 of file mlMedicalImageProperties.h.

◆ getUDimensionInfos() [2/2]

const std::vector<std::string>& ml::MedicalImageProperties::getUDimensionInfos ( ) const
inline

Definition at line 205 of file mlMedicalImageProperties.h.

◆ getVoxelSize()

Vector3 ml::MedicalImageProperties::getVoxelSize ( ) const

Returns the voxel size.

Referenced by ml::setITKWorldFromMedicalImageProperty().

◆ getVoxelToWorldMatrix()

const Matrix4& ml::MedicalImageProperties::getVoxelToWorldMatrix ( ) const

◆ getVoxelVolumeInCubicMillimeters()

double ml::MedicalImageProperties::getVoxelVolumeInCubicMillimeters ( ) const

Returns the volume of a single voxel in cubic millimeters (mm3).

This returns the correct volume for sheared datasets and calculates fabs( inImg->getVoxelToWorldMatrix().det() ).

◆ getVoxelVolumeInMilliliters()

double ml::MedicalImageProperties::getVoxelVolumeInMilliliters ( ) const

Returns the volume of a single voxel in milliliters (ml).

This returns the correct volume for sheared datasets and calculates fabs( inImg->getVoxelToWorldMatrix().det() ) / 1000.

◆ getWorldToVoxelMatrix()

const Matrix4& ml::MedicalImageProperties::getWorldToVoxelMatrix ( ) const

Returns the worlToVoxel matrix.

◆ isVoxelToWorldMatrixValid()

bool ml::MedicalImageProperties::isVoxelToWorldMatrixValid ( ) const

Shows the validity state of the VoxelToWorldMatrix (default=true=valid).

false indicates that the voxelToWorldMatrix is invalid, i.e., also derived data like voxel size or WorldToVoxelMatrix are invalid. Note that this flag state does not change anything on matrix calculations behavior and it does not have anything to do with the validity of the matrix pointer. ML-Matrix calculations are NOT influenced by the state of this flag. Calculations continue even if matrices or voxel size are invalid. This flag is just a hint for operators about matrix reliability. Default is true.

◆ mapVoxelToWorld()

Vector3 ml::MedicalImageProperties::mapVoxelToWorld ( const Vector3 voxelPosition) const

Maps the voxelPosition vector to world coordinates and returns it.

Referenced by ml::PCLMLTools::transformTo().

◆ mapWorldToVoxel()

Vector3 ml::MedicalImageProperties::mapWorldToVoxel ( const Vector3 worldPosition) const

Maps the worldPosition vector to voxel coordinates and returns it.

Referenced by ml::PCLMLTools::transformTo().

◆ operator!=()

bool ml::MedicalImageProperties::operator!= ( const MedicalImageProperties medicalImageProperties) const

Returns true if *this and medicalImageProperties differ, otherwise false.

◆ operator=()

MedicalImageProperties& ml::MedicalImageProperties::operator= ( const MedicalImageProperties medicalImageProperties)

Assignment operator from an existing edicalImageProperties object to get a copy.

The validity flag of ImageProperties is also copied.

◆ operator==()

bool ml::MedicalImageProperties::operator== ( const MedicalImageProperties medicalImageProperties) const

Returns true if *this and medicalImageProperties are identical, otherwise false.

◆ scaleVoxelToWorldMatrix()

void ml::MedicalImageProperties::scaleVoxelToWorldMatrix ( const Vector3 scaleFactors)

Scales the voxelToWorld matrix by the vector scaleFactors and updates the image's voxel size.

◆ setImageProperties()

void ml::MedicalImageProperties::setImageProperties ( const MedicalImageProperties medicalImageProperties)

Sets a copy of the passed image properties medicalImageProperties.

Note that the validity flag of base class imageProperties is not copied, i.e., left unchanged.

◆ setVoxelSize() [1/2]

void ml::MedicalImageProperties::setVoxelSize ( const Vector3 voxelSize)

Sets the voxel size to voxelSize. The transformation matrix is adapted adequately.

◆ setVoxelSize() [2/2]

void ml::MedicalImageProperties::setVoxelSize ( MLdouble  dx,
MLdouble  dy,
MLdouble  dz 
)

Sets the voxel size to dx, dy and dz. This changes the voxelToWorld matrix.

◆ setVoxelToWorldMatrix()

void ml::MedicalImageProperties::setVoxelToWorldMatrix ( const Matrix4 matrix)

Sets the matrix which transforms voxel to world coordinates to matrix.

Referenced by ml::setMLWorldFromITKScaleOriginAndOrientation(), and ml::PCLMLTools::transformTo().

◆ setVoxelToWorldMatrixValid()

void ml::MedicalImageProperties::setVoxelToWorldMatrixValid ( bool  valid)

Validates/Invalidates the VoxelToWorld matrix by passing true/false as valid.

See isVoxelToWorldMatrixValid() for more information.

◆ translateVoxelToWorldMatrix()

void ml::MedicalImageProperties::translateVoxelToWorldMatrix ( const Vector3 offsetVector)

Translates the voxelToWorld matrix by the offsetVector.

Referenced by ml::setITKWorldFromMedicalImageProperty(), and ml::setMLWorldFromITKScaleOriginAndOrientation().


The documentation for this class was generated from the following file: