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-10-27 03:11:46 $
00007   Version:   $Revision: 1.5 $
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 <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   /*-------- This part of the interface deals with reading data. ------ */
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   /*-------- This part of the interfaces deals with writing data. ----- */
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   // shift and scale parameter (god help me with slice scaling!!)
00122   double m_Shift;
00123   double m_Scale;
00124 
00125   // dimension size and start and step
00126   unsigned int * m_DimensionSize;
00127   double       * m_DimensionStart;
00128   double       * m_DimensionStep;
00129   MatrixType     m_DirectionCosines;
00130 
00131   int * m_DimensionIndices;
00132 
00133   // Description:
00134   // Check the DimensionOrder and adjust according to what
00135   // dimensions the user has actually specified via
00136   // SetDimensionOrder()
00137   int CheckDimensionOrder(char *userdimorder);
00138 
00139   double m_OriginalStart[3];
00140   // complex type images, composed of complex numbers  
00141   int m_Complex;
00142 private:
00143   MINC2ImageIO(const Self&); //purposely not implemented
00144   void operator=(const Self&); //purposely not implemented
00145   // Description
00146   // Get slice scaling from local slice scaling
00147   void SetSliceScalingFromLocalScaling(mihandle_t volume);
00148     
00149   // Description
00150   // Get slice scaling from global slice scaling
00151   void SetSliceScalingFromGlobalScaling(mihandle_t volume);
00152 
00153 };
00154 
00155 } // end namespace itk
00156 
00157 #endif // __itkMINC2ImageIO_h
00158 

Generated at Wed Nov 5 22:53:08 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000