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 "itkExceptionObject.h"
00023 #include "itkSize.h"
00024 #include "itkImageRegion.h"
00025
00026 namespace itk
00027 {
00028
00030 class ImageSeriesWriterException : public ExceptionObject
00031 {
00032 public:
00034 itkTypeMacro( ImageSeriesWriterException, ExceptionObject );
00035
00037 ImageSeriesWriterException(char *file, unsigned int line,
00038 const char* message = "Error in IO") :
00039 ExceptionObject(file, line)
00040 {
00041 SetDescription(message);
00042 }
00043
00045 ImageSeriesWriterException(const std::string &file, unsigned int line,
00046 const char* message = "Error in IO") :
00047 ExceptionObject(file, line)
00048 {
00049 SetDescription(message);
00050 }
00051 };
00052
00053
00075 template <class TInputImage, class TOutputImage>
00076 class ITK_EXPORT ImageSeriesWriter : public ProcessObject
00077 {
00078 public:
00080 typedef ImageSeriesWriter Self;
00081 typedef ProcessObject Superclass;
00082 typedef SmartPointer<Self> Pointer;
00083 typedef SmartPointer<const Self> ConstPointer;
00084
00086 itkNewMacro(Self);
00087
00089 itkTypeMacro(ImageSeriesWriter,ProcessObject);
00090
00092 typedef TInputImage InputImageType;
00093 typedef typename InputImageType::RegionType InputImageRegionType;
00094 typedef TOutputImage OutputImageType;
00095 typedef typename OutputImageType::RegionType OutputImageRegionType;
00096
00098 void SetInput(const InputImageType *input);
00099 const InputImageType *GetInput(void);
00100 const InputImageType *GetInput(unsigned int idx);
00101
00108 itkSetObjectMacro(ImageIO,ImageIOBase);
00109 itkGetObjectMacro(ImageIO,ImageIOBase);
00110
00115 virtual void Write(void);
00116
00119 virtual void Update()
00120 {
00121 this->Write();
00122 }
00123
00126 itkSetMacro(StartIndex,unsigned long);
00127 itkGetMacro(StartIndex,unsigned long);
00128
00131 itkSetMacro(IncrementIndex,unsigned long);
00132 itkGetMacro(IncrementIndex,unsigned long);
00133
00138 itkSetStringMacro(SeriesFormat);
00139 itkGetStringMacro(SeriesFormat);
00140
00141 protected:
00142 ImageSeriesWriter();
00143 ~ImageSeriesWriter();
00144 void PrintSelf(std::ostream& os, Indent indent) const;
00145
00147 void GenerateData(void);
00148
00149 ImageIOBase::Pointer m_ImageIO;
00150 bool m_UserSpecifiedImageIO;
00151
00152 private:
00153 ImageSeriesWriter(const Self&);
00154 void operator=(const Self&);
00155
00156 std::string m_SeriesFormat;
00157 unsigned long m_StartIndex;
00158 unsigned long m_IncrementIndex;
00159 };
00160
00161
00162 }
00163
00164 #ifndef ITK_MANUAL_INSTANTIATION
00165 #include "itkImageSeriesWriter.txx"
00166 #endif
00167
00168 #endif // __itkImageSeriesWriter_h
00169