ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00025 #ifndef __itkMINC2ImageIO_h 00026 #define __itkMINC2ImageIO_h 00027 00028 00029 #include "itkImageIOBase.h" 00030 00031 #include "itkMatrix.h" 00032 00033 extern "C" { 00034 #include <minc2.h> 00035 } 00036 00037 namespace itk 00038 { 00061 class ITK_EXPORT MINC2ImageIO:public ImageIOBase 00062 { 00063 public: 00065 typedef MINC2ImageIO Self; 00066 typedef ImageIOBase Superclass; 00067 typedef SmartPointer< Self > Pointer; 00068 typedef Matrix< float, 3, 3 > MatrixType; 00069 00071 itkNewMacro(Self); 00072 00074 itkTypeMacro(MINC2ImageIO, ImageIOBase); 00075 00076 /*-------- This part of the interface deals with reading data. ------ */ 00077 00080 virtual bool CanReadFile(const char *); 00081 00083 virtual void ReadImageInformation(); 00084 00086 virtual void Read(void *buffer); 00087 00088 /*-------- This part of the interfaces deals with writing data. ----- */ 00089 00092 virtual bool CanWriteFile(const char *); 00093 00096 virtual void WriteImageInformation(); 00097 00100 virtual void Write(const void *buffer); 00101 00102 char * GetDimensionOrder() { return m_DimensionOrder; } 00103 void SetDimensionOrder(char *dimorder) { m_DimensionOrder = dimorder; } 00104 00105 void XYZFromDirectionCosines(midimhandle_t *hdims, int *dim_indices, unsigned int *number_of_components); 00106 00107 protected: 00108 MINC2ImageIO(); 00109 ~MINC2ImageIO(); 00110 void PrintSelf(std::ostream & os, Indent indent) const; 00111 00112 void WriteSlice(std::string & fileName, const void *buffer); 00113 00114 // Num. dimensions in base class (c.f. GetNumberOfDimensions); why keep a 00115 // second copy here? 00116 unsigned int m_NDims; 00117 00118 char **m_DimensionName; 00119 virtual void SetDimensionName(unsigned int i, char *name); 00120 00121 virtual char * GetDimensionName(unsigned int i){ return m_DimensionName[i]; } 00122 00123 char *m_DimensionOrder; 00124 00125 // shift and scale parameter (god help me with slice scaling!!) 00126 double m_Shift; 00127 double m_Scale; 00128 00129 // dimension size and start and step 00130 unsigned int *m_DimensionSize; 00131 double *m_DimensionStart; 00132 double *m_DimensionStep; 00133 00134 MatrixType m_DirectionCosines; 00135 00136 int *m_DimensionIndices; 00137 00138 // Description: 00139 // Check the DimensionOrder and adjust according to what 00140 // dimensions the user has actually specified via 00141 // SetDimensionOrder() 00142 int CheckDimensionOrder(char *userdimorder); 00143 00144 double m_OriginalStart[3]; 00145 // complex type images, composed of complex numbers 00146 int m_Complex; 00147 private: 00148 MINC2ImageIO(const Self &); //purposely not implemented 00149 void operator=(const Self &); //purposely not implemented 00150 00151 // Description 00152 // Get slice scaling from local slice scaling 00153 void SetSliceScalingFromLocalScaling(mihandle_t volume); 00154 00155 // Description 00156 // Get slice scaling from global slice scaling 00157 void SetSliceScalingFromGlobalScaling(mihandle_t volume); 00158 }; 00159 } // end namespace itk 00160 00161 #endif // __itkMINC2ImageIO_h 00162