Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkImageFileWriter.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkImageFileWriter.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/08/19 13:20:42 $
00007   Version:   $Revision: 1.7 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkImageFileWriter_h
00018 #define __itkImageFileWriter_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 ImageFileWriterException : public ExceptionObject 
00031 {
00032 public:
00034   itkTypeMacro( ImageFileWriterException, ExceptionObject );
00035 
00037   ImageFileWriterException(char *file, unsigned int line, 
00038                            const char* message = "Error in IO") : 
00039     ExceptionObject(file, line)
00040     {
00041       SetDescription(message);
00042     }
00043 
00045   ImageFileWriterException(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 
00069 template <class TInputImage>
00070 class ITK_EXPORT ImageFileWriter : public ProcessObject
00071 {
00072 public:
00074   typedef ImageFileWriter              Self;
00075   typedef ProcessObject  Superclass;
00076   typedef SmartPointer<Self>  Pointer;
00077   typedef SmartPointer<const Self>  ConstPointer;
00078 
00080   itkNewMacro(Self);
00081 
00083   itkTypeMacro(ImageFileWriter,ProcessObject);
00084 
00086   typedef TInputImage InputImageType;
00087   typedef typename InputImageType::Pointer InputImagePointer;
00088   typedef typename InputImageType::RegionType InputImageRegionType; 
00089   typedef typename InputImageType::PixelType InputImagePixelType; 
00090   
00092   void SetInput(const InputImageType *input);
00093   const InputImageType * GetInput(void);
00094   const InputImageType * GetInput(unsigned int idx);
00095   
00097   itkSetStringMacro(FileName);
00098   itkGetStringMacro(FileName);
00099   
00103   itkSetStringMacro(FilePrefix);
00104   itkGetStringMacro(FilePrefix);
00105   
00107   itkSetStringMacro(FilePattern);
00108   itkGetStringMacro(FilePattern);
00109   
00114   itkSetObjectMacro(ImageIO,ImageIOBase);
00115   itkGetObjectMacro(ImageIO,ImageIOBase);
00116   
00125   virtual void Write();
00126   virtual void Write(const ImageIORegion& region);
00127 
00129   virtual void Update()
00130     {this->Write();}
00131   
00132 protected:
00133   ImageFileWriter();
00134   ~ImageFileWriter();
00135   void PrintSelf(std::ostream& os, Indent indent) const;
00136 
00137   void GenerateOutputInformation(void);
00138 
00140   void GenerateData(void);
00141   
00142 private:
00143   ImageFileWriter(const Self&); //purposely not implemented
00144   void operator=(const Self&); //purposely not implemented
00145 
00146   std::string        m_FileName;
00147   std::string        m_FilePrefix;
00148   std::string        m_FilePattern;
00149   
00150   ImageIOBase::Pointer m_ImageIO;
00151   bool m_UserSpecifiedImageIO; //track whether the ImageIO is user specified
00152   
00153   ImageIORegion *m_Region;
00154   bool m_UserSpecifiedRegion; //track whether the region is user specified
00155   
00156 };
00157 
00158   
00159 } // end namespace itk
00160   
00161 #ifndef ITK_MANUAL_INSTANTIATION
00162 #include "itkImageFileWriter.txx"
00163 #endif
00164 
00165 #endif // __itkImageFileWriter_h
00166   

Generated at Fri May 21 01:14:53 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000