Medical Imaging Interaction Toolkit  2018.4.99-b20efe7f
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(ImageType* image);
48 
52  void SetMask(MaskType* mask);
53 
58  bool CheckMaskSanity();
59 
63  typename itk::Image<TPixel, VImageDimension>::Pointer ExtractMaskImageRegion();
64 
65  protected:
66  MaskUtilities(): m_Image(nullptr), m_Mask(nullptr){}
67 
68  ~MaskUtilities() override{}
69 
70  private:
71  itk::Image<TPixel, VImageDimension>* m_Image;
72  itk::Image<unsigned short, VImageDimension>* 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 MASK_SUITABILITY_TOLERANCE_DIRECTION
constexpr double MASK_SUITABILITY_TOLERANCE_COORDINATE
itk::SmartPointer< const Self > ConstPointer
DataCollection - Class to facilitate loading/accessing structured data.
Utility class for mask operations. It checks whether an image and a mask are compatible (spacing...
constexpr double NODE_PREDICATE_GEOMETRY_DEFAULT_CHECK_PRECISION
bool CheckMaskSanity()
Checks whether mask and image are compatible for joint access (as via iterators). Spacing and directi...
void SetImage(ImageType *image)
Set image.
mitk::Image::Pointer image
itk::Image< unsigned short, VImageDimension > MaskType
itk::Image< TPixel, VImageDimension > ImageType
void SetMask(MaskType *mask)
Set mask.
itk::Image< TPixel, VImageDimension >::Pointer ExtractMaskImageRegion()
Crops the image to the LargestPossibleRegion of the mask.
mitk::Image::Pointer mask