00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
00108
00115 virtual bool CanReadFile(const char* FileNameToRead) ;
00116
00118 virtual void ReadImageInformation();
00119
00121 virtual void Read(void* buffer);
00122
00123
00124
00131 virtual bool CanWriteFile(const char * FileNameToWrite);
00132
00134 virtual void WriteImageInformation();
00135
00138 virtual void Write(const void* buffer);
00139
00140
00141 protected:
00142 AnalyzeImageIO();
00143 ~AnalyzeImageIO();
00144 void PrintSelf(std::ostream& os, Indent indent) const;
00145 private:
00161 typedef enum {
00162 ITK_ANALYZE_ORIENTATION_RPI_TRANSVERSE=0,
00163 ITK_ANALYZE_ORIENTATION_RIP_CORONAL =1,
00164 ITK_ANALYZE_ORIENTATION_PIR_SAGITTAL =2,
00165 ITK_ANALYZE_ORIENTATION_RAI_TRANSVERSE_FLIPPED=3,
00166 ITK_ANALYZE_ORIENTATION_RSP_CORONAL_FLIPPED=4,
00167 ITK_ANALYZE_ORIENTATION_PIL_SAGITTAL_FLIPPED=5
00168 } ValidAnalyzeOrientationFlags;
00169
00170
00171 AnalyzeImageIO(const Self&);
00172 void operator=(const Self&);
00173 void SwapBytesIfNecessary(void * buffer, unsigned long numberOfPixels);
00180 void SwapHeaderBytesIfNecessary( struct dsr * const imageheader );
00181
00187 void DefineHeaderObjectDataType(void);
00188 #if defined(REORIENT_IMAGES)
00189 void ReorientIfNecessary(char *p);
00190 struct ipl_dimensions {
00191 unsigned int slicestride;
00192 unsigned int rowstride;
00193 unsigned int componentstride;
00194 unsigned int pixelsize;
00195
00196
00197 unsigned int xsize;
00198 unsigned int ysize;
00199 unsigned int zsize;
00200 };
00208 void GetAllDimensions(ipl_dimensions &dim);
00209 ipl_dimensions m_old_dim,m_new_dim;
00210 #endif
00211
00217 ImageIOBase::ByteOrder CheckAnalyzeEndian(const struct dsr &temphdr);
00219 struct dsr m_hdr;
00220 ImageIOBase::ByteOrder m_MachineByteOrder;
00221 };
00222 extern const char *const ANALYZE_ScanNumber;
00223 extern const char *const ANALYZE_O_MAX;
00224 extern const char *const ANALYZE_O_MIN;
00225 extern const char *const ANALYZE_S_MAX;
00226 extern const char *const ANALYZE_S_MIN;
00227 extern const char *const ANALYZE_CAL_MAX;
00228 extern const char *const ANALYZE_CAL_MIN;
00229 extern const char *const ANALYZE_GLMAX;
00230 extern const char *const ANALYZE_GLMIN;
00231 extern const char *const ANALYZE_AUX_FILE_NAME;
00232 extern const char *const ANALYZE_CALIBRATIONUNITS;
00233
00234 }
00235
00236 #endif // __itkAnalyzeImageIO_h