Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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);
42  const mitk::BoundingObject *GetBoundingObject() const;
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 ouput 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:
69  ~BoundingObjectCutter() override;
70 
71  virtual const PixelType GetOutputPixelType();
72 
73  void GenerateInputRequestedRegion() override;
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
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 ouput 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
mitk::BoundingObjectCutter
Cuts an Boundingobject out of an mitk Image.
Definition: mitkBoundingObjectCutter.h:34
mitkImageToImageFilter.h
mitk::BoundingObjectCutter::m_OutsideValue
ScalarType m_OutsideValue
Definition: mitkBoundingObjectCutter.h:109
mitk::BoundingObjectCutter::m_InsidePixelCount
unsigned int m_InsidePixelCount
Definition: mitkBoundingObjectCutter.h:124
mitk::BoundingObjectCutter::m_BoundingObject
mitk::BoundingObject::Pointer m_BoundingObject
Definition: mitkBoundingObjectCutter.h:99
mitkImageTimeSelector.h
mitk::Image
Image class for storing images.
Definition: mitkImage.h:69
itk::SmartPointer< Self >
MitkAlgorithmsExtExports.h
mitk::SlicedData::RegionType
itk::ImageRegion< RegionDimension > RegionType
Definition: mitkSlicedData.h:45
MITKALGORITHMSEXT_EXPORT
#define MITKALGORITHMSEXT_EXPORT
Definition: MitkAlgorithmsExtExports.h:15
mitk::BoundingObjectCutter::m_InputTimeSelector
mitk::ImageTimeSelector::Pointer m_InputTimeSelector
Definition: mitkBoundingObjectCutter.h:134
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::BaseDataSource
Superclass of all classes generating some kind of mitk::BaseData.
Definition: mitkBaseDataSource.h:71
mitk::BoundingObjectCutter::m_InputRequestedRegion
mitk::SlicedData::RegionType m_InputRequestedRegion
Definition: mitkBoundingObjectCutter.h:128
mitk::BoundingObjectCutter::m_InsideValue
ScalarType m_InsideValue
Definition: mitkBoundingObjectCutter.h:104
mitk::PixelType
Class for defining the data type of pixels.
Definition: mitkPixelType.h:51
mitkCommon.h
mitk::BoundingObjectCutter::m_OutsidePixelCount
unsigned int m_OutsidePixelCount
Definition: mitkBoundingObjectCutter.h:123
mitk::BoundingObjectCutter::m_AutoOutsideValue
bool m_AutoOutsideValue
Definition: mitkBoundingObjectCutter.h:113
mitkBoundingObject.h
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::BoundingObjectCutter::m_OutputTimeSelector
mitk::ImageTimeSelector::Pointer m_OutputTimeSelector
Definition: mitkBoundingObjectCutter.h:135
mitk::BoundingObject
superclass of all bounding objects (cylinder, cuboid,...)
Definition: mitkBoundingObject.h:27
mitk::BoundingObjectCutter::m_TimeOfHeaderInitialization
itk::TimeStamp m_TimeOfHeaderInitialization
Definition: mitkBoundingObjectCutter.h:132
mitk::BoundingObjectCutter::m_UseInsideValue
bool m_UseInsideValue
Definition: mitkBoundingObjectCutter.h:121
mitk::BoundingObjectCutter::m_UseWholeInputRegion
bool m_UseWholeInputRegion
Definition: mitkBoundingObjectCutter.h:137
mitk::ImageToImageFilter
Superclass of all classes having one or more Images as input and generating Images as output.
Definition: mitkImageToImageFilter.h:25
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20