Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::MaskUtilities< TPixel, VImageDimension > Class Template Reference

Utility class for validating and adapting masks for use with images. More...

#include <mitkMaskUtilities.h>

Inheritance diagram for mitk::MaskUtilities< TPixel, VImageDimension >:
Collaboration diagram for mitk::MaskUtilities< TPixel, VImageDimension >:

Public Types

typedef MaskUtilities Self
 
typedef itk::Object Superclass
 
typedef itk::SmartPointer< Self > Pointer
 
typedef itk::SmartPointer< const Self > ConstPointer
 
typedef itk::Image< TPixel, VImageDimension > ImageType
 ITK image type with the given pixel type and dimension. More...
 
typedef itk::Image< unsigned short, VImageDimension > MaskType
 Mask image type (unsigned short) with the given dimension. More...
 

Public Member Functions

virtual const char * GetClassName () const
 
void SetImage (const ImageType *image)
 Set the image to validate against the mask. More...
 
void SetMask (const MaskType *mask)
 Set the mask image. More...
 
bool CheckMaskSanity ()
 Check whether the mask and image are geometrically compatible. More...
 
ImageType::ConstPointer ExtractMaskImageRegion ()
 Crop the image to the LargestPossibleRegion of the mask. More...
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 MaskUtilities ()
 
 ~MaskUtilities () override
 

Detailed Description

template<class TPixel, unsigned int VImageDimension>
class mitk::MaskUtilities< TPixel, VImageDimension >

Utility class for validating and adapting masks for use with images.

MaskUtilities provides functionality to check whether an ITK image and a mask image are geometrically compatible (same spacing, direction, and alignment) and to crop the image region to match the mask's LargestPossibleRegion.

Template Parameters
TPixelThe pixel type of the image.
VImageDimensionThe dimensionality of the image and mask.
See also
ImageStatisticsCalculator
ImageMaskGenerator

Definition at line 38 of file mitkMaskUtilities.h.

Member Typedef Documentation

◆ ConstPointer

template<class TPixel , unsigned int VImageDimension>
typedef itk::SmartPointer< const Self > mitk::MaskUtilities< TPixel, VImageDimension >::ConstPointer

Definition at line 45 of file mitkMaskUtilities.h.

◆ ImageType

template<class TPixel , unsigned int VImageDimension>
typedef itk::Image<TPixel, VImageDimension> mitk::MaskUtilities< TPixel, VImageDimension >::ImageType

ITK image type with the given pixel type and dimension.

Definition at line 52 of file mitkMaskUtilities.h.

◆ MaskType

template<class TPixel , unsigned int VImageDimension>
typedef itk::Image<unsigned short, VImageDimension> mitk::MaskUtilities< TPixel, VImageDimension >::MaskType

Mask image type (unsigned short) with the given dimension.

Definition at line 54 of file mitkMaskUtilities.h.

◆ Pointer

template<class TPixel , unsigned int VImageDimension>
typedef itk::SmartPointer< Self > mitk::MaskUtilities< TPixel, VImageDimension >::Pointer

Definition at line 44 of file mitkMaskUtilities.h.

◆ Self

template<class TPixel , unsigned int VImageDimension>
typedef MaskUtilities mitk::MaskUtilities< TPixel, VImageDimension >::Self

Standard Self typedef

Definition at line 42 of file mitkMaskUtilities.h.

◆ Superclass

template<class TPixel , unsigned int VImageDimension>
typedef itk::Object mitk::MaskUtilities< TPixel, VImageDimension >::Superclass

Definition at line 43 of file mitkMaskUtilities.h.

Constructor & Destructor Documentation

◆ MaskUtilities()

template<class TPixel , unsigned int VImageDimension>
mitk::MaskUtilities< TPixel, VImageDimension >::MaskUtilities ( )
inlineprotected

Definition at line 90 of file mitkMaskUtilities.h.

◆ ~MaskUtilities()

template<class TPixel , unsigned int VImageDimension>
mitk::MaskUtilities< TPixel, VImageDimension >::~MaskUtilities ( )
inlineoverrideprotected

Definition at line 92 of file mitkMaskUtilities.h.

Member Function Documentation

◆ CheckMaskSanity()

template<class TPixel , unsigned int VImageDimension>
bool mitk::MaskUtilities< TPixel, VImageDimension >::CheckMaskSanity ( )

Check whether the mask and image are geometrically compatible.

Validates that spacing and direction are the same between image and mask (within tolerance), that the two are grid-aligned, and that the mask region is completely inside the image region.

Returns
True if mask and image are compatible for joint pixel access.
See also
MASK_SUITABILITY_TOLERANCE_COORDINATE
MASK_SUITABILITY_TOLERANCE_DIRECTION

◆ ExtractMaskImageRegion()

template<class TPixel , unsigned int VImageDimension>
ImageType::ConstPointer mitk::MaskUtilities< TPixel, VImageDimension >::ExtractMaskImageRegion ( )

Crop the image to the LargestPossibleRegion of the mask.

Returns
Const pointer to the cropped image region matching the mask extent.

◆ GetClassName()

template<class TPixel , unsigned int VImageDimension>
virtual const char* mitk::MaskUtilities< TPixel, VImageDimension >::GetClassName ( ) const
virtual

Runtime information support.

◆ New()

template<class TPixel , unsigned int VImageDimension>
static Pointer mitk::MaskUtilities< TPixel, VImageDimension >::New ( )
static

Method for creation through the object factory.

◆ SetImage()

template<class TPixel , unsigned int VImageDimension>
void mitk::MaskUtilities< TPixel, VImageDimension >::SetImage ( const ImageType *  image)

Set the image to validate against the mask.

Parameters
[in]imageConst pointer to the ITK image.

◆ SetMask()

template<class TPixel , unsigned int VImageDimension>
void mitk::MaskUtilities< TPixel, VImageDimension >::SetMask ( const MaskType *  mask)

Set the mask image.

Parameters
[in]maskConst pointer to the ITK mask image.

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