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 const std::type_info& GetPixelType() const;
00122
00124 virtual void Read(void* buffer);
00125
00129 virtual unsigned int GetComponentSize() const;
00130
00131
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:
00154 AnalyzeImageIO(const Self&);
00155 void operator=(const Self&);
00156 void SwapBytesIfNecessary(void * buffer, unsigned long numberOfPixels);
00163 void SwapHeaderBytesIfNecessary( struct dsr * const imageheader );
00164
00170 void DefineHeaderObjectDataType(void);
00171 #if defined(REORIENT_IMAGES)
00172 void ReorientIfNecessary(char *p);
00173 struct ipl_dimensions {
00174 unsigned int slicestride;
00175 unsigned int rowstride;
00176 unsigned int componentstride;
00177 unsigned int pixelsize;
00178
00179
00180 unsigned int xsize;
00181 unsigned int ysize;
00182 unsigned int zsize;
00183 };
00191 void GetAllDimensions(ipl_dimensions &dim);
00192 ipl_dimensions m_old_dim,m_new_dim;
00193 #endif
00194
00200 ImageIOBase::ByteOrder CheckAnalyzeEndian(const struct dsr &temphdr);
00202 struct dsr m_hdr;
00203 ImageIOBase::ByteOrder m_MachineByteOrder;
00204 };
00205 extern const char *const ANALYZE_ScanNumber;
00206 extern const char *const ANALYZE_O_MAX;
00207 extern const char *const ANALYZE_O_MIN;
00208 extern const char *const ANALYZE_S_MAX;
00209 extern const char *const ANALYZE_S_MIN;
00210 extern const char *const ANALYZE_CAL_MAX;
00211 extern const char *const ANALYZE_CAL_MIN;
00212 extern const char *const ANALYZE_GLMAX;
00213 extern const char *const ANALYZE_GLMIN;
00214 extern const char *const ANALYZE_AUX_FILE_NAME;
00215 extern const char *const ANALYZE_CALIBRATIONUNITS;
00216
00217 }
00218
00219 #endif // __itkAnalyzeImageIO_h