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

itkAnalyzeImageIO.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003 Program:   Insight Segmentation & Registration Toolkit
00004 Module:    $RCSfile: itkAnalyzeImageIO.h,v $
00005 Language:  C++
00006 Date:      $Date: 2003/02/14 04:02:55 $
00007 Version:   $Revision: 1.5 $
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 
00055 #ifndef __itkAnalyzeImageIO_h
00056 #define __itkAnalyzeImageIO_h
00057 
00058 #include <fstream>
00059 #include "itkImageIOBase.h"
00060 #include "dbh.h"
00061 
00062 namespace itk
00063 {
00068   class ITK_EXPORT AnalyzeImageIO : public ImageIOBase
00069   {
00070     public:
00072       typedef AnalyzeImageIO            Self;
00073       typedef ImageIOBase  Superclass;
00074       typedef SmartPointer<Self>  Pointer;
00075 
00077       itkNewMacro(Self);
00078 
00080       itkTypeMacro(AnalyzeImageIO, Superclass);
00081 
00082       /*-------- This part of the interfaces deals with reading data. ----- */
00083 
00090       virtual bool CanReadFile(const char* FileNameToRead) ;
00091 
00093       virtual void ReadImageInformation();
00094 
00096       virtual const std::type_info& GetPixelType() const;
00097 
00099       virtual void Read(void* buffer);
00100 
00104       virtual unsigned int GetComponentSize() const;
00105 
00106       /*-------- This part of the interfaces deals with writing data. ----- */
00107 
00114       virtual bool CanWriteFile(const char * FileNameToWrite);
00115 
00117       virtual void WriteImageInformation();
00118 
00121       virtual void Write(const void* buffer);
00122 
00123 
00124     protected:
00125       AnalyzeImageIO();
00126       ~AnalyzeImageIO();
00127       void PrintSelf(std::ostream& os, Indent indent) const;
00128     private:
00129       AnalyzeImageIO(const Self&); //purposely not implemented
00130       void operator=(const Self&); //purposely not implemented
00131       void SwapBytesIfNecessary(void * buffer, unsigned long numberOfPixels);
00138       void SwapHeaderBytesIfNecessary( struct dsr * const imageheader );
00139 
00145       void  DefineHeaderObjectDataType(void);
00146 //      void ReorientIfNecessary(char *p);
00147       struct ipl_dimensions {
00148         unsigned int slicestride;
00149         unsigned int rowstride;
00150         unsigned int componentstride;
00151         unsigned int pixelsize;
00152         //
00153         // xsize,ysize,zsize == size in each direction in pixesls
00154         unsigned int xsize;
00155         unsigned int ysize;
00156         unsigned int zsize;
00157       };
00165       void GetAllDimensions(ipl_dimensions &dim);
00166 
00173       ImageIOBase::ByteOrder CheckAnalyzeEndian(const struct dsr &temphdr);
00175       struct dsr m_hdr;
00176       ImageIOBase::ByteOrder m_MachineByteOrder;
00177       ipl_dimensions m_old_dim,m_new_dim;
00178   };
00179 
00180 } // end namespace itk
00181 
00182 #endif // __itkAnalyzeImageIO_h

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