Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
mitkGeometryClipImageFilter.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 mitkGeometryClipImageFilter_h
14 #define mitkGeometryClipImageFilter_h
15 
17 #include "mitkCommon.h"
18 #include "mitkGeometryData.h"
19 #include "mitkImageTimeSelector.h"
20 #include "mitkImageToImageFilter.h"
21 
22 namespace itk
23 {
24  template <class TPixel, unsigned int VImageDimension>
25  class ITK_EXPORT Image;
26 }
27 
28 namespace mitk
29 {
30  //##Documentation
31  //## @brief Filter for clipping an image with a PlaneGeometry
32  //##
33  //## The given geometry for clipping can be either a PlaneGeometry
34  //## or a TimeGeometry containing multiple instances
35  //## of PlaneGeometry
36  //##
37  //## \todo add AutoOrientLabels, which makes the "left" side (minimum X value) side of the image get one defined
38  //label.
39  //## left-most because vtkPolyDataNormals uses the same definition and this filter is used for visualization of
40  //## front/back side of curved planes
41  //##
42  //## @ingroup Process
44  {
45  public:
47 
48  itkFactorylessNewMacro(Self);
49 
50  itkCloneMacro(Self);
51 
57  void SetClippingGeometry(const mitk::BaseGeometry *aClippingGeometry);
58 
66  void SetClippingGeometry(const mitk::TimeGeometry *aClippingGeometry);
67 
68  const mitk::BaseGeometry *GetClippingGeometry() const;
69  const mitk::TimeGeometry *GetClippingTimeGeometry() const;
70 
71  //##Description
72  //## @brief Get whether the part above or below the geometry
73  //## shall be clipped (default: @a true)
74  itkGetConstMacro(ClipPartAboveGeometry, bool);
75  //## @brief Set whether the part above or below the geometry
76  //## shall be clipped (default: @a true)
77  itkSetMacro(ClipPartAboveGeometry, bool);
78  //## @brief Set whether the part above or below the geometry
79  //## shall be clipped (default: @a true)
80  itkBooleanMacro(ClipPartAboveGeometry);
81 
82  //##Description
83  //## @brief Set value for outside pixels (default: 0),
84  //## used when m_AutoOutsideValue is \a false
85  itkSetMacro(OutsideValue, ScalarType);
86  itkGetConstMacro(OutsideValue, ScalarType);
87 
88  //##Description
89  //## @brief If set to \a true the minimum of the output pixel type is
90  //## used as outside value (default: \a false)
91  itkSetMacro(AutoOutsideValue, bool);
92  itkGetConstMacro(AutoOutsideValue, bool);
93  itkBooleanMacro(AutoOutsideValue);
94 
95  itkSetMacro(AutoOrientLabels, bool);
96  itkGetConstMacro(AutoOrientLabels, bool);
97 
98  //##Description
99  //## @brief If set to \a true both sides of the clipping
100  //## geometry will be labeled using m_AboveGeometryLabel and
101  //## m_BelowGeometryLabel
102  itkSetMacro(LabelBothSides, bool);
103  itkGetConstMacro(LabelBothSides, bool);
104  itkBooleanMacro(LabelBothSides);
105 
106  //##Description
107  //## @brief Set for voxels above the clipping geometry.
108  //## This value is only used, if m_LabelBothSides is set to true.
109  itkSetMacro(AboveGeometryLabel, ScalarType);
110  itkGetConstMacro(AboveGeometryLabel, ScalarType);
111 
112  //##Description
113  //## @brief Set for voxels below the clipping geometry.
114  //## This value is only used, if m_LabelBothSides is set to true.
115  itkSetMacro(BelowGeometryLabel, ScalarType);
116  itkGetConstMacro(BelowGeometryLabel, ScalarType);
117 
118  protected:
120 
121  ~GeometryClipImageFilter() override;
122 
123  void GenerateInputRequestedRegion() override;
124 
125  void GenerateOutputInformation() override;
126 
127  void GenerateData() override;
128 
129  template <typename TPixel, unsigned int VImageDimension>
130  void _InternalComputeClippedImage(itk::Image<TPixel, VImageDimension> *itkImage,
131  mitk::GeometryClipImageFilter *geometryClipper,
132  const mitk::PlaneGeometry *clippingPlaneGeometry);
133 
139 
140  //##Description
141  //## @brief Defines whether the part above or below the geometry
142  //## shall be clipped (default: @a true)
144 
145  //##Description
146  //## @brief Value for outside pixels (default: 0)
147  //##
148  //## Used only if m_AutoOutsideValue is \a false.
150  //##Description
151  //## @brief If \a true the minimum of the output pixel type is
152  //## used as outside value (default: \a false)
154 
155  //##Description
156  //## @brief If \a true all pixels above and below the geometry
157  //## are labeled with m_AboveGeometryLabel and m_BelowGeometryLabel
159 
164 
165  //##Description
166  //## @brief Is used for labeling all pixels above the geometry
167  //## when m_LabelBothSides is on
169 
170  //##Description
171  //## @brief Is used for labeling all pixels below the geometry
172  //## when m_LabelBothSides is on
174 
175  //##Description
176  //## @brief Time when Header was last initialized
178  };
179 
180 } // namespace mitk
181 
182 #endif
mitk::GeometryClipImageFilter::m_BelowGeometryLabel
ScalarType m_BelowGeometryLabel
Definition: mitkGeometryClipImageFilter.h:173
mitk::GeometryClipImageFilter::m_LabelBothSides
bool m_LabelBothSides
Definition: mitkGeometryClipImageFilter.h:158
mitk::TimeGeometry
Definition: mitkTimeGeometry.h:45
mitkImageToImageFilter.h
mitk::GeometryClipImageFilter::m_TimeClippingGeometry
mitk::TimeGeometry::ConstPointer m_TimeClippingGeometry
Definition: mitkGeometryClipImageFilter.h:136
mitk::GeometryClipImageFilter::m_ClippingGeometryData
mitk::GeometryData::Pointer m_ClippingGeometryData
Definition: mitkGeometryClipImageFilter.h:135
mitk::PlaneGeometry
Describes a two-dimensional, rectangular plane.
Definition: mitkPlaneGeometry.h:78
mitk::GeometryClipImageFilter::m_AutoOrientLabels
bool m_AutoOrientLabels
Orient above like vtkPolyDataNormals does with AutoOrientNormals.
Definition: mitkGeometryClipImageFilter.h:163
mitkImageTimeSelector.h
itk::SmartPointer< const Self >
MitkAlgorithmsExtExports.h
mitk::GeometryClipImageFilter::m_OutputTimeSelector
mitk::ImageTimeSelector::Pointer m_OutputTimeSelector
Definition: mitkGeometryClipImageFilter.h:138
MITKALGORITHMSEXT_EXPORT
#define MITKALGORITHMSEXT_EXPORT
Definition: MitkAlgorithmsExtExports.h:15
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::GeometryClipImageFilter::m_AutoOutsideValue
bool m_AutoOutsideValue
Definition: mitkGeometryClipImageFilter.h:153
mitk::GeometryClipImageFilter::m_ClippingGeometry
mitk::BaseGeometry::ConstPointer m_ClippingGeometry
Definition: mitkGeometryClipImageFilter.h:134
mitk::BaseGeometry
BaseGeometry Describes the geometry of a data object.
Definition: mitkBaseGeometry.h:94
mitk::GeometryClipImageFilter::m_OutsideValue
ScalarType m_OutsideValue
Definition: mitkGeometryClipImageFilter.h:149
mitkCommon.h
mitkGeometryData.h
mitk::GeometryClipImageFilter::m_ClipPartAboveGeometry
bool m_ClipPartAboveGeometry
Definition: mitkGeometryClipImageFilter.h:143
mitk::GeometryClipImageFilter::m_InputTimeSelector
mitk::ImageTimeSelector::Pointer m_InputTimeSelector
Definition: mitkGeometryClipImageFilter.h:137
mitk::GeometryClipImageFilter::m_AboveGeometryLabel
ScalarType m_AboveGeometryLabel
Definition: mitkGeometryClipImageFilter.h:168
itk
SET FUNCTIONS.
Definition: itkIntelligentBinaryClosingFilter.h:30
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
itk::Image
class ITK_EXPORT Image
Definition: mitkGeometryClipImageFilter.h:25
mitk::GeometryClipImageFilter::m_TimeOfHeaderInitialization
itk::TimeStamp m_TimeOfHeaderInitialization
Definition: mitkGeometryClipImageFilter.h:177
mitk::GeometryClipImageFilter
Filter for clipping an image with a PlaneGeometry.
Definition: mitkGeometryClipImageFilter.h:43
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