Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
mitkBoundingObjectCutter.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 mitkBoundingObjectCutter_h
14 #define mitkBoundingObjectCutter_h
15 
17 #include "itkImage.h"
18 #include "mitkBoundingObject.h"
19 #include "mitkCommon.h"
20 #include "mitkImageTimeSelector.h"
21 #include "mitkImageToImageFilter.h"
22 
23 namespace mitk
24 {
25  //##Documentation
26  //## @brief Cuts an Boundingobject out of an mitk Image
27  //##
28  //## Input Parameters are a mitk::BoundingObject and optionally an mitk::Image
29  //## if no mitk::Image is provided, the resulting image will have m_InsideValue as pixelvalue on inside pixel,
30  //## otherwise it will have the pixelvalue of the input image.
31  //## Pixel on the outside of the BoundingObject will have a pixelvalue of m_OutsideValue
32  //## \todo What Image resolution/spacing should be used, if no input image is given?
33  //## @ingroup Process
35  {
36  public:
38  itkFactorylessNewMacro(Self);
39  itkCloneMacro(Self);
40 
41  void SetBoundingObject(const mitk::BoundingObject *boundingObject);
43  //##Description
44  //## @brief Set for inside pixels, used when m_UseInsideValue is @a true
45  itkSetMacro(InsideValue, ScalarType);
46  itkGetMacro(InsideValue, ScalarType);
47  //##Description
48  //## @brief Set value for outside pixels, used when m_AutoOutsideValue is \a false
49  itkSetMacro(OutsideValue, ScalarType);
50  itkGetMacro(OutsideValue, ScalarType);
51  itkSetMacro(UseInsideValue, bool);
52  itkGetMacro(UseInsideValue, bool);
53  itkBooleanMacro(UseInsideValue);
54  //##Description
55  //## @brief If set to \a true the minimum of the output pixel type is
56  //## used as outside value.
57  itkSetMacro(AutoOutsideValue, bool);
58  itkGetMacro(AutoOutsideValue, bool);
59  itkBooleanMacro(AutoOutsideValue);
60 
61  itkGetMacro(InsidePixelCount, unsigned int);
62  itkGetMacro(OutsidePixelCount, unsigned int);
63 
64  itkSetMacro(UseWholeInputRegion, bool);
65  itkGetMacro(UseWholeInputRegion, bool);
66 
67  protected:
70 
71  virtual const PixelType GetOutputPixelType();
72 
74  void GenerateOutputInformation() override;
75  void GenerateData() override;
76 
77  template <typename TPixel, unsigned int VImageDimension, typename TOutputPixel>
78  friend void CutImageWithOutputTypeSelect(itk::Image<TPixel, VImageDimension> *inputItkImage,
80  int boTimeStep,
81  TOutputPixel *dummy);
82  template <typename TPixel, unsigned int VImageDimension, typename TOutputPixel>
83  friend void CutImageWithOutputTypeSelect(itk::VectorImage<TPixel, VImageDimension> *inputItkImage,
85  int boTimeStep,
86  TOutputPixel *dummy);
87  template <typename TPixel, unsigned int VImageDimension>
88  friend void CutImage(itk::Image<TPixel, VImageDimension> *itkImage,
90  int boTimeStep);
91  template <typename TPixel, unsigned int VImageDimension>
92  friend void CutImage(itk::VectorImage<TPixel, VImageDimension> *itkImage,
94  int boTimeStep);
95  virtual void ComputeData(mitk::Image *input3D, int boTimeStep);
96 
97  //##Description
98  //## @brief BoundingObject that will be cut
99  mitk::BoundingObject::Pointer m_BoundingObject;
100  //##Description
101  //## @brief Value for inside pixels, used when m_UseInsideValue is @a true
102  //##
103  //## \sa m_UseInsideValue
105  //##Description
106  //## @brief Value for outside pixels (default: 0)
107  //##
108  //## Used only if m_AutoOutsideValue is \a false.
110  //##Description
111  //## @brief If \a true the minimum of the output pixel type is
112  //## used as outside value (default: \a false)
114  //##Description
115  //## @brief Use m_InsideValue for inside pixels (default: \a false)
116  //##
117  //## If @a true, pixels that are inside m_BoundingObject
118  //## will get m_InsideValue in the cutting process
119  //## If @a false, they keep their original value.
120  //## \sa m_InsideValue
122 
123  unsigned int m_OutsidePixelCount;
124  unsigned int m_InsidePixelCount;
125 
126  //##Description
127  //## @brief Region of input needed for cutting
129 
130  //##Description
131  //## @brief Time when Header was last initialized
133 
136 
138  };
139 } // namespace mitk
140 
141 #endif
#define MITKALGORITHMSEXT_EXPORT
Cuts an Boundingobject out of an mitk Image.
mitk::ImageTimeSelector::Pointer m_InputTimeSelector
const mitk::BoundingObject * GetBoundingObject() const
friend void CutImageWithOutputTypeSelect(itk::Image< TPixel, VImageDimension > *inputItkImage, mitk::BoundingObjectCutter *cutter, int boTimeStep, TOutputPixel *dummy)
mitk::ImageTimeSelector::Pointer m_OutputTimeSelector
void GenerateInputRequestedRegion() override
void GenerateData() override
mitk::BoundingObject::Pointer m_BoundingObject
virtual void ComputeData(mitk::Image *input3D, int boTimeStep)
void SetBoundingObject(const mitk::BoundingObject *boundingObject)
friend void CutImageWithOutputTypeSelect(itk::VectorImage< TPixel, VImageDimension > *inputItkImage, mitk::BoundingObjectCutter *cutter, int boTimeStep, TOutputPixel *dummy)
mitkClassMacro(BoundingObjectCutter, ImageToImageFilter)
mitk::SlicedData::RegionType m_InputRequestedRegion
void GenerateOutputInformation() override
virtual const PixelType GetOutputPixelType()
friend void CutImage(itk::VectorImage< TPixel, VImageDimension > *itkImage, mitk::BoundingObjectCutter *cutter, int boTimeStep)
friend void CutImage(itk::Image< TPixel, VImageDimension > *itkImage, mitk::BoundingObjectCutter *cutter, int boTimeStep)
superclass of all bounding objects (cylinder, cuboid,...)
Superclass of all classes generating Images (instances of class Image) as output.
Superclass of all classes having one or more Images as input and generating Images as output.
Image class for storing images.
Definition: mitkImage.h:70
Class for defining the data type of pixels.
Definition: mitkPixelType.h:52
itk::ImageRegion< RegionDimension > RegionType
Find image slices visible on a given plane.
double ScalarType