]> Creatis software - clitk.git/blob - common/clitkVfImageIO.h
david is libClitkGGO needed? What is it?
[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 namespace clitk {
22   
23   //====================================================================
24   // Class for reading Vf Image file format
25   class VfImageIO: public itk::ImageIOBase
26   {
27   public: 
28         /** Standard class typedefs. */
29         typedef VfImageIO              Self;
30         typedef itk::ImageIOBase        Superclass;
31         typedef itk::SmartPointer<Self> Pointer;        
32         typedef signed short int        PixelType;
33         
34         VfImageIO():Superclass() { mustWriteHeader = false; }
35
36         /** Method for creation through the object factory. */
37         itkNewMacro(Self);
38         
39         /** Run-time type information (and related methods). */
40         itkTypeMacro(VfImageIO, ImageIOBase);
41         
42         /*-------- This part of the interface deals with reading data. ------ */
43         virtual void ReadImageInformation();
44         virtual bool CanReadFile( const char* FileNameToRead );
45         virtual void Read(void * buffer);
46
47         /*-------- This part of the interfaces deals with writing data. ----- */
48         virtual void WriteImageInformation(bool keepOfStream);
49         virtual void WriteImageInformation() { WriteImageInformation(false); }
50         virtual bool CanWriteFile(const char* filename);
51         virtual void Write(const void* buffer);
52         
53   protected:
54         bool mustWriteHeader;
55         int m_HeaderSize;
56         std::ofstream file;
57
58   }; // end class VfImageIO  
59
60 } // end namespace
61
62   // explicit template instantiation
63 template class itk::CreateObjectFunction<clitk::VfImageIO>;
64
65 #endif /* end #define CLITKVFIMAGEIO_H */
66