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: 2003/03/18 03:28:25 $
00007   Version:   $Revision: 1.13.2.1 $
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 
00076 template <class TOutputImage,
00077   class ConvertPixelTraits = 
00078 DefaultConvertPixelTraits< ITK_TYPENAME TOutputImage::PixelType> >
00079 class ITK_EXPORT ImageFileReader : public ImageSource<TOutputImage>
00080 {
00081 public:
00083   typedef ImageFileReader         Self;
00084   typedef ImageSource<TOutputImage>  Superclass;
00085   typedef SmartPointer<Self>  Pointer;
00086   
00088   itkNewMacro(Self);
00089 
00091   itkTypeMacro(ImageFileReader, ImageSource);
00092 
00094   typedef typename TOutputImage::SizeType  SizeType;
00095 
00097   typedef typename TOutputImage::RegionType  ImageRegionType;
00098 
00100   typedef typename TOutputImage::PixelType OutputImagePixelType;
00101   
00105   itkSetStringMacro(FileName);
00106   itkGetStringMacro(FileName);
00107   
00111   itkSetStringMacro(FilePrefix);
00112   itkGetStringMacro(FilePrefix);
00113   
00115   itkSetStringMacro(FilePattern);
00116   itkGetStringMacro(FilePattern);
00117   
00122   void  SetImageIO( ImageIOBase * imageIO );
00123   itkGetObjectMacro(ImageIO,ImageIOBase);
00124   
00127   virtual void GenerateOutputInformation(void);
00128 
00134   virtual void EnlargeOutputRequestedRegion(DataObject *output);
00135 
00136   
00137 protected:
00138   ImageFileReader();
00139   ~ImageFileReader();
00140   void PrintSelf(std::ostream& os, Indent indent) const;
00141   
00143   void DoConvertBuffer(void* buffer, unsigned long numberOfPixels);
00144 
00146   virtual void GenerateData();
00147 
00148   ImageIOBase::Pointer m_ImageIO;
00149   bool m_UserSpecifiedImageIO; //keep track whether the ImageIO is user specified
00150 
00151   std::string m_FileName;
00152   std::string m_FilePrefix;
00153   std::string m_FilePattern;
00154   
00155 private:
00156   ImageFileReader(const Self&); //purposely not implemented
00157   void operator=(const Self&); //purposely not implemented
00158   
00159 };
00160 
00161 
00162 } //namespace ITK
00163 
00164 #ifndef ITK_MANUAL_INSTANTIATION
00165 #include "itkImageFileReader.txx"
00166 #endif
00167 
00168 #endif // __itkImageFileReader_h

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