Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkImportImageFilter_h
00018 #define __itkImportImageFilter_h
00019
00020 #include "itkImageSource.h"
00021
00022 namespace itk
00023 {
00024
00037 template <typename TPixel, unsigned int VImageDimension=2>
00038 class ITK_EXPORT ImportImageFilter:
00039 public ImageSource< Image<TPixel,VImageDimension> >
00040 {
00041 public:
00043 typedef Image<TPixel,VImageDimension> OutputImageType;
00044 typedef typename OutputImageType::Pointer OutputImagePointer;
00045 typedef typename OutputImageType::SpacingType SpacingType;
00046 typedef typename OutputImageType::PointType OriginType;
00047
00048
00050 typedef ImportImageFilter Self;
00051 typedef ImageSource<OutputImageType> Superclass;
00052 typedef SmartPointer<Self> Pointer;
00053 typedef SmartPointer<const Self> ConstPointer;
00054
00056 itkNewMacro(Self);
00057
00059 itkTypeMacro(ImportImageFilter,ImageSource);
00060
00062 typedef Index<VImageDimension> IndexType;
00063
00065 typedef Size<VImageDimension> SizeType;
00066
00069 typedef ImageRegion<VImageDimension> RegionType;
00070
00072 typedef TPixel OutputImagePixelType;
00073
00075 TPixel *GetImportPointer();
00076
00084 void SetImportPointer(TPixel *ptr, unsigned long num,
00085 bool LetFilterManageMemory);
00086
00091 void SetRegion(const RegionType ®ion)
00092 { if (m_Region != region) {m_Region = region; this->Modified();} };
00093
00098 const RegionType& GetRegion() const
00099 { return m_Region;}
00100
00103 itkSetVectorMacro(Spacing, const double, VImageDimension);
00104 itkSetVectorMacro(Spacing, const float, VImageDimension);
00106
00109 itkGetVectorMacro(Spacing, const double, VImageDimension);
00110 void SetSpacing( const SpacingType & spacing );
00112
00115 itkSetVectorMacro(Origin, const double, VImageDimension);
00116 itkSetVectorMacro(Origin, const float, VImageDimension);
00117 void SetOrigin( const OriginType & origin );
00119
00122 itkGetVectorMacro(Origin, const double, VImageDimension);
00123
00124 typedef Matrix<double, VImageDimension, VImageDimension> DirectionType;
00125
00128 virtual void SetDirection( const DirectionType direction );
00129
00132 itkGetConstReferenceMacro(Direction, DirectionType);
00133
00134 protected:
00135 ImportImageFilter();
00136 ~ImportImageFilter();
00137 void PrintSelf(std::ostream& os, Indent indent) const;
00138
00141 virtual void GenerateData();
00142
00146 virtual void GenerateOutputInformation();
00147
00155 virtual void EnlargeOutputRequestedRegion(DataObject *output);
00156
00157 private:
00158 ImportImageFilter(const ImportImageFilter &);
00159 void operator=(const ImportImageFilter&);
00160
00161 RegionType m_Region;
00162 double m_Spacing[VImageDimension];
00163 double m_Origin[VImageDimension];
00164 DirectionType m_Direction;
00165
00166 TPixel* m_ImportPointer;
00167 bool m_FilterManageMemory;
00168 unsigned long m_Size;
00169 };
00170
00171 }
00172
00173 #ifndef ITK_MANUAL_INSTANTIATION
00174 #include "itkImportImageFilter.txx"
00175 #endif
00176
00177 #endif
00178