Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkMaskUtilities.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkMaskUtilities_h
14 #define mitkMaskUtilities_h
15 
17 #include <mitkImage.h>
19 #include <itkImage.h>
20 
21 namespace mitk
22 {
37 template <class TPixel, unsigned int VImageDimension>
38 class MaskUtilities: public itk::Object
39  {
40  public:
43  typedef itk::Object Superclass;
46 
48  itkNewMacro(Self);
49  itkTypeMacro(MaskUtilities, itk::Object);
50 
52  typedef itk::Image<TPixel, VImageDimension> ImageType;
54  typedef itk::Image<unsigned short, VImageDimension> MaskType;
55 
60  void SetImage(const ImageType* image);
61 
66  void SetMask(const MaskType* mask);
67 
81 
87  typename ImageType::ConstPointer ExtractMaskImageRegion();
88 
89  protected:
90  MaskUtilities(): m_Image(nullptr), m_Mask(nullptr){}
91 
92  ~MaskUtilities() override{}
93 
94  private:
95  const ImageType* m_Image;
96  const MaskType* m_Mask;
97  };
98 
105 
106 }
107 
108 #ifndef ITK_MANUAL_INSTANTIATION
109 #include <mitkMaskUtilities.tpp>
110 #endif
111 
112 #endif
Utility class for validating and adapting masks for use with images.
void SetMask(const MaskType *mask)
Set the mask image.
itk::SmartPointer< Self > Pointer
itk::Image< TPixel, VImageDimension > ImageType
ITK image type with the given pixel type and dimension.
itk::Image< unsigned short, VImageDimension > MaskType
Mask image type (unsigned short) with the given dimension.
itk::SmartPointer< const Self > ConstPointer
ImageType::ConstPointer ExtractMaskImageRegion()
Crop the image to the LargestPossibleRegion of the mask.
void SetImage(const ImageType *image)
Set the image to validate against the mask.
bool CheckMaskSanity()
Check whether the mask and image are geometrically compatible.
Find image slices visible on a given plane.
constexpr double MASK_SUITABILITY_TOLERANCE_DIRECTION
constexpr double NODE_PREDICATE_GEOMETRY_DEFAULT_CHECK_DIRECTION_PRECISION
The default tolerance for the comparison of direction matrix equality.
constexpr double MASK_SUITABILITY_TOLERANCE_COORDINATE
constexpr double NODE_PREDICATE_GEOMETRY_DEFAULT_CHECK_COORDINATE_PRECISION
The default tolerance for the comparison of spatial/world coordinate equality.