Medical Imaging Interaction Toolkit  2018.4.99-a28b433c
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);
39  itkCloneMacro(Self);
40 
41  void SetBoundingObject(const mitk::BoundingObject *boundingObject);
42  const mitk::BoundingObject *GetBoundingObject() const;
43  //##Description
44  //## @brief Set for inside pixels, used when m_UseInsideValue is @a true
45  itkSetMacro(InsideValue, ScalarType);
46  itkGetMacro(InsideValue, ScalarType);
47  //##Description
48  //## @brief Set value for outside pixels, used when m_AutoOutsideValue is \a false
49  itkSetMacro(OutsideValue, ScalarType);
50  itkGetMacro(OutsideValue, ScalarType);
51  itkSetMacro(UseInsideValue, bool);
52  itkGetMacro(UseInsideValue, bool);
53  itkBooleanMacro(UseInsideValue);
54  //##Description
55  //## @brief If set to \a true the minimum of the ouput pixel type is
56  //## used as outside value.
57  itkSetMacro(AutoOutsideValue, bool);
58  itkGetMacro(AutoOutsideValue, bool);
59  itkBooleanMacro(AutoOutsideValue);
60 
61  itkGetMacro(InsidePixelCount, unsigned int);
62  itkGetMacro(OutsidePixelCount, unsigned int);
63 
64  itkSetMacro(UseWholeInputRegion, bool);
65  itkGetMacro(UseWholeInputRegion, bool);
66 
67  protected:
69  ~BoundingObjectCutter() override;
70 
71  virtual const PixelType GetOutputPixelType();
72 
73  void GenerateInputRequestedRegion() override;
74  void GenerateOutputInformation() override;
75  void GenerateData() override;
76 
77  template <typename TPixel, unsigned int VImageDimension, typename TOutputPixel>
78  friend void CutImageWithOutputTypeSelect(itk::Image<TPixel, VImageDimension> *inputItkImage,
80  int boTimeStep,
81  TOutputPixel *dummy);
82  template <typename TPixel, unsigned int VImageDimension, typename TOutputPixel>
83  friend void CutImageWithOutputTypeSelect(itk::VectorImage<TPixel, VImageDimension> *inputItkImage,
85  int boTimeStep,
86  TOutputPixel *dummy);
87  template <typename TPixel, unsigned int VImageDimension>
88  friend void CutImage(itk::Image<TPixel, VImageDimension> *itkImage,
90  int boTimeStep);
91  template <typename TPixel, unsigned int VImageDimension>
92  friend void CutImage(itk::VectorImage<TPixel, VImageDimension> *itkImage,
94  int boTimeStep);
95  virtual void ComputeData(mitk::Image *input3D, int boTimeStep);
96 
97  //##Description
98  //## @brief BoundingObject that will be cut
100  //##Description
101  //## @brief Value for inside pixels, used when m_UseInsideValue is @a true
102  //##
103  //## \sa m_UseInsideValue
105  //##Description
106  //## @brief Value for outside pixels (default: 0)
107  //##
108  //## Used only if m_AutoOutsideValue is \a false.
110  //##Description
111  //## @brief If \a true the minimum of the ouput pixel type is
112  //## used as outside value (default: \a false)
114  //##Description
115  //## @brief Use m_InsideValue for inside pixels (default: \a false)
116  //##
117  //## If @a true, pixels that are inside m_BoundingObject
118  //## will get m_InsideValue in the cutting process
119  //## If @a false, they keep their original value.
120  //## \sa m_InsideValue
122 
123  unsigned int m_OutsidePixelCount;
124  unsigned int m_InsidePixelCount;
125 
126  //##Description
127  //## @brief Region of input needed for cutting
129 
130  //##Description
131  //## @brief Time when Header was last initialized
133 
136 
138  };
139 } // namespace mitk
140 
141 #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