ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkSpatialObjectToImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkSpatialObjectToImageFilter_h
19 #define itkSpatialObjectToImageFilter_h
20 
21 #include "itkImageSource.h"
22 #include "itkConceptChecking.h"
23 
24 namespace itk
25 {
39 template< typename TInputSpatialObject, typename TOutputImage >
40 class ITK_TEMPLATE_EXPORT SpatialObjectToImageFilter:public ImageSource< TOutputImage >
41 {
42 public:
43  ITK_DISALLOW_COPY_AND_ASSIGN(SpatialObjectToImageFilter);
44 
50 
51  using OutputImageType = TOutputImage;
54  using OutputImagePointer = typename OutputImageType::Pointer;
55  using ValueType = typename OutputImageType::ValueType;
56  using SpacingType = typename OutputImageType::SpacingType;
58 
60  itkNewMacro(Self);
61 
64 
66  using OutputImageRegionType = typename Superclass::OutputImageRegionType;
67 
69  using InputSpatialObjectType = TInputSpatialObject;
70  using InputSpatialObjectPointer = typename InputSpatialObjectType::Pointer;
71  using InputSpatialObjectConstPointer = typename InputSpatialObjectType::ConstPointer;
72  using ChildrenListType = typename TInputSpatialObject::ChildrenListType;
73 
75  static constexpr unsigned int ObjectDimension = InputSpatialObjectType::ObjectDimension;
76 
77  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
78 
80  using Superclass::SetInput;
81  virtual void SetInput(const InputSpatialObjectType *object);
82 
83  virtual void SetInput(unsigned int, const InputSpatialObjectType *object);
84 
85  const InputSpatialObjectType * GetInput();
86 
87  const InputSpatialObjectType * GetInput(unsigned int idx);
88 
93  virtual void SetSpacing(const SpacingType & spacing);
94 
95  virtual void SetSpacing(const double *spacing);
96 
97  virtual void SetSpacing(const float *spacing);
98 
99  virtual const double * GetSpacing() const;
100 
103  virtual void SetDirection(const DirectionType & direction);
104 
105  virtual const DirectionType & GetDirection() const;
106 
113  itkSetMacro(InsideValue, ValueType);
114  itkGetConstMacro(InsideValue, ValueType);
116 
123  itkSetMacro(OutsideValue, ValueType);
124  itkGetConstMacro(OutsideValue, ValueType);
126 
131  virtual void SetOrigin(const PointType & origin);
132 
133  virtual void SetOrigin(const double *origin);
134 
135  virtual void SetOrigin(const float *origin);
136 
137  virtual const double * GetOrigin() const;
138 
143  itkSetMacro(ChildrenDepth, unsigned int);
144  itkGetConstMacro(ChildrenDepth, unsigned int);
146 
148  itkSetMacro(Size, SizeType);
149  itkGetConstMacro(Size, SizeType);
151 
154  itkSetMacro(UseObjectValue, bool);
155  itkGetConstMacro(UseObjectValue, bool);
157 
158 protected:
160  ~SpatialObjectToImageFilter() override = default;
161 
162  void GenerateOutputInformation() override {} // do nothing
163  void GenerateData() override;
164 
166  double m_Spacing[OutputImageDimension];
167  double m_Origin[OutputImageDimension];
169 
170  unsigned int m_ChildrenDepth;
171 
174 
176 
177  void PrintSelf(std::ostream & os, Indent indent) const override;
178 
179 private:
180 
181 };
182 } // end namespace itk
183 
184 #ifndef ITK_MANUAL_INSTANTIATION
185 #include "itkSpatialObjectToImageFilter.hxx"
186 #endif
187 
188 #endif
typename OutputImageType::Pointer OutputImagePointer
typename OutputImageType::DirectionType DirectionType
typename InputSpatialObjectType::ConstPointer InputSpatialObjectConstPointer
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
typename OutputImageType::RegionType OutputImageRegionType
TOutputImage OutputImageType
Represent a n-dimensional size (bounds) of a n-dimensional image.
Definition: itkSize.h:68
typename InputSpatialObjectType::Pointer InputSpatialObjectPointer
typename OutputImageType::SpacingType SpacingType
typename TInputSpatialObject::ChildrenListType ChildrenListType
typename OutputImageType::ValueType ValueType
typename OutputImageType::PointType PointType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename OutputImageType::SizeType SizeType
Base class for filters that take a SpatialObject as input and produce an image as output...