]> Creatis software - clitk.git/blob - common/clitkVfImageIO.h
remove MACRO for vvTool and others minors stuffs
[clitk.git] / common / clitkVfImageIO.h
1 #ifndef CLITKVFIMAGEIO_H
2 #define CLITKVFIMAGEIO_H
3
4 /**
5  * @file   clitkVfImageIO.h
6  * @author Simon Rit <Simon Rit <simon.rit@gmail.com>>
7  * @date   Mon Sep 18 10:13:21 2006
8  * 
9  * @brief  VectorField .vf I/O header
10  * 
11  * 
12  */
13
14
15 // clitk include
16 #include "clitkCommon.h"
17
18 // itk include
19 #include "itkImageIOBase.h"
20
21 // std include 
22 #include <fstream>
23
24 namespace clitk {
25   
26   //====================================================================
27   // Class for reading Vf Image file format
28   class VfImageIO: public itk::ImageIOBase
29   {
30   public: 
31         /** Standard class typedefs. */
32         typedef VfImageIO              Self;
33         typedef itk::ImageIOBase        Superclass;
34         typedef itk::SmartPointer<Self> Pointer;        
35         typedef signed short int        PixelType;
36         
37         VfImageIO():Superclass() { mustWriteHeader = false; }
38
39         /** Method for creation through the object factory. */
40         itkNewMacro(Self);
41         
42         /** Run-time type information (and related methods). */
43         itkTypeMacro(VfImageIO, ImageIOBase);
44         
45         /*-------- This part of the interface deals with reading data. ------ */
46         virtual void ReadImageInformation();
47         virtual bool CanReadFile( const char* FileNameToRead );
48         virtual void Read(void * buffer);
49
50         /*-------- This part of the interfaces deals with writing data. ----- */
51         virtual void WriteImageInformation(bool keepOfStream);
52         virtual void WriteImageInformation() { WriteImageInformation(false); }
53         virtual bool CanWriteFile(const char* filename);
54         virtual void Write(const void* buffer);
55         
56   protected:
57         bool mustWriteHeader;
58         int m_HeaderSize;
59         std::ofstream file;
60
61   }; // end class VfImageIO  
62
63 } // end namespace
64
65   // explicit template instantiation
66 template class itk::CreateObjectFunction<clitk::VfImageIO>;
67
68 #endif /* end #define CLITKVFIMAGEIO_H */
69