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

Generated at Tue Sep 15 03:57:58 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000