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);
00070
00072 virtual void SetInput( const InputSpatialObjectType *object);
00073 virtual void SetInput( unsigned int, const InputSpatialObjectType * object);
00074 const InputSpatialObjectType * GetInput(void);
00075 const InputSpatialObjectType * GetInput(unsigned int idx);
00076
00081 virtual void SetSpacing( const SpacingType& spacing);
00082 virtual void SetSpacing( const double* spacing);
00083 virtual void SetSpacing( const float* spacing);
00084 virtual const double* GetSpacing() const;
00085
00092 itkSetMacro(InsideValue, ValueType);
00093 itkGetMacro(InsideValue, ValueType);
00094
00101 itkSetMacro(OutsideValue, ValueType);
00102 itkGetMacro(OutsideValue, ValueType);
00103
00108 virtual void SetOrigin( const PointType& origin);
00109 virtual void SetOrigin( const double* origin);
00110 virtual void SetOrigin( const float* origin);
00111 virtual const double * GetOrigin() const;
00112
00117 itkSetMacro(ChildrenDepth, unsigned int);
00118 itkGetMacro(ChildrenDepth, unsigned int);
00119
00121 itkSetMacro(Size,SizeType);
00122 itkGetMacro(Size,SizeType);
00123
00126 itkSetMacro(UseObjectValue,bool);
00127 itkGetMacro(UseObjectValue,bool);
00128
00129
00130 protected:
00131 SpatialObjectToImageFilter();
00132 ~SpatialObjectToImageFilter();
00133
00134 virtual void GenerateOutputInformation(){};
00135 virtual void GenerateData();
00136
00137
00138 SizeType m_Size;
00139 double m_Spacing[OutputImageDimension];
00140 double m_Origin[OutputImageDimension];
00141 unsigned int m_ChildrenDepth;
00142 ValueType m_InsideValue;
00143 ValueType m_OutsideValue;
00144 bool m_UseObjectValue;
00145
00146 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00147
00148 private:
00149 SpatialObjectToImageFilter(const Self&);
00150 void operator=(const Self&);
00151
00152
00153 };
00154
00155 }
00156
00157 #ifndef ITK_MANUAL_INSTANTIATION
00158 #include "itkSpatialObjectToImageFilter.txx"
00159 #endif
00160
00161 #endif