00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkVTKImageIO2.h,v $ 00005 Language: C++ 00006 Date: $Date: 2010-06-23 16:11:17 $ 00007 Version: $Revision: 1.3 $ 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 Portions of this code are covered under the VTK copyright. 00013 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details. 00014 00015 This software is distributed WITHOUT ANY WARRANTY; without even 00016 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00017 PURPOSE. See the above copyright notices for more information. 00018 00019 =========================================================================*/ 00020 #ifndef __itkVTKImageIO2_h 00021 #define __itkVTKImageIO2_h 00022 00023 #ifdef _MSC_VER 00024 #pragma warning ( disable : 4786 ) 00025 #endif 00026 00027 #include <fstream> 00028 #include "itkStreamingImageIOBase.h" 00029 00030 00031 namespace itk 00032 { 00033 00041 class ITK_EXPORT VTKImageIO2 00042 : public StreamingImageIOBase 00043 { 00044 public: 00046 typedef VTKImageIO2 Self; 00047 typedef StreamingImageIOBase Superclass; 00048 typedef SmartPointer<Self> Pointer; 00049 typedef SmartPointer<const Self> ConstPointer; 00050 00052 itkNewMacro(Self); 00053 00055 itkTypeMacro(VTKImageIO2, StreamingImageIOBase); 00056 00057 /*-------- This part of the interface deals with reading data. ------ */ 00058 00061 virtual bool CanReadFile(const char*); 00062 00064 virtual void ReadImageInformation(); 00065 00067 virtual void Read(void* buffer); 00068 00069 /*-------- This part of the interfaces deals with writing data. ----- */ 00070 00073 virtual bool CanWriteFile(const char*); 00074 00077 virtual void WriteImageInformation() {}; 00078 00081 virtual void Write(const void* buffer); 00082 00083 00085 virtual SizeType GetHeaderSize() const { return this->m_HeaderSize; } 00086 00087 protected: 00088 VTKImageIO2(); 00089 ~VTKImageIO2(); 00090 void PrintSelf(std::ostream& os, Indent indent) const; 00091 00092 void InternalReadImageInformation(std::ifstream& file); 00093 void WriteImageInformation(const void* buffer); 00094 00095 void ReadHeaderSize( std::ifstream& file ); 00096 00097 private: 00098 VTKImageIO2(const Self&); //purposely not implemented 00099 void operator=(const Self&); //purposely not implemented 00100 00101 void SetPixelTypeFromString( const std::string & pixelType); 00102 00103 SizeType m_HeaderSize; 00104 }; 00105 00106 } // end namespace itk 00107 00108 #endif // __itkVTKImageIO2_h 00109