Medical Imaging Interaction Toolkit  2018.4.99-701c8286
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);
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 ouput 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 labeld 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 ouput 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 /* 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.