00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkImageSeriesWriter_h
00018 #define __itkImageSeriesWriter_h
00019
00020 #include "itkProcessObject.h"
00021 #include "itkImageIOBase.h"
00022 #include "itkFileIteratorBase.h"
00023 #include "itkExceptionObject.h"
00024 #include "itkSize.h"
00025 #include "itkImageRegion.h"
00026
00027 namespace itk
00028 {
00029
00031 class ImageSeriesWriterException : public ExceptionObject
00032 {
00033 public:
00035 itkTypeMacro( ImageSeriesWriterException, ExceptionObject );
00036
00038 ImageSeriesWriterException(char *file, unsigned int line,
00039 const char* message = "Error in IO") :
00040 ExceptionObject(file, line)
00041 {
00042 SetDescription(message);
00043 }
00044
00046 ImageSeriesWriterException(const std::string &file, unsigned int line,
00047 const char* message = "Error in IO") :
00048 ExceptionObject(file, line)
00049 {
00050 SetDescription(message);
00051 }
00052 };
00053
00054
00085 template <class TInputImage>
00086 class ITK_EXPORT ImageSeriesWriter : public ProcessObject
00087 {
00088 public:
00090 typedef ImageSeriesWriter Self;
00091 typedef ProcessObject Superclass;
00092 typedef SmartPointer<Self> Pointer;
00093 typedef SmartPointer<const Self> ConstPointer;
00094
00096 itkNewMacro(Self);
00097
00099 itkTypeMacro(ImageSeriesWriter,ProcessObject);
00100
00102 typedef TInputImage InputImageType;
00103 typedef typename InputImageType::Pointer InputImagePointer;
00104 typedef typename InputImageType::RegionType InputImageRegionType;
00105 typedef typename InputImageType::PixelType InputImagePixelType;
00106
00108 void SetInput(const InputImageType *input);
00109 const InputImageType *GetInput(void);
00110 const InputImageType *GetInput(unsigned int idx);
00111
00114 itkSetObjectMacro(FileIterator,FileIteratorBase);
00115 itkGetObjectMacro(FileIterator,FileIteratorBase);
00116
00123 itkSetObjectMacro(ImageIO,ImageIOBase);
00124 itkGetObjectMacro(ImageIO,ImageIOBase);
00125
00133 virtual void Write(void);
00134
00137 virtual void Update()
00138 {this->Write();}
00139
00140 protected:
00141 ImageSeriesWriter();
00142 ~ImageSeriesWriter();
00143 void PrintSelf(std::ostream& os, Indent indent) const;
00144
00146 void GenerateData(void);
00147
00149 FileIteratorBase::Pointer m_FileIterator;
00150
00151 ImageIOBase::Pointer m_ImageIO;
00152 bool m_UserSpecifiedImageIO;
00153
00154 ImageIORegion m_IORegion;
00155 bool m_UserSpecifiedIORegion;
00156
00161 void SetIORegion(const ImageIORegion & region);
00162 const ImageIORegion & GetIORegion() const;
00163
00164 private:
00165 ImageSeriesWriter(const Self&);
00166 void operator=(const Self&);
00167
00168 };
00169
00170
00171 }
00172
00173 #ifndef ITK_MANUAL_INSTANTIATION
00174 #include "itkImageSeriesWriter.txx"
00175 #endif
00176
00177 #endif // __itkImageSeriesWriter_h
00178