00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkSpatialObjectToImageFilter_h
00018 #define __itkSpatialObjectToImageFilter_h
00019
00020 #include "itkImageSource.h"
00021 #include "itkConceptChecking.h"
00022
00023 namespace itk
00024 {
00025
00034 template <class TInputSpatialObject, class TOutputImage>
00035 class ITK_EXPORT SpatialObjectToImageFilter : public ImageSource<TOutputImage>
00036 {
00037 public:
00039 typedef SpatialObjectToImageFilter Self;
00040 typedef ImageSource<TOutputImage> Superclass;
00041 typedef SmartPointer<Self> Pointer;
00042 typedef SmartPointer<const Self> ConstPointer;
00043 typedef typename TOutputImage::SizeType SizeType;
00044 typedef typename TOutputImage::PointType PointType;
00045 typedef TOutputImage OutputImageType;
00046 typedef typename OutputImageType::Pointer OutputImagePointer;
00047 typedef typename OutputImageType::ValueType ValueType;
00048 typedef typename OutputImageType::SpacingType SpacingType;
00049
00051 itkNewMacro(Self);
00052
00054 itkTypeMacro(SpatialObjectToImageFilter,ImageSource);
00055
00057 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00058
00060 typedef TInputSpatialObject InputSpatialObjectType;
00061 typedef typename InputSpatialObjectType::Pointer InputSpatialObjectPointer;
00062 typedef typename InputSpatialObjectType::ConstPointer InputSpatialObjectConstPointer;
00063 typedef typename TInputSpatialObject::ChildrenListType ChildrenListType;
00064
00066 itkStaticConstMacro(ObjectDimension, unsigned int,
00067 InputSpatialObjectType::ObjectDimension);
00068 itkStaticConstMacro(OutputImageDimension, unsigned int,
00069 TOutputImage::ImageDimension);
00071
00073 virtual void SetInput( const InputSpatialObjectType *object);
00074 virtual void SetInput( unsigned int, const InputSpatialObjectType * object);
00075 const InputSpatialObjectType * GetInput(void);
00076 const InputSpatialObjectType * GetInput(unsigned int idx);
00078
00083 virtual void SetSpacing( const SpacingType& spacing);
00084 virtual void SetSpacing( const double* spacing);
00085 virtual void SetSpacing( const float* spacing);
00086 virtual const double* GetSpacing() const;
00088
00095 itkSetMacro(InsideValue, ValueType);
00096 itkGetMacro(InsideValue, ValueType);
00098
00105 itkSetMacro(OutsideValue, ValueType);
00106 itkGetMacro(OutsideValue, ValueType);
00108
00113 virtual void SetOrigin( const PointType& origin);
00114 virtual void SetOrigin( const double* origin);
00115 virtual void SetOrigin( const float* origin);
00116 virtual const double * GetOrigin() const;
00118
00123 itkSetMacro(ChildrenDepth, unsigned int);
00124 itkGetMacro(ChildrenDepth, unsigned int);
00126
00128 itkSetMacro(Size,SizeType);
00129 itkGetMacro(Size,SizeType);
00131
00134 itkSetMacro(UseObjectValue,bool);
00135 itkGetMacro(UseObjectValue,bool);
00137
00138
00139 protected:
00140 SpatialObjectToImageFilter();
00141 ~SpatialObjectToImageFilter();
00142
00143 virtual void GenerateOutputInformation(){};
00144 virtual void GenerateData();
00145
00146
00147 SizeType m_Size;
00148 double m_Spacing[OutputImageDimension];
00149 double m_Origin[OutputImageDimension];
00150 unsigned int m_ChildrenDepth;
00151 ValueType m_InsideValue;
00152 ValueType m_OutsideValue;
00153 bool m_UseObjectValue;
00154
00155 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00156
00157 private:
00158 SpatialObjectToImageFilter(const Self&);
00159 void operator=(const Self&);
00160
00161
00162 };
00163
00164 }
00165
00166 #ifndef ITK_MANUAL_INSTANTIATION
00167 #include "itkSpatialObjectToImageFilter.txx"
00168 #endif
00169
00170 #endif
00171