Medical Imaging Interaction Toolkit  2022.04.99-b878213f
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 MITKMASKUTIL
14 #define MITKMASKUTIL
15 
17 #include <mitkImage.h>
19 #include <itkImage.h>
20 
21 namespace mitk
22 {
27 template <class TPixel, unsigned int VImageDimension>
28 class MaskUtilities: public itk::Object
29  {
30  public:
33  typedef itk::Object Superclass;
36 
38  itkNewMacro(Self);
39  itkTypeMacro(MaskUtilities, itk::Object);
40 
41  typedef itk::Image<TPixel, VImageDimension> ImageType;
42  typedef itk::Image<unsigned short, VImageDimension> MaskType;
43 
47  void SetImage(const ImageType* image);
48 
52  void SetMask(const MaskType* mask);
53 
58  bool CheckMaskSanity();
59 
63  typename ImageType::ConstPointer ExtractMaskImageRegion();
64 
65  protected:
66  MaskUtilities(): m_Image(nullptr), m_Mask(nullptr){}
67 
68  ~MaskUtilities() override{}
69 
70  private:
71  const ImageType* m_Image;
72  const MaskType* m_Mask;
73  };
74 
81 
82 }
83 
84 #ifndef ITK_MANUAL_INSTANTIATION
85 #include <mitkMaskUtilities.tpp>
86 #endif
87 
88 #endif
itk::SmartPointer< Self > Pointer
constexpr double NODE_PREDICATE_GEOMETRY_DEFAULT_CHECK_DIRECTION_PRECISION
constexpr double NODE_PREDICATE_GEOMETRY_DEFAULT_CHECK_COORDINATE_PRECISION
constexpr double MASK_SUITABILITY_TOLERANCE_DIRECTION
constexpr double MASK_SUITABILITY_TOLERANCE_COORDINATE
void SetImage(const ImageType *image)
Set image.
itk::SmartPointer< const Self > ConstPointer
DataCollection - Class to facilitate loading/accessing structured data.
ImageType::ConstPointer ExtractMaskImageRegion()
Crops the image to the LargestPossibleRegion of the mask.
Utility class for mask operations. It checks whether an image and a mask are compatible (spacing...
void SetMask(const MaskType *mask)
Set mask.
bool CheckMaskSanity()
Checks whether mask and image are compatible for joint access (as via iterators). Spacing and directi...
itk::Image< unsigned short, VImageDimension > MaskType
itk::Image< TPixel, VImageDimension > ImageType