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://oncora1.lyon.fnclcc.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);
39 //====================================================================
40 // Class for reading xdr Image file format
41 class XdrImageIO: public itk::ImageIOBase
44 /** Standard class typedefs. */
45 typedef XdrImageIO Self;
46 typedef itk::ImageIOBase Superclass;
47 typedef itk::SmartPointer<Self> Pointer;
48 typedef signed short int PixelType;
49 typedef enum {UNIFORM,RECTILINEAR,IRREGULAR} AVSType;
51 XdrImageIO():Superclass() {
55 /** Method for creation through the object factory. */
58 /** Run-time type information (and related methods). */
59 itkTypeMacro(XdrImageIO, ImageIOBase);
61 /*-------- This part of the interface deals with reading data. ------ */
62 virtual int ReadImageInformationWithError();
63 virtual int ReadWithError(void * buffer);
64 virtual void ReadImageInformation();
65 virtual void Read(void * buffer);
66 virtual bool CanReadFile( const char* FileNameToRead );
68 /*-------- This part of the interfaces deals with writing data. ----- */
69 virtual void WriteImageInformation(bool keepOfStream) {;}
70 virtual void WriteImageInformation() { WriteImageInformation(false); }
71 virtual bool CanWriteFile(const char* FileNameToWrite);
72 virtual void Write(const void* buffer);
75 void ITKError(std::string funcName, int msgID);
76 void WriteImage(const char* file, char* headerinfo, char* headerfile, int raw,
77 int offset, char bLittleEndian, int iNkiCompression,
78 int wcoords, int append, int getsize, char *tobuffer, const void* data);
82 }; // end class XdrImageIO
86 // explicit template instantiation
87 //template class itk::CreateObjectFunction<clitk::XdrImageIO>;
89 #endif /* end #define CLITKXDRIMAGEIO_H */