Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkMINC2ImageIO.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkMINC2ImageIO.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008/01/27 12:53:07 $
00007   Version:   $Revision: 1.4 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
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 <netcdf.h>
00038 #include <hdf5.h>
00039 #include <minc2.h>
00040 
00041 }
00042 namespace itk
00043 {
00044 
00059 class ITK_EXPORT MINC2ImageIO : public ImageIOBase
00060 {
00061 public:
00063   typedef MINC2ImageIO            Self;
00064   typedef ImageIOBase             Superclass;
00065   typedef SmartPointer<Self>      Pointer;
00066   typedef Matrix<float,3,3>       MatrixType;
00067 
00069   itkNewMacro(Self);
00070 
00072   itkTypeMacro(MINC2ImageIO, ImageIOBase);
00073 
00074   /*-------- This part of the interface deals with reading data. ------ */
00075 
00078   virtual bool CanReadFile(const char*);
00079 
00081   virtual void ReadImageInformation();
00082 
00084   virtual void Read(void* buffer);
00085 
00087   virtual void ReadVolume(void* buffer);
00088 
00089   /*-------- This part of the interfaces deals with writing data. ----- */
00090 
00093   virtual bool CanWriteFile(const char*);
00094 
00097   virtual void WriteImageInformation();
00098 
00101   virtual void Write(const void* buffer);
00102 
00103   char *GetDimensionOrder() { return m_DimensionOrder; }
00104   void SetDimensionOrder(char *dimorder) { m_DimensionOrder = dimorder; }
00105 
00106   void XYZFromDirectionCosines(midimhandle_t *hdims, int *dim_indices, unsigned int *number_of_components);
00107 
00108 protected:
00109   MINC2ImageIO();
00110   ~MINC2ImageIO();
00111   void PrintSelf(std::ostream& os, Indent indent) const;
00112 
00113   void WriteSlice(std::string& fileName, const void* buffer);
00114 
00115   unsigned int m_NDims;
00116 
00117   char **m_DimensionName;
00118   virtual void SetDimensionName(unsigned int i, char *name);
00119   virtual char * GetDimensionName(unsigned int i){ return m_DimensionName[i]; }
00120 
00121   char *m_DimensionOrder;
00122   
00123   // shift and scale parameter (god help me with slice scaling!!)
00124   double m_Shift;
00125   double m_Scale;
00126 
00127   // dimension size and start and step
00128   unsigned int * m_DimensionSize;
00129   double       * m_DimensionStart;
00130   double       * m_DimensionStep;
00131   MatrixType     m_DirectionCosines;
00132 
00133   int * m_DimensionIndices;
00134 
00135   // Description:
00136   // Check the DimensionOrder and adjust according to what
00137   // dimensions the user has actually specified via
00138   // SetDimensionOrder()
00139   int CheckDimensionOrder(char *userdimorder);
00140 
00141   double m_OriginalStart[3];
00142   // complex type images, composed of complex numbers  
00143   int m_Complex;
00144 private:
00145   MINC2ImageIO(const Self&); //purposely not implemented
00146   void operator=(const Self&); //purposely not implemented
00147   // Description
00148   // Get slice scaling from local slice scaling
00149   void SetSliceScalingFromLocalScaling(mihandle_t volume);
00150     
00151   // Description
00152   // Get slice scaling from global slice scaling
00153   void SetSliceScalingFromGlobalScaling(mihandle_t volume);
00154 
00155 };
00156 
00157 } // end namespace itk
00158 
00159 #endif // __itkMINC2ImageIO_h
00160 

Generated at Tue Jul 29 21:16:33 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000