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

itkImageFileReader.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkImageFileReader.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/09/11 19:57:14 $
00007   Version:   $Revision: 1.10 $
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 __itkImageFileReader_h
00018 #define __itkImageFileReader_h
00019 
00020 #include "itkImageIOBase.h"
00021 #include "itkImageSource.h"
00022 #include "itkExceptionObject.h"
00023 #include "itkSize.h"
00024 #include "itkImageRegion.h"
00025 #include "itkDefaultConvertPixelTraits.h"
00026 
00027 namespace itk
00028 {
00029 
00031 class ImageFileReaderException : public ExceptionObject 
00032 {
00033 public:
00035   itkTypeMacro( ImageFileReaderException, ExceptionObject );
00036 
00038   ImageFileReaderException(char *file, unsigned int line, 
00039                            const char* message = "Error in IO") : 
00040     ExceptionObject(file, line)
00041     {
00042       SetDescription(message);
00043     }
00044 
00046   ImageFileReaderException(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 
00073 template <class TOutputImage,
00074   class ConvertPixelTraits = 
00075 DefaultConvertPixelTraits< ITK_TYPENAME TOutputImage::PixelType> >
00076 class ITK_EXPORT ImageFileReader : public ImageSource<TOutputImage>
00077 {
00078 public:
00080   typedef ImageFileReader         Self;
00081   typedef ImageSource<TOutputImage>  Superclass;
00082   typedef SmartPointer<Self>  Pointer;
00083   
00085   itkNewMacro(Self);
00086 
00088   itkTypeMacro(ImageFileReader, ImageSource);
00089 
00091   typedef typename TOutputImage::SizeType  SizeType;
00092 
00094   typedef typename TOutputImage::RegionType  ImageRegionType;
00095 
00097   typedef typename TOutputImage::PixelType OutputImagePixelType;
00098   
00102   itkSetStringMacro(FileName);
00103   itkGetStringMacro(FileName);
00104   
00108   itkSetStringMacro(FilePrefix);
00109   itkGetStringMacro(FilePrefix);
00110   
00112   itkSetStringMacro(FilePattern);
00113   itkGetStringMacro(FilePattern);
00114   
00119   itkSetObjectMacro(ImageIO,ImageIOBase);
00120   itkGetObjectMacro(ImageIO,ImageIOBase);
00121   
00124   virtual void GenerateOutputInformation(void);
00125   
00126 protected:
00127   ImageFileReader();
00128   ~ImageFileReader();
00129   void PrintSelf(std::ostream& os, Indent indent) const;
00130   
00132   void DoConvertBuffer(void* buffer, unsigned long numberOfPixels);
00133 
00135   virtual void GenerateData();
00136 
00137   ImageIOBase::Pointer m_ImageIO;
00138   bool m_UserSpecified; //keep track whether the ImageIO is user specified
00139 
00140   std::string m_FileName;
00141   std::string m_FilePrefix;
00142   std::string m_FilePattern;
00143   
00144 private:
00145   ImageFileReader(const Self&); //purposely not implemented
00146   void operator=(const Self&); //purposely not implemented
00147   
00148 };
00149 
00150 
00151 } //namespace ITK
00152 
00153 #ifndef ITK_MANUAL_INSTANTIATION
00154 #include "itkImageFileReader.txx"
00155 #endif
00156 
00157 #endif // __itkImageFileReader_h

Generated at Wed Mar 12 01:13:00 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000