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 #include "itkImage.h"
00022
00023 namespace itk
00024 {
00025
00038 template <typename TPixel, unsigned int VImageDimension=2>
00039 class ITK_EXPORT ImportImageFilter:
00040 public ImageSource< Image<TPixel,VImageDimension> >
00041 {
00042 public:
00044 typedef Image<TPixel,VImageDimension> OutputImageType;
00045 typedef typename OutputImageType::Pointer OutputImagePointer;
00046
00048 typedef ImportImageFilter Self;
00049 typedef ImageSource<OutputImageType> Superclass;
00050 typedef SmartPointer<Self> Pointer;
00051 typedef SmartPointer<const Self> ConstPointer;
00052
00054 itkNewMacro(Self);
00055
00057 itkTypeMacro(ImportImageFilter,ImageSource);
00058
00060 typedef Index<VImageDimension> IndexType;
00061
00063 typedef Size<VImageDimension> SizeType;
00064
00067 typedef ImageRegion<VImageDimension> RegionType;
00068
00070 typedef TPixel OutputImagePixelType;
00071
00073 TPixel *GetImportPointer();
00074
00082 void SetImportPointer(TPixel *ptr, unsigned long num,
00083 bool LetFilterManageMemory);
00084
00089 void SetRegion(const RegionType ®ion)
00090 { if (m_Region != region) {m_Region = region; this->Modified();} };
00091
00096 const RegionType& GetRegion() const
00097 { return m_Region;};
00098
00101 itkSetVectorMacro(Spacing, const double, VImageDimension);
00102 itkSetVectorMacro(Spacing, const float, VImageDimension);
00103
00106 itkGetVectorMacro(Spacing, const double, VImageDimension);
00107
00110 itkSetVectorMacro(Origin, const double, VImageDimension);
00111 itkSetVectorMacro(Origin, const float, VImageDimension);
00112
00115 itkGetVectorMacro(Origin, const double, VImageDimension);
00116
00117 protected:
00118 ImportImageFilter();
00119 ~ImportImageFilter();
00120 void PrintSelf(std::ostream& os, Indent indent) const;
00121
00124 virtual void GenerateData();
00125
00129 virtual void GenerateOutputInformation();
00130
00138 virtual void EnlargeOutputRequestedRegion(DataObject *output);
00139
00140 private:
00141 ImportImageFilter(const ImportImageFilter &);
00142 void operator=(const ImportImageFilter&);
00143
00144 RegionType m_Region;
00145 double m_Spacing[VImageDimension];
00146 double m_Origin[VImageDimension];
00147
00148 TPixel* m_ImportPointer;
00149 bool m_FilterManageMemory;
00150 unsigned long m_Size;
00151 };
00152
00153 }
00154
00155 #ifndef ITK_MANUAL_INSTANTIATION
00156 #include "itkImportImageFilter.txx"
00157 #endif
00158
00159 #endif
00160
00161
00162
00163