itkInrImageIO.hpp 2.73 KB
Newer Older
1
/* ***** BEGIN LICENSE BLOCK *****
Julien Waechter's avatar
Julien Waechter committed
2
 * FW4SPL - Copyright (C) IRCAD, 2009-2012.
3
4
5
6
 * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
 * published by the Free Software Foundation.
 * ****** END LICENSE BLOCK ****** */

Julien WAECHTER's avatar
Julien WAECHTER committed
7
8
#ifndef __FWITKIO_INR2ITK_INRIMAGEIO_HPP__
#define __FWITKIO_INR2ITK_INRIMAGEIO_HPP__
9
10

#include <fstream>
Julien WAECHTER's avatar
Julien WAECHTER committed
11
#include <itkImageIOBase.h>
12

13
#include "fwItkIO/config.hpp"
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

namespace itk
{

/**
 * \ingroup IOFilters
 * \author R&D team
 * \brief Class that defines how to read/write in the InrImage file format.
 * @todo RGB and vector images.
 */
class FWITKIO_CLASS_API InrImageIO : public ImageIOBase
{
public :
    /** Standard typedef's */
    typedef InrImageIO Self;
    typedef ImageIOBase SuperClass;
    typedef SmartPointer<Self> Pointer;
Julien WAECHTER's avatar
Julien WAECHTER committed
31

32
33
34
35
36
    /** Method for creation through the object factory. */
    itkNewMacro(Self);

    /** Run-time type information (and related methods). */
    itkTypeMacro(InrImageIO, Superclass);
Julien WAECHTER's avatar
Julien WAECHTER committed
37

38
    /*-------- This part of the interfaces deals with reading data. ----- */
Julien WAECHTER's avatar
Julien WAECHTER committed
39

40
41
42
43
44
45
    /** Determine if the file can be read with this ImageIO implementation.
     * \param FileNameToRead The name of the file to test for reading.
     * \post Sets classes ImageIOBase::m_FileName variable to be FileNameToWrite
     * \return Returns true if this ImageIO can read the file specified.
     */
    virtual bool CanReadFile(const char* FileNameToRead);
Julien WAECHTER's avatar
Julien WAECHTER committed
46

47
48
    /** Set the spacing and dimension information for the set filename. */
    virtual void ReadImageInformation();
Julien WAECHTER's avatar
Julien WAECHTER committed
49

50
51
    /** Reads the data from disk into the memory buffer provided. */
    virtual void Read(void* buffer);
Julien WAECHTER's avatar
Julien WAECHTER committed
52

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
    /*-------- This part of the interfaces deals with writing data. ----- */

    /** Determine if the file can be written with this ImageIO implementation.
     * \param FileNameToWrite The name of the file to test for writing.
     * \post Sets classes ImageIOBase::m_FileName variable to be FileNameToWrite
     * \return Returns true if this ImageIO can write the file specified.
     */
    virtual bool CanWriteFile(const char * FileNameToWrite);

    /** Set the spacing and dimension information for the set filename. */
    virtual void WriteImageInformation();

    /** Writes the data to disk from the memory buffer provided. Make sure
     * that the IORegions has been set properly. */
    virtual void Write(const void* buffer);
Julien WAECHTER's avatar
Julien WAECHTER committed
68

69
70
71
72
73
74
75
protected:
    FWITKIO_API InrImageIO();
    FWITKIO_API ~InrImageIO();
    void PrintSelf(std::ostream& os, Indent indent) const;
private:
    InrImageIO(const Self&); //purposely not implemented
    void operator=(const Self&); //purposely not implemented
Julien WAECHTER's avatar
Julien WAECHTER committed
76

77
78
79
80
81
82
    std::streampos m_headerSize;
    //bool m_swapBytes;
}; // class InrImageIO()

} // namespace itk

Julien WAECHTER's avatar
Julien WAECHTER committed
83
#endif // __FWITKIO_INR2ITK_INRIMAGEIO_HPP__