X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkGateAsciiImageIO.h;h=d5eefc1d7c11fb71a1d5bc2d73ee194f918ffee1;hb=738abae55fb33a7c77843a9d84bc14d5439bff1a;hp=d0abbea0b91922c47e73b48a3768eec279266ec4;hpb=1d616cc7be31f7195c8bba4142e02350cd2fb958;p=clitk.git diff --git a/common/clitkGateAsciiImageIO.h b/common/clitkGateAsciiImageIO.h index d0abbea..d5eefc1 100644 --- a/common/clitkGateAsciiImageIO.h +++ b/common/clitkGateAsciiImageIO.h @@ -1,7 +1,7 @@ /*========================================================================= Program: vv http://www.creatis.insa-lyon.fr/rio/vv - Authors belong to: + Authors belong to: - University of LYON http://www.universite-lyon.fr/ - Léon Bérard cancer center http://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr @@ -19,7 +19,8 @@ #define CLITKGATEASCIIIMAGEIO_H // itk include -#include "itkImageIOBase.h" +#include +#include #if defined (_MSC_VER) && (_MSC_VER < 1600) //SR: taken from @@ -29,52 +30,54 @@ typedef unsigned int uint32_t; #include #endif -namespace clitk { +#include "clitkCommon.h" - //==================================================================== - // Class for reading gate ascii Image file format - class GateAsciiImageIO: public itk::ImageIOBase - { - public: - /** Standard class typedefs. */ - typedef GateAsciiImageIO Self; - typedef itk::ImageIOBase Superclass; - typedef itk::SmartPointer Pointer; - typedef signed short int PixelType; +namespace clitk +{ - struct GateAsciiHeader { - double matrix_size[3]; - int resolution[3]; - double voxel_size[3]; - int nb_value; - }; +//==================================================================== +// Class for reading gate ascii Image file format +class GateAsciiImageIO: public itk::ImageIOBase +{ +public: + /** Standard class typedefs. */ + typedef GateAsciiImageIO Self; + typedef itk::ImageIOBase Superclass; + typedef itk::SmartPointer Pointer; - GateAsciiImageIO():Superclass() {;} + struct GateAsciiHeader { + double matrix_size[3]; + int resolution[3]; + double voxel_size[3]; + int nb_value; + }; - /** Method for creation through the object factory. */ - itkNewMacro(Self); + GateAsciiImageIO():Superclass() {} - /** Run-time type information (and related methods). */ - itkTypeMacro(GateAsciiImageIO, ImageIOBase); + /** Method for creation through the object factory. */ + itkNewMacro(Self); - /*-------- This part of the interface deals with reading data. ------ */ - virtual void ReadImageInformation(); - virtual bool CanReadFile( const char* FileNameToRead ); - virtual void Read(void * buffer); + /** Run-time type information (and related methods). */ + itkTypeMacro(GateAsciiImageIO, ImageIOBase); - /*-------- This part of the interfaces deals with writing data. ----- */ - virtual void WriteImageInformation(); - virtual bool CanWriteFile(const char* filename); - virtual void Write(const void* buffer); + /*-------- This part of the interface deals with reading data. ------ */ + virtual void ReadImageInformation() ITK_OVERRIDE; + virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE; + virtual void Read(void * buffer) ITK_OVERRIDE; - virtual bool SupportsDimension(unsigned long dim); + /*-------- This part of the interfaces deals with writing data. ----- */ + virtual void WriteImageInformation() ITK_OVERRIDE; + virtual bool CanWriteFile(const char* filename) ITK_OVERRIDE; + virtual void Write(const void* buffer) ITK_OVERRIDE; - protected: + virtual bool SupportsDimension(unsigned long dim) ITK_OVERRIDE; - static bool ReadHeader(FILE* handle, GateAsciiHeader& header); - static bool ReadLine(FILE* handle, std::string& line); +protected: + static bool ReadHeader(FILE* handle, GateAsciiHeader& header); + static bool ReadLine(FILE* handle, std::string& line); + static bool FindRegularExpressionNextLine(itksys::RegularExpression ®, std::string &s, FILE* handle); - }; // end class GateAsciiImageIO +}; // end class GateAsciiImageIO } // end namespace // explicit template instantiation