00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00025 #ifndef __itkNiftiImageIO_h
00026 #define __itkNiftiImageIO_h
00027
00028 #ifdef _MSC_VER
00029 #pragma warning ( disable : 4786 )
00030 #endif
00031
00032 #include <fstream>
00033 #include "itkImageIOBase.h"
00034 #include <nifti1_io.h>
00035
00036 namespace itk
00037 {
00038
00047 class ITK_EXPORT NiftiImageIO : public ImageIOBase
00048 {
00049 public:
00051 typedef NiftiImageIO Self;
00052 typedef ImageIOBase Superclass;
00053 typedef SmartPointer<Self> Pointer;
00054
00056 itkNewMacro(Self);
00057
00059 itkTypeMacro(NiftiImageIO, Superclass);
00060
00061
00062
00069 virtual bool CanReadFile(const char* FileNameToRead);
00070
00072 virtual void ReadImageInformation();
00073
00075 virtual void Read(void* buffer);
00076
00077
00078
00085 virtual bool CanWriteFile(const char * FileNameToWrite);
00086
00088 virtual void WriteImageInformation();
00089
00092 virtual void Write(const void* buffer);
00093
00096 virtual ImageIORegion
00097 GenerateStreamableReadRegionFromRequestedRegion( const ImageIORegion & requestedRegion ) const;
00098
00104 itkSetMacro(LegacyAnalyze75Mode,bool);
00105 itkGetMacro(LegacyAnalyze75Mode,bool);
00107
00108 protected:
00109 NiftiImageIO();
00110 ~NiftiImageIO();
00111 void PrintSelf(std::ostream& os, Indent indent) const;
00112 virtual bool GetUseLegacyModeForTwoFileWriting(void) const { return false; }
00113 private:
00114 bool MustRescale();
00115 void DefineHeaderObjectDataType();
00116 void SetNIfTIOrientationFromImageIO(unsigned short int origdims, unsigned short int dims);
00117 void SetImageIOOrientationFromNIfTI(unsigned short int dims);
00118
00119 nifti_image * m_NiftiImage;
00120 double m_RescaleSlope;
00121 double m_RescaleIntercept;
00122 IOComponentType m_OnDiskComponentType;
00123 bool m_LegacyAnalyze75Mode;
00124
00125 NiftiImageIO(const Self&);
00126 void operator=(const Self&);
00127 };
00128
00129 }
00130
00131 #endif // __itkNiftiImageIO_h
00132