Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkBoundingObjectCutter.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 BOUNDINGOBJECTCUTTER_H_HEADER_INCLUDED_C10B22CD
14 #define BOUNDINGOBJECTCUTTER_H_HEADER_INCLUDED_C10B22CD
15 
17 #include "itkImage.h"
18 #include "mitkBoundingObject.h"
19 #include "mitkCommon.h"
20 #include "mitkImageTimeSelector.h"
21 #include "mitkImageToImageFilter.h"
22 
23 namespace mitk
24 {
25  //##Documentation
26  //## @brief Cuts an Boundingobject out of an mitk Image
27  //##
28  //## Input Parameters are a mitk::BoundingObject and optionally an mitk::Image
29  //## if no mitk::Image is provided, the resulting image will have m_InsideValue as pixelvalue on inside pixel,
30  //## otherwise it will have the pixelvalue of the input image.
31  //## Pixel on the outside of the BoundingObject will have a pixelvalue of m_OutsideValue
32  //## \todo What Image resolution/spacing should be used, if no input image is given?
33  //## @ingroup Process
35  {
36  public:
38  itkFactorylessNewMacro(Self) itkCloneMacro(Self)
39 
40  void SetBoundingObject(const mitk::BoundingObject *boundingObject);
41  const mitk::BoundingObject *GetBoundingObject() const;
42  //##Description
43  //## @brief Set for inside pixels, used when m_UseInsideValue is @a true
44  itkSetMacro(InsideValue, ScalarType);
45  itkGetMacro(InsideValue, ScalarType);
46  //##Description
47  //## @brief Set value for outside pixels, used when m_AutoOutsideValue is \a false
48  itkSetMacro(OutsideValue, ScalarType);
49  itkGetMacro(OutsideValue, ScalarType);
50  itkSetMacro(UseInsideValue, bool);
51  itkGetMacro(UseInsideValue, bool);
52  itkBooleanMacro(UseInsideValue);
53  //##Description
54  //## @brief If set to \a true the minimum of the ouput pixel type is
55  //## used as outside value.
56  itkSetMacro(AutoOutsideValue, bool);
57  itkGetMacro(AutoOutsideValue, bool);
58  itkBooleanMacro(AutoOutsideValue);
59 
60  itkGetMacro(InsidePixelCount, unsigned int);
61  itkGetMacro(OutsidePixelCount, unsigned int);
62 
63  itkSetMacro(UseWholeInputRegion, bool);
64  itkGetMacro(UseWholeInputRegion, bool);
65 
66  protected:
68  ~BoundingObjectCutter() override;
69 
70  virtual const PixelType GetOutputPixelType();
71 
72  void GenerateInputRequestedRegion() override;
73  void GenerateOutputInformation() override;
74  void GenerateData() override;
75 
76  template <typename TPixel, unsigned int VImageDimension, typename TOutputPixel>
77  friend void CutImageWithOutputTypeSelect(itk::Image<TPixel, VImageDimension> *inputItkImage,
79  int boTimeStep,
80  TOutputPixel *dummy);
81  template <typename TPixel, unsigned int VImageDimension, typename TOutputPixel>
82  friend void CutImageWithOutputTypeSelect(itk::VectorImage<TPixel, VImageDimension> *inputItkImage,
84  int boTimeStep,
85  TOutputPixel *dummy);
86  template <typename TPixel, unsigned int VImageDimension>
87  friend void CutImage(itk::Image<TPixel, VImageDimension> *itkImage,
89  int boTimeStep);
90  template <typename TPixel, unsigned int VImageDimension>
91  friend void CutImage(itk::VectorImage<TPixel, VImageDimension> *itkImage,
93  int boTimeStep);
94  virtual void ComputeData(mitk::Image *input3D, int boTimeStep);
95 
96  //##Description
97  //## @brief BoundingObject that will be cut
99  //##Description
100  //## @brief Value for inside pixels, used when m_UseInsideValue is @a true
101  //##
102  //## \sa m_UseInsideValue
104  //##Description
105  //## @brief Value for outside pixels (default: 0)
106  //##
107  //## Used only if m_AutoOutsideValue is \a false.
109  //##Description
110  //## @brief If \a true the minimum of the ouput pixel type is
111  //## used as outside value (default: \a false)
113  //##Description
114  //## @brief Use m_InsideValue for inside pixels (default: \a false)
115  //##
116  //## If @a true, pixels that are inside m_BoundingObject
117  //## will get m_InsideValue in the cutting process
118  //## If @a false, they keep their original value.
119  //## \sa m_InsideValue
121 
122  unsigned int m_OutsidePixelCount;
123  unsigned int m_InsidePixelCount;
124 
125  //##Description
126  //## @brief Region of input needed for cutting
128 
129  //##Description
130  //## @brief Time when Header was last initialized
132 
135 
137  };
138 } // namespace mitk
139 
140 #endif /* BOUNDINGOBJECTCUTTER_H_HEADER_INCLUDED_C10B22CD */
mitk::BoundingObject::Pointer m_BoundingObject
Cuts an Boundingobject out of an mitk Image.
double ScalarType
Superclass of all classes generating some kind of mitk::BaseData.
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKALGORITHMSEXT_EXPORT
superclass of all bounding objects (cylinder, cuboid,...)
itk::ImageRegion< RegionDimension > RegionType
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
Image class for storing images.
Definition: mitkImage.h:72
mitk::SlicedData::RegionType m_InputRequestedRegion
mitk::ImageTimeSelector::Pointer m_InputTimeSelector
Superclass of all classes having one or more Images as input and generating Images as output...
mitk::ImageTimeSelector::Pointer m_OutputTimeSelector
Class for defining the data type of pixels.
Definition: mitkPixelType.h:51