]> Creatis software - clitk.git/blob - common/clitkVoxImageIO.h
added the new headers
[clitk.git] / common / clitkVoxImageIO.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
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
8
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.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
18 #ifndef CLITKVOXIMAGEIO_H
19 #define CLITKVOXIMAGEIO_H
20 /**
21  ===================================================================
22  * @file   clitkVoxImageIO.h
23  * @author David Sarrut <David.Sarrut@creatis.insa-lyon.fr>
24  * @date   17 May 2006 08:01:35
25
26  * @brief  
27
28  ===================================================================*/
29
30 // clitk include
31 #include "clitkCommon.h"
32
33 // itk include
34 #include "itkImageIOBase.h"
35
36 // std include
37 #include <fstream>
38
39 namespace clitk {
40   
41   //====================================================================
42   // Class for reading Vox Image file format
43   class VoxImageIO: public itk::ImageIOBase
44   {
45   public: 
46         /** Standard class typedefs. */
47         typedef VoxImageIO              Self;
48         typedef itk::ImageIOBase        Superclass;
49         typedef itk::SmartPointer<Self> Pointer;        
50         typedef signed short int        PixelType;
51         
52         VoxImageIO():Superclass() { mustWriteHeader = false; }
53
54         /** Method for creation through the object factory. */
55         itkNewMacro(Self);
56         
57         /** Run-time type information (and related methods). */
58         itkTypeMacro(VoxImageIO, ImageIOBase);
59         
60         /*-------- This part of the interface deals with reading data. ------ */
61         virtual void ReadImageInformation();
62         virtual bool CanReadFile( const char* FileNameToRead );
63         virtual void Read(void * buffer);
64
65         /*-------- This part of the interfaces deals with writing data. ----- */
66         virtual void WriteImageInformation(bool keepOfStream);
67         virtual void WriteImageInformation() { WriteImageInformation(false); }
68         virtual bool CanWriteFile(const char* filename);
69         virtual void Write(const void* buffer);
70         
71   protected:
72         bool mustWriteHeader;
73         int m_HeaderSize;
74         std::ofstream file;
75
76   }; // end class VoxImageIO  
77
78 } // end namespace
79
80   // explicit template instantiation
81 template class itk::CreateObjectFunction<clitk::VoxImageIO>;
82
83 #endif /* end #define CLITKVOXIMAGEIO_H */
84