ITK  4.2.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< class TInputSpatialObject, class TOutputImage >
40 class ITK_EXPORT 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 
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(void);
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(void) const;
100 
103  virtual void SetDirection(const DirectionType & direction);
104 
105  virtual const DirectionType & GetDirection(void) 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(void) 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);
156 protected:
160 
161  virtual void GenerateOutputInformation(){} // do nothing
162  virtual void GenerateData();
163 
165  double m_Spacing[OutputImageDimension];
166  double m_Origin[OutputImageDimension];
168 
169  unsigned int m_ChildrenDepth;
170 
173 
175 
176  virtual void PrintSelf(std::ostream & os, Indent indent) const;
177 
178 private:
179 
180  SpatialObjectToImageFilter(const Self &); //purposely not implemented
181  void operator=(const Self &); //purposely not implemented
182 };
183 } // end namespace itk
184 
185 #ifndef ITK_MANUAL_INSTANTIATION
186 #include "itkSpatialObjectToImageFilter.hxx"
187 #endif
188 
189 #endif
190