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 CLITKXDRIMAGEIO_H
19 #define CLITKXDRIMAGEIO_H
22 * @file clitkXdrImageIO.h
23 * @author Simon Rit <simon.rit@gmail.com>
24 * @date Sun Jun 1 22:07:45 2008
32 #include "itkImageIOBase.h"
34 #define AVSerror(v) itkGenericExceptionMacro(<< "Error in clitk::XdrImageIO. Message:" << v);
35 #define AVSwarning(v) itkWarningMacro(<< "Error in clitk::XdrImageIO. Message:" << v);
37 #include "clitkCommon.h"
41 //====================================================================
42 // Class for reading xdr Image file format
43 class XdrImageIO: public itk::ImageIOBase
46 /** Standard class typedefs. */
47 typedef XdrImageIO Self;
48 typedef itk::ImageIOBase Superclass;
49 typedef itk::SmartPointer<Self> Pointer;
50 typedef signed short int PixelType;
51 typedef enum {UNIFORM,RECTILINEAR,IRREGULAR} AVSType;
53 XdrImageIO():Superclass() {
57 /** Method for creation through the object factory. */
60 /** Run-time type information (and related methods). */
61 itkTypeMacro(XdrImageIO, ImageIOBase);
63 /*-------- This part of the interface deals with reading data. ------ */
64 virtual int ReadImageInformationWithError();
65 virtual int ReadWithError(void * buffer);
66 virtual void ReadImageInformation() ITK_OVERRIDE;
67 virtual void Read(void * buffer) ITK_OVERRIDE;
68 virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE;
70 /*-------- This part of the interfaces deals with writing data. ----- */
71 virtual void WriteImageInformation(bool keepOfStream) {;}
72 virtual void WriteImageInformation() ITK_OVERRIDE { WriteImageInformation(false); }
73 virtual bool CanWriteFile(const char* FileNameToWrite) ITK_OVERRIDE;
74 virtual void Write(const void* buffer) ITK_OVERRIDE;
77 void ITKError(std::string funcName, int msgID);
78 void WriteImage(const char* file, char* headerinfo, char* headerfile, int raw,
79 int offset, char bLittleEndian, int iNkiCompression,
80 int wcoords, int append, int getsize, char *tobuffer, const void* data);
84 }; // end class XdrImageIO
88 // explicit template instantiation
89 //template class itk::CreateObjectFunction<clitk::XdrImageIO>;
91 #endif /* end #define CLITKXDRIMAGEIO_H */