]> Creatis software - clitk.git/blob - common/clitkVfImageIO.h
Set Directions to CropImage Like
[clitk.git] / common / clitkVfImageIO.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://www.centreleonberard.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 CLITKVFIMAGEIO_H
19 #define CLITKVFIMAGEIO_H
20
21 /**
22  * @file   clitkVfImageIO.h
23  * @author Simon Rit <Simon Rit <simon.rit@gmail.com>>
24  * @date   Mon Sep 18 10:13:21 2006
25  * 
26  * @brief  VectorField .vf I/O header
27  * 
28  * 
29  */
30
31
32 // clitk include
33 #include "clitkCommon.h"
34
35 // itk include
36 #include "itkImageIOBase.h"
37
38 // std include 
39 #include <fstream>
40
41 namespace clitk {
42   
43   //====================================================================
44   // Class for reading Vf Image file format
45   class VfImageIO: public itk::ImageIOBase
46   {
47   public: 
48         /** Standard class typedefs. */
49         typedef VfImageIO              Self;
50         typedef itk::ImageIOBase        Superclass;
51         typedef itk::SmartPointer<Self> Pointer;        
52         typedef signed short int        PixelType;
53         
54         VfImageIO():Superclass() { mustWriteHeader = false; }
55
56         /** Method for creation through the object factory. */
57         itkNewMacro(Self);
58         
59         /** Run-time type information (and related methods). */
60         itkTypeMacro(VfImageIO, ImageIOBase);
61         
62         /*-------- This part of the interface deals with reading data. ------ */
63         virtual void ReadImageInformation() ITK_OVERRIDE;
64         virtual bool CanReadFile( const char* FileNameToRead ) ITK_OVERRIDE;
65         virtual void Read(void * buffer) ITK_OVERRIDE;
66
67         /*-------- This part of the interfaces deals with writing data. ----- */
68         virtual void WriteImageInformation(bool keepOfStream);
69         virtual void WriteImageInformation() ITK_OVERRIDE { WriteImageInformation(false); }
70         virtual bool CanWriteFile(const char* filename) ITK_OVERRIDE;
71         virtual void Write(const void* buffer) ITK_OVERRIDE;
72         
73   protected:
74         bool mustWriteHeader;
75         int m_HeaderSize;
76         std::ofstream file;
77
78   }; // end class VfImageIO  
79
80 } // end namespace
81
82   // explicit template instantiation
83 //template class itk::CreateObjectFunction<clitk::VfImageIO>;
84
85 #endif /* end #define CLITKVFIMAGEIO_H */
86