00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
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
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&);
00130 void operator=(const Self&);
00131 void SwapBytesIfNecessary(void * buffer, unsigned long numberOfPixels);
00138 void SwapHeaderBytesIfNecessary( struct dsr * const imageheader );
00139
00145 void DefineHeaderObjectDataType(void);
00146
00147 struct ipl_dimensions {
00148 unsigned int slicestride;
00149 unsigned int rowstride;
00150 unsigned int componentstride;
00151 unsigned int pixelsize;
00152
00153
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 }
00181
00182 #endif // __itkAnalyzeImageIO_h