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
00044 typedef TOutputImage OutputImageType;
00045 typedef typename OutputImageType::SizeType SizeType;
00046 typedef typename OutputImageType::PointType PointType;
00047 typedef typename OutputImageType::Pointer OutputImagePointer;
00048 typedef typename OutputImageType::ValueType ValueType;
00049 typedef typename OutputImageType::SpacingType SpacingType;
00050 typedef typename OutputImageType::DirectionType DirectionType;
00051
00053 itkNewMacro(Self);
00054
00056 itkTypeMacro(SpatialObjectToImageFilter, ImageSource);
00057
00059 typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
00060
00062 typedef TInputSpatialObject InputSpatialObjectType;
00063 typedef typename InputSpatialObjectType::Pointer InputSpatialObjectPointer;
00064 typedef typename InputSpatialObjectType::ConstPointer InputSpatialObjectConstPointer;
00065 typedef typename TInputSpatialObject::ChildrenListType ChildrenListType;
00066
00068 itkStaticConstMacro(ObjectDimension, unsigned int,
00069 InputSpatialObjectType::ObjectDimension);
00070
00071 itkStaticConstMacro(OutputImageDimension, unsigned int,
00072 TOutputImage::ImageDimension);
00073
00075 virtual void SetInput( const InputSpatialObjectType *object);
00076 virtual void SetInput( unsigned int, const InputSpatialObjectType * object);
00077 const InputSpatialObjectType * GetInput( void );
00078 const InputSpatialObjectType * GetInput( unsigned int idx );
00080
00085 virtual void SetSpacing( const SpacingType& spacing);
00086 virtual void SetSpacing( const double* spacing);
00087 virtual void SetSpacing( const float* spacing);
00088 virtual const double * GetSpacing( void ) const;
00090
00093 virtual void SetDirection( const DirectionType & direction );
00094 virtual const DirectionType & GetDirection( void ) const;
00096
00103 itkSetMacro( InsideValue, ValueType );
00104 itkGetMacro( InsideValue, ValueType );
00106
00113 itkSetMacro( OutsideValue, ValueType );
00114 itkGetMacro( OutsideValue, ValueType );
00116
00121 virtual void SetOrigin( const PointType& origin );
00122 virtual void SetOrigin( const double* origin );
00123 virtual void SetOrigin( const float* origin );
00124 virtual const double * GetOrigin( void ) const;
00126
00131 itkSetMacro( ChildrenDepth, unsigned int );
00132 itkGetMacro( ChildrenDepth, unsigned int );
00134
00136 itkSetMacro( Size, SizeType );
00137 itkGetMacro( Size, SizeType );
00139
00142 itkSetMacro( UseObjectValue, bool );
00143 itkGetMacro( UseObjectValue, bool );
00145
00146 protected:
00147 SpatialObjectToImageFilter();
00148 ~SpatialObjectToImageFilter();
00149
00150 virtual void GenerateOutputInformation(){};
00151 virtual void GenerateData();
00152
00153 SizeType m_Size;
00154 double m_Spacing[OutputImageDimension];
00155 double m_Origin[OutputImageDimension];
00156 DirectionType m_Direction;
00157
00158 unsigned int m_ChildrenDepth;
00159 ValueType m_InsideValue;
00160 ValueType m_OutsideValue;
00161 bool m_UseObjectValue;
00162
00163 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00164
00165 private:
00166
00167 SpatialObjectToImageFilter(const Self&);
00168 void operator=(const Self&);
00169
00170 };
00171
00172 }
00173
00174 #ifndef ITK_MANUAL_INSTANTIATION
00175 #include "itkSpatialObjectToImageFilter.txx"
00176 #endif
00177
00178 #endif
00179