]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.h
ede17abc75e359713558e8264046ca1482f9337b
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / imageUndoRedo / imageInfoUR.h
1 /*!
2  * @file        imageInfoUR.h
3  * @brief       This file contains the ImageInfoUR class.
4  * @author      Info-Dev
5  * @author      Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
6  * @date        2011-11-15
7  */
8
9 #ifndef IMAGEINFO_H_
10 #define IMAGEINFO_H_
11
12 #include <iostream>
13 #include <string>
14 #include <cstdio>
15 #include <vtkImageData.h>
16 #include <vtkMetaImageWriter.h>
17 #include <vtkMetaImageReader.h>
18 #include <vtkSmartPointer.h>
19 #include "regionStructUR.h"
20 #include "imageModificationManager.h"
21
22 /*! @class ImageInfoUR imageInfoUR.h "imageInfoUR.cxx"
23  *      @brief This class contains the information of the undo/redo
24  *      @details This class contains the two images (undo and redo) and the ImageMManager.
25  */
26 class ImageInfoUR {
27
28 public:
29         //typedef definition
30         // ----------------------------------------------------------------------------------
31         /*!     @typedef vtkSmartPointer<vtkImageData> VTKImageDataPointerType;
32          *      @brief Defines the pointer of vtkImageDate type.
33          */
34         typedef vtkSmartPointer<vtkImageData> VTKImageDataPointerType;
35         // ----------------------------------------------------------------------------------
36         /*!     @typedef vtkSmartPointer<vtkMetaImageReader> VTKMetaImageReaderPointerType;
37          *      @brief Defines the pointer of vtkMetaImageReader type.
38          */
39         typedef vtkSmartPointer<vtkMetaImageReader> VTKMetaImageReaderPointerType;
40         // ----------------------------------------------------------------------------------
41         /*!     @typedef vtkSmartPointer<vtkMetaImageWriter> VTKMetaImageWriterPointerType;
42          *      @brief Defines the pointer of vtkMetaImageWriter type.
43          */
44         typedef vtkSmartPointer<vtkMetaImageWriter> VTKMetaImageWriterPointerType;
45         // ----------------------------------------------------------------------------------
46         /*!     @typedef std::string StringType;
47          *      @brief Redefinition of the string type.
48          */
49         typedef std::string StringType;
50         // ----------------------------------------------------------------------------------
51         /*!     @typedef ImageMManager ImageMManagerType;
52          *      @brief Definition of the ImageMManager type.
53          */
54         typedef ImageMManager ImageMManagerType;
55         // ----------------------------------------------------------------------------------
56 public:
57         // ----------------------------------------------------------------------------------
58         /*! @fn ImageInfoUR();
59          * @brief This is the default constructor.
60          */
61         ImageInfoUR();
62         // ----------------------------------------------------------------------------------
63         /*! @fn virtual ~ImageInfoUR();
64          * @brief This is the destructor.
65          */
66         virtual ~ImageInfoUR();
67         // ----------------------------------------------------------------------------------
68         /*! @fn void SetImageName(const StringType &imgName);
69          * @brief This method sets the image name for the undo/redo.
70          * @param imgName The imageName.
71          */
72         void SetImageName(const StringType &imgName);
73         // ----------------------------------------------------------------------------------
74         /*! @fn void SetImageMManager(ImageMManagerType *imMManager);
75          * @brief This method set the image modification manager.
76          * @param imMManager The pointer of the manager.
77          */
78         void SetImageMManager(ImageMManagerType *imMManager);
79         // ----------------------------------------------------------------------------------
80         /*! @fn void SetStatus(const bool& onMemory);
81          * @brief This method sets the memory status of the images.
82          * @param onMemory This is true if the images are in the memory.
83          */
84         void SetStatus(const bool& onMemory);
85         // ----------------------------------------------------------------------------------
86         /*! @fn void SetImages(VTKImageDataPointerType imgUndo,
87          VTKImageDataPointerType imgRedo);
88          * @brief This method sets the undo/redo Images.
89          * @param imgUndo The undo image.
90          * @param imgRedo The redo image.
91          */
92         void SetImages(VTKImageDataPointerType imgUndo,
93                         VTKImageDataPointerType imgRedo);
94         // ----------------------------------------------------------------------------------
95         /*! @fn void LoadImagesToMemory(const StringType& gPath);
96          * @brief This method takes the images from disk and load them to the principal memory.
97          * @param gPath The global path where the images are stored.
98          */
99         void LoadImagesToMemory(const StringType& gPath);
100         // ----------------------------------------------------------------------------------
101         /*! @fn void RemoveImagesFromMemory(const StringType& gPath);
102          * @brief This method removes the images from the principal memory.
103          * @param gPath The global path where the images are stored.
104          */
105         void RemoveImagesFromMemory(const StringType& gPath);
106         // ----------------------------------------------------------------------------------
107         /*! @fn void SaveImagesOnDisk(const StringType& gPath);
108          * @brief This method stores the images in the hard disk.
109          * @param  gPath The global path where the images are stored.
110          */
111         void SaveImagesOnDisk(const StringType& gPath);
112         // ----------------------------------------------------------------------------------
113         /*! @fn void RemoveImagesFromDisk(const StringType& gPath);
114          * @brief This method removes the images from the hard disk (permanently)
115          * @param gPath The global path where the images are stored.
116          */
117         void RemoveImagesFromDisk(const StringType& gPath);
118         // ----------------------------------------------------------------------------------
119         /*! @fn VTKImageDataPointerType GetUndoImage();
120          * @brief This method returns the undo image.
121          * @return
122          */
123         VTKImageDataPointerType GetUndoImage();
124         // ----------------------------------------------------------------------------------
125         /*! @fn VTKImageDataPointerType GetRedoImage();
126          * @brief This method returns the redo image.
127          * @return
128          */
129         VTKImageDataPointerType GetRedoImage();
130         // ----------------------------------------------------------------------------------
131         /*! @fn StringType GetImageName();
132          * @brief This method returns the ImagesName.
133          * @return
134          */
135         StringType GetImageName();
136         // ----------------------------------------------------------------------------------
137         /*! @fn ImageMManagerType* GetImageMManager();
138          * @brief This method returns the Image Modification Manager.
139          * @return
140          */
141         ImageMManagerType* GetImageMManager();
142         // ----------------------------------------------------------------------------------
143         /*! @fn void SaveImageAsMHD(const StringType& filename,
144          VTKImageDataPointerType image);
145          * @brief This method saves an image in a MHD format.
146          * @param filename The filename.
147          * @param VTKImageDataPointerType image.
148          */
149         void SaveImageAsMHD(const StringType& filename,
150                         VTKImageDataPointerType image);
151         // ----------------------------------------------------------------------------------
152         /*! @fn bool GetStatus();
153          * @brief This method returns true if the images are located in the principal memory.
154          * @return
155          */
156         bool GetStatus();
157         // ----------------------------------------------------------------------------------
158 private:
159         VTKImageDataPointerType m_UndoImage; //!<This is the undo image.
160         VTKImageDataPointerType m_RedoImage; //!<This is the redo image
161         StringType m_ImageName; //!<This is the base name of the images.
162         ImageMManagerType* m_ImageMManager; //!<This is the modification manager of the images.
163         bool m_OnMemory; //!<This is true if the images are in memory.
164         bool m_OnDisk; //!<This is true if the images are in disk.
165
166 };
167
168 #endif /* IMAGEINFO_H_ */