Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef MITKGEOMETRYCLIPIMAGEFILTER_H_HEADER_INCLUDED_C1F48A22
18 #define MITKGEOMETRYCLIPIMAGEFILTER_H_HEADER_INCLUDED_C1F48A22
19 
21 #include "mitkCommon.h"
22 #include "mitkGeometryData.h"
23 #include "mitkImageTimeSelector.h"
24 #include "mitkImageToImageFilter.h"
25 
26 namespace itk
27 {
28  template <class TPixel, unsigned int VImageDimension>
29  class ITK_EXPORT Image;
30 }
31 
32 namespace mitk
33 {
34  //##Documentation
35  //## @brief Filter for clipping an image with a PlaneGeometry
36  //##
37  //## The given geometry for clipping can be either a PlaneGeometry
38  //## or a TimeGeometry containing multiple instances
39  //## of PlaneGeometry
40  //##
41  //## \todo add AutoOrientLabels, which makes the "left" side (minimum X value) side of the image get one defined
42  //label.
43  //## left-most because vtkPolyDataNormals uses the same definition and this filter is used for visualization of
44  //## front/back side of curved planes
45  //##
46  //## @ingroup Process
48  {
49  public:
51 
52  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
53 
54 
59  void SetClippingGeometry(const mitk::BaseGeometry *aClippingGeometry);
60 
68  void SetClippingGeometry(const mitk::TimeGeometry *aClippingGeometry);
69 
70  const mitk::BaseGeometry *GetClippingGeometry() const;
71  const mitk::TimeGeometry *GetClippingTimeGeometry() const;
72 
73  //##Description
74  //## @brief Get whether the part above or below the geometry
75  //## shall be clipped (default: @a true)
76  itkGetConstMacro(ClipPartAboveGeometry, bool);
77  //## @brief Set whether the part above or below the geometry
78  //## shall be clipped (default: @a true)
79  itkSetMacro(ClipPartAboveGeometry, bool);
80  //## @brief Set whether the part above or below the geometry
81  //## shall be clipped (default: @a true)
82  itkBooleanMacro(ClipPartAboveGeometry);
83 
84  //##Description
85  //## @brief Set value for outside pixels (default: 0),
86  //## used when m_AutoOutsideValue is \a false
87  itkSetMacro(OutsideValue, ScalarType);
88  itkGetConstMacro(OutsideValue, ScalarType);
89 
90  //##Description
91  //## @brief If set to \a true the minimum of the ouput pixel type is
92  //## used as outside value (default: \a false)
93  itkSetMacro(AutoOutsideValue, bool);
94  itkGetConstMacro(AutoOutsideValue, bool);
95  itkBooleanMacro(AutoOutsideValue);
96 
97  itkSetMacro(AutoOrientLabels, bool);
98  itkGetConstMacro(AutoOrientLabels, bool);
99 
100  //##Description
101  //## @brief If set to \a true both sides of the clipping
102  //## geometry will be labeld using m_AboveGeometryLabel and
103  //## m_BelowGeometryLabel
104  itkSetMacro(LabelBothSides, bool);
105  itkGetConstMacro(LabelBothSides, bool);
106  itkBooleanMacro(LabelBothSides);
107 
108  //##Description
109  //## @brief Set for voxels above the clipping geometry.
110  //## This value is only used, if m_LabelBothSides is set to true.
111  itkSetMacro(AboveGeometryLabel, ScalarType);
112  itkGetConstMacro(AboveGeometryLabel, ScalarType);
113 
114  //##Description
115  //## @brief Set for voxels below the clipping geometry.
116  //## This value is only used, if m_LabelBothSides is set to true.
117  itkSetMacro(BelowGeometryLabel, ScalarType);
118  itkGetConstMacro(BelowGeometryLabel, ScalarType);
119 
120  protected:
122 
124 
125  virtual void GenerateInputRequestedRegion() override;
126 
127  virtual void GenerateOutputInformation() override;
128 
129  virtual void GenerateData() override;
130 
131  template <typename TPixel, unsigned int VImageDimension>
132  friend void _InternalComputeClippedImage(itk::Image<TPixel, VImageDimension> *itkImage,
133  mitk::GeometryClipImageFilter *geometryClipper,
134  const mitk::PlaneGeometry *clippingPlaneGeometry);
135 
141 
142  //##Description
143  //## @brief Defines whether the part above or below the geometry
144  //## shall be clipped (default: @a true)
146 
147  //##Description
148  //## @brief Value for outside pixels (default: 0)
149  //##
150  //## Used only if m_AutoOutsideValue is \a false.
152  //##Description
153  //## @brief If \a true the minimum of the ouput pixel type is
154  //## used as outside value (default: \a false)
156 
157  //##Description
158  //## @brief If \a true all pixels above and below the geometry
159  //## are labeled with m_AboveGeometryLabel and m_BelowGeometryLabel
161 
166 
167  //##Description
168  //## @brief Is used for labeling all pixels above the geometry
169  //## when m_LabelBothSides is on
171 
172  //##Description
173  //## @brief Is used for labeling all pixels below the geometry
174  //## when m_LabelBothSides is on
176 
177  //##Description
178  //## @brief Time when Header was last initialized
180  };
181 
182 } // namespace mitk
183 
184 #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:44
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.