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

itkImageIO.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkImageIO.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/01/15 18:56:45 $
00007   Version:   $Revision: 1.19 $
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 __itkImageIO_h
00018 #define __itkImageIO_h
00019 
00020 #include "itkIntTypes.h"
00021 #include "itkProcessObject.h"
00022 #include "itkObjectFactory.h"
00023 #include "itkImageIOCommon.h"
00024 #include <string>
00025 #include "itkIndent.h"
00026 #include <deque>
00027 #include <ctype.h>
00028 
00029 namespace itk
00030 {
00031 
00032 class ITK_EXPORT ImageIO : public ProcessObject
00033 {
00034 public:
00036   typedef ImageIO            Self;
00037   typedef SmartPointer<Self>  Pointer;
00038   typedef ProcessObject  Superclass;
00039   
00041   itkTypeMacro(ImageIO, Superclass);
00042 
00045   virtual void ReadHeader(const std::string fileName="") = 0;
00046 
00048   virtual const double* GetOrigin() const =0;
00049 
00051   virtual const double* GetSpacing() const =0;
00052 
00054   typedef std::deque<std::string> FileExtensionsListType;
00055 
00060   virtual FileExtensionsListType& GetSupportedFileExtensions() const = 0;
00061 
00063   itkSetStringMacro(FileName);
00064   itkGetStringMacro(FileName);
00065   
00070   itkSetStringMacro(FilePrefix);
00071   itkGetStringMacro(FilePrefix);
00072   
00074   itkSetStringMacro(FilePattern);
00075   itkGetStringMacro(FilePattern);
00076   
00079   itkSetMacro(NumberOfComponents,unsigned int);
00080   itkGetConstMacro(NumberOfComponents,unsigned int);
00081     
00084   void* GetFileData();
00085 
00088   itkSetMacro(NumberOfDimensions, unsigned int);
00089   itkGetMacro(NumberOfDimensions, unsigned int);
00090   
00092   virtual unsigned int GetDimensions(unsigned int i) const;
00093 
00096   itkSetMacro(PixelType, AtomicPixelType);
00097   itkGetMacro(PixelType, AtomicPixelType);
00098   
00101   virtual unsigned int GetPixelStride () const;
00102 
00104   enum ByteOrder {LittleEndian, BigEndian};
00105 
00106 protected:
00107   ImageIO();
00108   ~ImageIO();
00109   void PrintSelf(std::ostream& os, Indent indent) const;
00110 
00112   bool m_Initialized;
00113 
00115   std::string m_FileName;
00116   std::string m_FilePrefix;
00117   std::string m_FilePattern;
00118   
00120   AtomicPixelType  m_PixelType;
00121 
00124   unsigned int m_NumberOfComponents;
00125 
00127   unsigned int m_NumberOfDimensions;
00128 
00130   unsigned int m_Dimensions[ITK_MAX_DIMENSIONS];
00131 
00134   unsigned int m_Strides[ITK_MAX_DIMENSIONS];
00135 
00137   void* m_FileData;
00138 
00140   virtual void Reset(const bool freeDynamic = true);
00141 
00143   void Resize(const unsigned int numDimensions, 
00144               const unsigned int* dimensions);
00145 
00152   void ComputeStrides();
00153 
00155   unsigned int ImageSizeInPixels() const;
00156 
00159   unsigned int ImageSizeInComponents() const;
00160 
00162   unsigned int ImageSizeInBytes() const;
00163 
00166   unsigned int GetComponentStride() const;
00167 
00170   unsigned int GetRowStride () const;
00171 
00174   unsigned int GetSliceStride () const;
00175 
00176 private:
00177   ImageIO(const Self&); //purposely not implemented
00178   void operator=(const Self&); //purposely not implemented
00179 
00180 
00181 };
00182 
00183 } // end namespace itk
00184 
00185 #endif // __itkImageIO_h

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