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