itkVoxBoCUBImageIO.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkVoxBoCUBImageIO_h
00018 #define __itkVoxBoCUBImageIO_h
00019
00020 #ifdef _MSC_VER
00021 #pragma warning ( disable : 4786 )
00022 #endif
00023
00024 #include <fstream>
00025 #include <string>
00026 #include <map>
00027 #include "itkImageIOBase.h"
00028 #include "itkSpatialOrientation.h"
00029 #include <stdio.h>
00030
00031 namespace itk
00032 {
00033
00034
00035 class GenericCUBFileAdaptor;
00036
00052 class ITK_EXPORT VoxBoCUBImageIO : public ImageIOBase
00053 {
00054 public:
00056 typedef VoxBoCUBImageIO Self;
00057 typedef ImageIOBase Superclass;
00058 typedef SmartPointer<Self> Pointer;
00059
00061 itkNewMacro(Self);
00062
00064 itkTypeMacro(VoxBoCUBImageIO, Superclass);
00065
00066
00067
00070 virtual bool CanReadFile(const char*);
00071
00073 virtual void ReadImageInformation();
00074
00076 virtual void Read(void* buffer);
00077
00078
00079
00082 virtual bool CanWriteFile(const char*);
00083
00085 virtual void WriteImageInformation();
00086
00089 virtual void Write(const void* buffer);
00090
00091
00092 VoxBoCUBImageIO();
00093 ~VoxBoCUBImageIO();
00094 void PrintSelf(std::ostream& os, Indent indent) const;
00095
00096 private:
00097 VoxBoCUBImageIO(const Self&);
00098 void operator=(const Self&);
00099
00100 bool CheckExtension(const char*, bool &isCompressed);
00101 GenericCUBFileAdaptor *CreateReader(const char *filename);
00102 GenericCUBFileAdaptor *CreateWriter(const char *filename);
00103 GenericCUBFileAdaptor *m_Reader, *m_Writer;
00104
00105
00106 void InitializeOrientationMap();
00107
00108
00109 typedef SpatialOrientation::ValidCoordinateOrientationFlags OrientationFlags;
00110 typedef std::map<std::string, OrientationFlags> OrientationMap;
00111 typedef std::map<OrientationFlags, std::string> InverseOrientationMap;
00112
00113 OrientationMap m_OrientationMap;
00114 InverseOrientationMap m_InverseOrientationMap;
00115
00116
00117 void SwapBytesIfNecessary(void *buffer, unsigned long numberOfBytes);
00118
00119
00120 static const char * m_VB_IDENTIFIER_SYSTEM;
00121 static const char * m_VB_IDENTIFIER_FILETYPE;
00122 static const char * m_VB_DIMENSIONS;
00123 static const char * m_VB_SPACING;
00124 static const char * m_VB_ORIGIN;
00125 static const char * m_VB_DATATYPE;
00126 static const char * m_VB_BYTEORDER;
00127 static const char * m_VB_ORIENTATION;
00128 static const char * m_VB_BYTEORDER_MSB;
00129 static const char * m_VB_BYTEORDER_LSB;
00130 static const char * m_VB_DATATYPE_BYTE;
00131 static const char * m_VB_DATATYPE_INT;
00132 static const char * m_VB_DATATYPE_FLOAT;
00133 static const char * m_VB_DATATYPE_DOUBLE;
00134 };
00135
00136 }
00137
00138 #endif // __itkVoxBoCUBImageIO_h
00139