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>
23 #include <itksys/RegularExpression.hxx>
25 #if defined (_MSC_VER) && (_MSC_VER < 1600)
27 //#include "msinttypes/stdint.h"
28 typedef unsigned int uint32_t;
36 //====================================================================
37 // Class for reading gate ascii Image file format
38 class GateAsciiImageIO: public itk::ImageIOBase
41 /** Standard class typedefs. */
42 typedef GateAsciiImageIO Self;
43 typedef itk::ImageIOBase Superclass;
44 typedef itk::SmartPointer<Self> Pointer;
46 struct GateAsciiHeader {
47 double matrix_size[3];
53 GateAsciiImageIO():Superclass() {}
55 /** Method for creation through the object factory. */
58 /** Run-time type information (and related methods). */
59 itkTypeMacro(GateAsciiImageIO, ImageIOBase);
61 /*-------- This part of the interface deals with reading data. ------ */
62 virtual void ReadImageInformation();
63 virtual bool CanReadFile( const char* FileNameToRead );
64 virtual void Read(void * buffer);
66 /*-------- This part of the interfaces deals with writing data. ----- */
67 virtual void WriteImageInformation();
68 virtual bool CanWriteFile(const char* filename);
69 virtual void Write(const void* buffer);
71 virtual bool SupportsDimension(unsigned long dim);
74 static bool ReadHeader(FILE* handle, GateAsciiHeader& header);
75 static bool ReadLine(FILE* handle, std::string& line);
76 static bool FindRegularExpressionNextLine(itksys::RegularExpression ®, std::string &s, FILE* handle);
78 }; // end class GateAsciiImageIO
81 // explicit template instantiation
82 //template class itk::CreateObjectFunction<clitk::GateAsciiImageIO>;
84 #endif /* end #define CLITKGATEASCIIIMAGEIO_H */