ITK  4.13.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:
48 
49  typedef TOutputImage OutputImageType;
52  typedef typename OutputImageType::Pointer OutputImagePointer;
53  typedef typename OutputImageType::ValueType ValueType;
54  typedef typename OutputImageType::SpacingType SpacingType;
56 
58  itkNewMacro(Self);
59 
62 
64  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
65 
67  typedef TInputSpatialObject InputSpatialObjectType;
68  typedef typename InputSpatialObjectType::Pointer InputSpatialObjectPointer;
69  typedef typename InputSpatialObjectType::ConstPointer InputSpatialObjectConstPointer;
70  typedef typename TInputSpatialObject::ChildrenListType ChildrenListType;
71 
73  itkStaticConstMacro(ObjectDimension, unsigned int,
74  InputSpatialObjectType::ObjectDimension);
75 
76  itkStaticConstMacro(OutputImageDimension, unsigned int,
77  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() ITK_OVERRIDE;
161 
162  virtual void GenerateOutputInformation() ITK_OVERRIDE {} // do nothing
163  virtual void GenerateData() ITK_OVERRIDE;
164 
165  SizeType m_Size;
166  double m_Spacing[OutputImageDimension];
167  double m_Origin[OutputImageDimension];
168  DirectionType m_Direction;
169 
170  unsigned int m_ChildrenDepth;
171 
172  ValueType m_InsideValue;
174 
175  bool m_UseObjectValue;
176 
177  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
178 
179 private:
180 
181  ITK_DISALLOW_COPY_AND_ASSIGN(SpatialObjectToImageFilter);
182 };
183 } // end namespace itk
184 
185 #ifndef ITK_MANUAL_INSTANTIATION
186 #include "itkSpatialObjectToImageFilter.hxx"
187 #endif
188 
189 #endif
Represent the size (bounds) of a n-dimensional image.
Definition: itkSize.h:52
OutputImageType::SpacingType SpacingType
InputSpatialObjectType::Pointer InputSpatialObjectPointer
Base class for all process objects that output image data.
Superclass::OutputImageRegionType OutputImageRegionType
OutputImageType::DirectionType DirectionType
InputSpatialObjectType::ConstPointer InputSpatialObjectConstPointer
TOutput m_OutsideValue
TInputSpatialObject::ChildrenListType ChildrenListType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for filters that take a SpatialObject as input and produce an image as output...