Go to the documentation of this file.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
00084
00085
00088 virtual bool CanWriteFile(const char*);
00089
00092 virtual void WriteImageInformation();
00093
00096 virtual void Write(const void* buffer);
00097
00098 char *GetDimensionOrder() { return m_DimensionOrder; }
00099 void SetDimensionOrder(char *dimorder) { m_DimensionOrder = dimorder; }
00100
00101 void XYZFromDirectionCosines(midimhandle_t *hdims, int *dim_indices, unsigned int *number_of_components);
00102
00103 protected:
00104 MINC2ImageIO();
00105 ~MINC2ImageIO();
00106 void PrintSelf(std::ostream& os, Indent indent) const;
00107
00108 void WriteSlice(std::string& fileName, const void* buffer);
00109
00110
00111 unsigned int m_NDims;
00112
00113 char **m_DimensionName;
00114 virtual void SetDimensionName(unsigned int i, char *name);
00115 virtual char * GetDimensionName(unsigned int i){ return m_DimensionName[i]; }
00116
00117 char *m_DimensionOrder;
00118
00119
00120 double m_Shift;
00121 double m_Scale;
00122
00123
00124 unsigned int * m_DimensionSize;
00125 double * m_DimensionStart;
00126 double * m_DimensionStep;
00127 MatrixType m_DirectionCosines;
00128
00129 int * m_DimensionIndices;
00130
00131
00132
00133
00134
00135 int CheckDimensionOrder(char *userdimorder);
00136
00137 double m_OriginalStart[3];
00138
00139 int m_Complex;
00140 private:
00141 MINC2ImageIO(const Self&);
00142 void operator=(const Self&);
00143
00144
00145
00146 void SetSliceScalingFromLocalScaling(mihandle_t volume);
00147
00148
00149
00150 void SetSliceScalingFromGlobalScaling(mihandle_t volume);
00151
00152 };
00153
00154 }
00155
00156 #endif // __itkMINC2ImageIO_h
00157