00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00025 #ifndef __itkMINC2ImageIO_h
00026 #define __itkMINC2ImageIO_h
00027
00028 #ifdef _MSC_VER
00029 #pragma warning ( disable : 4786 )
00030 #endif
00031
00032 #include "itkImageIOBase.h"
00033
00034 #include "itkMatrix.h"
00035
00036 extern "C" {
00037 #include <minc2.h>
00038 }
00039
00040 namespace itk
00041 {
00042
00057 class ITK_EXPORT MINC2ImageIO : public ImageIOBase
00058 {
00059 public:
00061 typedef MINC2ImageIO Self;
00062 typedef ImageIOBase Superclass;
00063 typedef SmartPointer<Self> Pointer;
00064 typedef Matrix<float,3,3> MatrixType;
00065
00067 itkNewMacro(Self);
00068
00070 itkTypeMacro(MINC2ImageIO, ImageIOBase);
00071
00072
00073
00076 virtual bool CanReadFile(const char*);
00077
00079 virtual void ReadImageInformation();
00080
00082 virtual void Read(void* buffer);
00083
00085 virtual void ReadVolume(void* buffer);
00086
00087
00088
00091 virtual bool CanWriteFile(const char*);
00092
00095 virtual void WriteImageInformation();
00096
00099 virtual void Write(const void* buffer);
00100
00101 char *GetDimensionOrder() { return m_DimensionOrder; }
00102 void SetDimensionOrder(char *dimorder) { m_DimensionOrder = dimorder; }
00103
00104 void XYZFromDirectionCosines(midimhandle_t *hdims, int *dim_indices, unsigned int *number_of_components);
00105
00106 protected:
00107 MINC2ImageIO();
00108 ~MINC2ImageIO();
00109 void PrintSelf(std::ostream& os, Indent indent) const;
00110
00111 void WriteSlice(std::string& fileName, const void* buffer);
00112
00113 unsigned int m_NDims;
00114
00115 char **m_DimensionName;
00116 virtual void SetDimensionName(unsigned int i, char *name);
00117 virtual char * GetDimensionName(unsigned int i){ return m_DimensionName[i]; }
00118
00119 char *m_DimensionOrder;
00120
00121
00122 double m_Shift;
00123 double m_Scale;
00124
00125
00126 unsigned int * m_DimensionSize;
00127 double * m_DimensionStart;
00128 double * m_DimensionStep;
00129 MatrixType m_DirectionCosines;
00130
00131 int * m_DimensionIndices;
00132
00133
00134
00135
00136
00137 int CheckDimensionOrder(char *userdimorder);
00138
00139 double m_OriginalStart[3];
00140
00141 int m_Complex;
00142 private:
00143 MINC2ImageIO(const Self&);
00144 void operator=(const Self&);
00145
00146
00147 void SetSliceScalingFromLocalScaling(mihandle_t volume);
00148
00149
00150
00151 void SetSliceScalingFromGlobalScaling(mihandle_t volume);
00152
00153 };
00154
00155 }
00156
00157 #endif // __itkMINC2ImageIO_h
00158