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: 2004/01/08 00:39:02 $
00007 Version:   $Revision: 1.14 $
00008 
00009 Copyright (c) Insight Software 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 
00029 #ifndef __itkAnalyzeImageIO_h
00030 #define __itkAnalyzeImageIO_h
00031 
00032 #ifdef _MSC_VER
00033 #pragma warning ( disable : 4786 )
00034 #endif
00035 
00036 #include <fstream>
00037 #include "itkImageIOBase.h"
00038 #include "itkAnalyzeDbh.h"
00039 
00040 namespace itk
00041 {
00093 class ITK_EXPORT AnalyzeImageIO : public ImageIOBase
00094 {
00095 public:
00097   typedef AnalyzeImageIO            Self;
00098   typedef ImageIOBase  Superclass;
00099   typedef SmartPointer<Self>  Pointer;
00100 
00102   itkNewMacro(Self);
00103 
00105   itkTypeMacro(AnalyzeImageIO, Superclass);
00106 
00107   /*-------- This part of the interfaces deals with reading data. ----- */
00108 
00115   virtual bool CanReadFile(const char* FileNameToRead) ;
00116 
00118   virtual void ReadImageInformation();
00119 
00121   virtual const std::type_info& GetPixelType() const;
00122 
00124   virtual void Read(void* buffer);
00125 
00129   virtual unsigned int GetComponentSize() const;
00130 
00131   /*-------- This part of the interfaces deals with writing data. ----- */
00132 
00139   virtual bool CanWriteFile(const char * FileNameToWrite);
00140 
00142   virtual void WriteImageInformation();
00143 
00146   virtual void Write(const void* buffer);
00147 
00148 
00149 protected:
00150   AnalyzeImageIO();
00151   ~AnalyzeImageIO();
00152   void PrintSelf(std::ostream& os, Indent indent) const;
00153 private:
00169   typedef enum {
00170     ITK_ANALYZE_ORIENTATION_RPS_TRANSVERSE=0,        
00171     ITK_ANALYZE_ORIENTATION_RIP_CORONAL   =1,        
00172     ITK_ANALYZE_ORIENTATION_AIR_SAGITTAL  =2,        
00173     ITK_ANALYZE_ORIENTATION_RAI_TRANSVERSE_FLIPPED=3,
00174     ITK_ANALYZE_ORIENTATION_RSP_CORONAL_FLIPPED=4,   
00175     ITK_ANALYZE_ORIENTATION_PIL_SAGITTAL_FLIPPED=5   
00176   } ValidAnalyzeOrientationFlags;
00177 
00178 
00179   AnalyzeImageIO(const Self&); //purposely not implemented
00180   void operator=(const Self&); //purposely not implemented
00181   void SwapBytesIfNecessary(void * buffer, unsigned long numberOfPixels);
00188   void SwapHeaderBytesIfNecessary( struct dsr * const imageheader );
00189 
00195   void  DefineHeaderObjectDataType(void);
00196 #if defined(REORIENT_IMAGES)
00197   void ReorientIfNecessary(char *p);
00198   struct ipl_dimensions {
00199     unsigned int slicestride;
00200     unsigned int rowstride;
00201     unsigned int componentstride;
00202     unsigned int pixelsize;
00203     //
00204     // xsize,ysize,zsize == size in each direction in pixesls
00205     unsigned int xsize;
00206     unsigned int ysize;
00207     unsigned int zsize;
00208   };
00216   void GetAllDimensions(ipl_dimensions &dim);
00217   ipl_dimensions m_old_dim,m_new_dim;
00218 #endif
00219 
00225   ImageIOBase::ByteOrder CheckAnalyzeEndian(const struct dsr &temphdr);
00227   struct dsr m_hdr;
00228   ImageIOBase::ByteOrder m_MachineByteOrder;
00229 };
00230 extern const char *const ANALYZE_ScanNumber;
00231 extern const char *const ANALYZE_O_MAX;
00232 extern const char *const ANALYZE_O_MIN;
00233 extern const char *const ANALYZE_S_MAX;
00234 extern const char *const ANALYZE_S_MIN;
00235 extern const char *const ANALYZE_CAL_MAX;
00236 extern const char *const ANALYZE_CAL_MIN;
00237 extern const char *const ANALYZE_GLMAX;
00238 extern const char *const ANALYZE_GLMIN;
00239 extern const char *const ANALYZE_AUX_FILE_NAME;
00240 extern const char *const ANALYZE_CALIBRATIONUNITS;
00241 
00242 } // end namespace itk
00243 
00244 #endif // __itkAnalyzeImageIO_h

Generated at Sun Jan 25 13:19:28 2004 for ITK by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-2000