1 #ifndef CLITKXDRIMAGEIO_H
2 #define CLITKXDRIMAGEIO_H
5 * @file clitkXdrImageIO.h
6 * @author Simon Rit <simon.rit@gmail.com>
7 * @date Sun Jun 1 22:07:45 2008
15 #include "itkImageIOBase.h"
17 #define AVSerror(v) itkGenericExceptionMacro(<< "Error in clitk::XdrImageIO. Message:" << v);
18 #define AVSwarning(v) itkWarningMacro(<< "Error in clitk::XdrImageIO. Message:" << v);
22 //====================================================================
23 // Class for reading xdr Image file format
24 class XdrImageIO: public itk::ImageIOBase
27 /** Standard class typedefs. */
28 typedef XdrImageIO Self;
29 typedef itk::ImageIOBase Superclass;
30 typedef itk::SmartPointer<Self> Pointer;
31 typedef signed short int PixelType;
32 typedef enum {UNIFORM,RECTILINEAR,IRREGULAR} AVSType;
34 XdrImageIO():Superclass() {
38 /** Method for creation through the object factory. */
41 /** Run-time type information (and related methods). */
42 itkTypeMacro(XdrImageIO, ImageIOBase);
44 /*-------- This part of the interface deals with reading data. ------ */
45 virtual int ReadImageInformationWithError();
46 virtual int ReadWithError(void * buffer);
47 virtual void ReadImageInformation();
48 virtual void Read(void * buffer);
49 virtual bool CanReadFile( const char* FileNameToRead );
51 /*-------- This part of the interfaces deals with writing data. ----- */
52 virtual void WriteImageInformation(bool keepOfStream) {;}
53 virtual void WriteImageInformation() { WriteImageInformation(false); }
54 virtual bool CanWriteFile(const char* FileNameToWrite);
55 virtual void Write(const void* buffer);
58 void ITKError(std::string funcName, int msgID);
59 void WriteImage(const char* file, char* headerinfo, char* headerfile, int raw,
\r
60 int offset, char bLittleEndian, int iNkiCompression,
\r
61 int wcoords, int append, int getsize, char *tobuffer, const void* data);
\r
65 }; // end class XdrImageIO
69 // explicit template instantiation
70 template class itk::CreateObjectFunction<clitk::XdrImageIO>;
72 #endif /* end #define CLITKXDRIMAGEIO_H */