ITK  4.8.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 SpatialObjectToImageFilter:public ImageSource< TOutputImage >
41 {
42 public:
48 
49  typedef TOutputImage OutputImageType;
50  typedef typename OutputImageType::SizeType SizeType;
51  typedef typename OutputImageType::PointType PointType;
52  typedef typename OutputImageType::Pointer OutputImagePointer;
53  typedef typename OutputImageType::ValueType ValueType;
54  typedef typename OutputImageType::SpacingType SpacingType;
55  typedef typename OutputImageType::DirectionType DirectionType;
56 
58  itkNewMacro(Self);
59 
62 
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 
81  virtual void SetInput(const InputSpatialObjectType *object);
82 
83  virtual void SetInput(unsigned int, const InputSpatialObjectType *object);
84 
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:
161 
162  virtual void GenerateOutputInformation() ITK_OVERRIDE {} // do nothing
163  virtual void GenerateData() ITK_OVERRIDE;
164 
167  double m_Origin[OutputImageDimension];
169 
170  unsigned int m_ChildrenDepth;
171 
174 
176 
177  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
178 
179 private:
180 
181  SpatialObjectToImageFilter(const Self &); //purposely not implemented
182  void operator=(const Self &); //purposely not implemented
183 };
184 } // end namespace itk
185 
186 #ifndef ITK_MANUAL_INSTANTIATION
187 #include "itkSpatialObjectToImageFilter.hxx"
188 #endif
189 
190 #endif
virtual const double * GetOrigin() const
static const unsigned int OutputImageDimension
virtual void SetOrigin(const PointType &origin)
virtual const DirectionType & GetDirection() const
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.
virtual void GenerateData() override
const InputSpatialObjectType * GetInput()
Superclass::OutputImageRegionType OutputImageRegionType
OutputImageType::DirectionType DirectionType
virtual void PrintSelf(std::ostream &os, Indent indent) const override
virtual void SetInput(const DataObjectIdentifierType &key, DataObject *input)
Protected method for setting indexed and named inputs.
virtual const double * GetSpacing() const
InputSpatialObjectType::ConstPointer InputSpatialObjectConstPointer
virtual void SetSpacing(const SpacingType &spacing)
OutputImageType::RegionType OutputImageRegionType
TInputSpatialObject::ChildrenListType ChildrenListType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void SetDirection(const DirectionType &direction)
Base class for filters that take a SpatialObject as input and produce an image as output...
virtual void SetInput(const InputSpatialObjectType *object)