Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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_HEADER_INCLUDED_C1F48A22
14 #define MITKGEOMETRYCLIPIMAGEFILTER_H_HEADER_INCLUDED_C1F48A22
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) itkCloneMacro(Self)
49 
50 
55  void SetClippingGeometry(const mitk::BaseGeometry *aClippingGeometry);
56 
64  void SetClippingGeometry(const mitk::TimeGeometry *aClippingGeometry);
65 
66  const mitk::BaseGeometry *GetClippingGeometry() const;
67  const mitk::TimeGeometry *GetClippingTimeGeometry() const;
68 
69  //##Description
70  //## @brief Get whether the part above or below the geometry
71  //## shall be clipped (default: @a true)
72  itkGetConstMacro(ClipPartAboveGeometry, bool);
73  //## @brief Set whether the part above or below the geometry
74  //## shall be clipped (default: @a true)
75  itkSetMacro(ClipPartAboveGeometry, bool);
76  //## @brief Set whether the part above or below the geometry
77  //## shall be clipped (default: @a true)
78  itkBooleanMacro(ClipPartAboveGeometry);
79 
80  //##Description
81  //## @brief Set value for outside pixels (default: 0),
82  //## used when m_AutoOutsideValue is \a false
83  itkSetMacro(OutsideValue, ScalarType);
84  itkGetConstMacro(OutsideValue, ScalarType);
85 
86  //##Description
87  //## @brief If set to \a true the minimum of the ouput pixel type is
88  //## used as outside value (default: \a false)
89  itkSetMacro(AutoOutsideValue, bool);
90  itkGetConstMacro(AutoOutsideValue, bool);
91  itkBooleanMacro(AutoOutsideValue);
92 
93  itkSetMacro(AutoOrientLabels, bool);
94  itkGetConstMacro(AutoOrientLabels, bool);
95 
96  //##Description
97  //## @brief If set to \a true both sides of the clipping
98  //## geometry will be labeld using m_AboveGeometryLabel and
99  //## m_BelowGeometryLabel
100  itkSetMacro(LabelBothSides, bool);
101  itkGetConstMacro(LabelBothSides, bool);
102  itkBooleanMacro(LabelBothSides);
103 
104  //##Description
105  //## @brief Set for voxels above the clipping geometry.
106  //## This value is only used, if m_LabelBothSides is set to true.
107  itkSetMacro(AboveGeometryLabel, ScalarType);
108  itkGetConstMacro(AboveGeometryLabel, ScalarType);
109 
110  //##Description
111  //## @brief Set for voxels below the clipping geometry.
112  //## This value is only used, if m_LabelBothSides is set to true.
113  itkSetMacro(BelowGeometryLabel, ScalarType);
114  itkGetConstMacro(BelowGeometryLabel, ScalarType);
115 
116  protected:
118 
119  ~GeometryClipImageFilter() override;
120 
121  void GenerateInputRequestedRegion() override;
122 
123  void GenerateOutputInformation() override;
124 
125  void GenerateData() override;
126 
127  template <typename TPixel, unsigned int VImageDimension>
128  friend void _InternalComputeClippedImage(itk::Image<TPixel, VImageDimension> *itkImage,
129  mitk::GeometryClipImageFilter *geometryClipper,
130  const mitk::PlaneGeometry *clippingPlaneGeometry);
131 
137 
138  //##Description
139  //## @brief Defines whether the part above or below the geometry
140  //## shall be clipped (default: @a true)
142 
143  //##Description
144  //## @brief Value for outside pixels (default: 0)
145  //##
146  //## Used only if m_AutoOutsideValue is \a false.
148  //##Description
149  //## @brief If \a true the minimum of the ouput pixel type is
150  //## used as outside value (default: \a false)
152 
153  //##Description
154  //## @brief If \a true all pixels above and below the geometry
155  //## are labeled with m_AboveGeometryLabel and m_BelowGeometryLabel
157 
162 
163  //##Description
164  //## @brief Is used for labeling all pixels above the geometry
165  //## when m_LabelBothSides is on
167 
168  //##Description
169  //## @brief Is used for labeling all pixels below the geometry
170  //## when m_LabelBothSides is on
172 
173  //##Description
174  //## @brief Time when Header was last initialized
176  };
177 
178 } // namespace mitk
179 
180 #endif /* MITKGEOMETRYCLIPIMAGEFILTER_H_HEADER_INCLUDED_C1F48A22 */
mitk::ImageTimeSelector::Pointer m_InputTimeSelector
double ScalarType
Superclass of all classes generating some kind of mitk::BaseData.
DataCollection - Class to facilitate loading/accessing structured data.
mitk::ImageTimeSelector::Pointer m_OutputTimeSelector
#define MITKALGORITHMSEXT_EXPORT
mitk::GeometryData::Pointer m_ClippingGeometryData
class ITK_EXPORT Image
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
bool m_AutoOrientLabels
Orient above like vtkPolyDataNormals does with AutoOrientNormals.
Superclass of all classes having one or more Images as input and generating Images as output...
mitk::BaseGeometry::ConstPointer m_ClippingGeometry
Describes a two-dimensional, rectangular plane.
mitk::TimeGeometry::ConstPointer m_TimeClippingGeometry
BaseGeometry Describes the geometry of a data object.
Filter for clipping an image with a PlaneGeometry.