1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18 #ifndef CLITKGATEASCIIIMAGEIO_H
19 #define CLITKGATEASCIIIMAGEIO_H
22 #include "itkImageIOBase.h"
24 #if defined (_MSC_VER) && (_MSC_VER < 1600)
26 //#include "msinttypes/stdint.h"
27 typedef unsigned int uint32_t;
34 //====================================================================
35 // Class for reading gate ascii Image file format
36 class GateAsciiImageIO: public itk::ImageIOBase
39 /** Standard class typedefs. */
40 typedef GateAsciiImageIO Self;
41 typedef itk::ImageIOBase Superclass;
42 typedef itk::SmartPointer<Self> Pointer;
43 typedef signed short int PixelType;
45 struct GateAsciiHeader {
46 double matrix_size[3];
52 GateAsciiImageIO():Superclass() {;}
54 /** Method for creation through the object factory. */
57 /** Run-time type information (and related methods). */
58 itkTypeMacro(GateAsciiImageIO, ImageIOBase);
60 /*-------- This part of the interface deals with reading data. ------ */
61 virtual void ReadImageInformation();
62 virtual bool CanReadFile( const char* FileNameToRead );
63 virtual void Read(void * buffer);
65 /*-------- This part of the interfaces deals with writing data. ----- */
66 virtual void WriteImageInformation(bool keepOfStream) { ; }
67 virtual void WriteImageInformation() { WriteImageInformation(false); }
68 virtual bool CanWriteFile(const char* filename);
69 virtual void Write(const void* buffer);
73 static bool ReadHeader(FILE* handle, GateAsciiHeader& header);
74 static bool ReadLine(FILE* handle, std::string& line);
76 }; // end class GateAsciiImageIO
79 // explicit template instantiation
80 //template class itk::CreateObjectFunction<clitk::GateAsciiImageIO>;
82 #endif /* end #define CLITKGATEASCIIIMAGEIO_H */