Medical Imaging Interaction Toolkit  2025.12.02
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 
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 
122 
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 
134  mitk::BaseGeometry::ConstPointer m_ClippingGeometry;
135  mitk::GeometryData::Pointer m_ClippingGeometryData;
136  mitk::TimeGeometry::ConstPointer m_TimeClippingGeometry;
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
#define MITKALGORITHMSEXT_EXPORT
BaseGeometry Describes the geometry of a data object.
Filter for clipping an image with a PlaneGeometry.
const mitk::TimeGeometry * GetClippingTimeGeometry() const
void _InternalComputeClippedImage(itk::Image< TPixel, VImageDimension > *itkImage, mitk::GeometryClipImageFilter *geometryClipper, const mitk::PlaneGeometry *clippingPlaneGeometry)
mitkClassMacro(GeometryClipImageFilter, ImageToImageFilter)
mitk::TimeGeometry::ConstPointer m_TimeClippingGeometry
void SetClippingGeometry(const mitk::TimeGeometry *aClippingGeometry)
mitk::GeometryData::Pointer m_ClippingGeometryData
void GenerateOutputInformation() override
mitk::ImageTimeSelector::Pointer m_InputTimeSelector
void GenerateInputRequestedRegion() override
mitk::BaseGeometry::ConstPointer m_ClippingGeometry
mitk::ImageTimeSelector::Pointer m_OutputTimeSelector
bool m_AutoOrientLabels
Orient above like vtkPolyDataNormals does with AutoOrientNormals.
void SetClippingGeometry(const mitk::BaseGeometry *aClippingGeometry)
const mitk::BaseGeometry * GetClippingGeometry() const
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.
Describes a two-dimensional, rectangular plane.
class ITK_EXPORT Image
Find image slices visible on a given plane.
double ScalarType