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

itkVoxBoCUBImageIO.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkVoxBoCUBImageIO.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-11-29 02:06:56 $
00007   Version:   $1.0$
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 =========================================================================*/
00017 #ifndef __itkVoxBoCUBImageIO_h
00018 #define __itkVoxBoCUBImageIO_h
00019 
00020 #ifdef _MSC_VER
00021 #pragma warning ( disable : 4786 )
00022 #endif
00023 
00024 #include <fstream>
00025 #include <string>
00026 #include <map>
00027 #include "itkImageIOBase.h"
00028 #include "itkSpatialOrientation.h"
00029 #include <stdio.h>
00030 
00031 namespace itk
00032 {
00033 
00034 // Forward declaration
00035 class GenericCUBFileAdaptor;
00036 
00052 class ITK_EXPORT VoxBoCUBImageIO : public ImageIOBase
00053 {
00054 public:
00056   typedef VoxBoCUBImageIO             Self;
00057   typedef ImageIOBase                 Superclass;
00058   typedef SmartPointer<Self>          Pointer;
00059 
00061   itkNewMacro(Self);
00062 
00064   itkTypeMacro(VoxBoCUBImageIO, Superclass);
00065 
00066   /*-------- This part of the interfaces deals with reading data. ----- */
00067 
00070   virtual bool CanReadFile(const char*);
00071 
00073   virtual void ReadImageInformation();
00074 
00076   virtual void Read(void* buffer);
00077 
00078   /*-------- This part of the interfaces deals with writing data. ----- */
00079 
00082   virtual bool CanWriteFile(const char*);
00083 
00085   virtual void WriteImageInformation();
00086 
00089   virtual void Write(const void* buffer);
00090 
00091 
00092   VoxBoCUBImageIO();
00093   ~VoxBoCUBImageIO();
00094   void PrintSelf(std::ostream& os, Indent indent) const;
00095 
00096 private:
00097   VoxBoCUBImageIO(const Self&); //purposely not implemented
00098   void operator=(const Self&); //purposely not implemented
00099 
00100   bool CheckExtension(const char*, bool &isCompressed);
00101   GenericCUBFileAdaptor *CreateReader(const char *filename);
00102   GenericCUBFileAdaptor *CreateWriter(const char *filename);
00103   GenericCUBFileAdaptor *m_Reader, *m_Writer;
00104 
00105   // Initialize the orientation map (from strings to ITK)
00106   void InitializeOrientationMap();
00107 
00108   // Orientation stuff
00109   typedef SpatialOrientation::ValidCoordinateOrientationFlags OrientationFlags;
00110   typedef std::map<std::string, OrientationFlags>             OrientationMap;
00111   typedef std::map<OrientationFlags, std::string>             InverseOrientationMap;
00112 
00113   OrientationMap            m_OrientationMap;
00114   InverseOrientationMap     m_InverseOrientationMap;
00115 
00116   // Method to swap bytes in read buffer
00117   void SwapBytesIfNecessary(void *buffer, BufferSizeType numberOfBytes);
00118 
00119   // Strings used in VoxBo files
00120   static const char * m_VB_IDENTIFIER_SYSTEM;
00121   static const char * m_VB_IDENTIFIER_FILETYPE;
00122   static const char * m_VB_DIMENSIONS;
00123   static const char * m_VB_SPACING;
00124   static const char * m_VB_ORIGIN;
00125   static const char * m_VB_DATATYPE;
00126   static const char * m_VB_BYTEORDER;
00127   static const char * m_VB_ORIENTATION;
00128   static const char * m_VB_BYTEORDER_MSB;
00129   static const char * m_VB_BYTEORDER_LSB;
00130   static const char * m_VB_DATATYPE_BYTE;
00131   static const char * m_VB_DATATYPE_INT;
00132   static const char * m_VB_DATATYPE_FLOAT;
00133   static const char * m_VB_DATATYPE_DOUBLE;
00134 };
00135 
00136 } // end namespace itk
00137 
00138 #endif // __itkVoxBoCUBImageIO_h
00139 

Generated at Mon Jul 12 2010 20:16:35 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000