]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.h
Support #1768 CREATIS Licence insertion
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / imageUndoRedo / imageInfoUR.h
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
8 #
9 #  This software is governed by the CeCILL-B license under French law and
10 #  abiding by the rules of distribution of free software. You can  use,
11 #  modify and/ or redistribute the software under the terms of the CeCILL-B
12 #  license as circulated by CEA, CNRS and INRIA at the following URL
13 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 #  or in the file LICENSE.txt.
15 #
16 #  As a counterpart to the access to the source code and  rights to copy,
17 #  modify and redistribute granted by the license, users are provided only
18 #  with a limited warranty  and the software's author,  the holder of the
19 #  economic rights,  and the successive licensors  have only  limited
20 #  liability.
21 #
22 #  The fact that you are presently reading this means that you have had
23 #  knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
25
26 /*!
27  * @file        imageInfoUR.h
28  * @brief       This file contains the ImageInfoUR class.
29  * @author      Info-Dev
30  * @author      Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
31  * @date        2011-11-15
32  */
33
34 #ifndef IMAGEINFO_H_
35 #define IMAGEINFO_H_
36
37 #include <iostream>
38 #include <string>
39 #include <cstdio>
40 #include <vtkImageData.h>
41 #include <vtkMetaImageWriter.h>
42 #include <vtkMetaImageReader.h>
43 #include <vtkSmartPointer.h>
44 #include "regionStructUR.h"
45 #include "imageModificationManager.h"
46
47 /*! @class ImageInfoUR imageInfoUR.h "imageInfoUR.cxx"
48  *      @brief This class contains the information of the undo/redo
49  *      @details This class contains the two images (undo and redo) and the ImageMManager.
50  */
51 class ImageInfoUR {
52
53 public:
54         //typedef definition
55         // ----------------------------------------------------------------------------------
56         /*!     @typedef vtkSmartPointer<vtkImageData> VTKImageDataPointerType;
57          *      @brief Defines the pointer of vtkImageDate type.
58          */
59         typedef vtkSmartPointer<vtkImageData> VTKImageDataPointerType;
60         // ----------------------------------------------------------------------------------
61         /*!     @typedef vtkSmartPointer<vtkMetaImageReader> VTKMetaImageReaderPointerType;
62          *      @brief Defines the pointer of vtkMetaImageReader type.
63          */
64         typedef vtkSmartPointer<vtkMetaImageReader> VTKMetaImageReaderPointerType;
65         // ----------------------------------------------------------------------------------
66         /*!     @typedef vtkSmartPointer<vtkMetaImageWriter> VTKMetaImageWriterPointerType;
67          *      @brief Defines the pointer of vtkMetaImageWriter type.
68          */
69         typedef vtkSmartPointer<vtkMetaImageWriter> VTKMetaImageWriterPointerType;
70         // ----------------------------------------------------------------------------------
71         /*!     @typedef std::string StringType;
72          *      @brief Redefinition of the string type.
73          */
74         typedef std::string StringType;
75         // ----------------------------------------------------------------------------------
76         /*!     @typedef ImageMManager ImageMManagerType;
77          *      @brief Definition of the ImageMManager type.
78          */
79         typedef ImageMManager ImageMManagerType;
80         // ----------------------------------------------------------------------------------
81 public:
82         // ----------------------------------------------------------------------------------
83         /*! @fn ImageInfoUR();
84          * @brief This is the default constructor.
85          */
86         ImageInfoUR();
87         // ----------------------------------------------------------------------------------
88         /*! @fn virtual ~ImageInfoUR();
89          * @brief This is the destructor.
90          */
91         virtual ~ImageInfoUR();
92         // ----------------------------------------------------------------------------------
93         /*! @fn void SetImageName(const StringType &imgName);
94          * @brief This method sets the image name for the undo/redo.
95          * @param imgName The imageName.
96          */
97         void SetImageName(const StringType &imgName);
98         // ----------------------------------------------------------------------------------
99         /*! @fn void SetImageMManager(ImageMManagerType *imMManager);
100          * @brief This method set the image modification manager.
101          * @param imMManager The pointer of the manager.
102          */
103         void SetImageMManager(ImageMManagerType *imMManager);
104         // ----------------------------------------------------------------------------------
105         /*! @fn void SetStatus(const bool& onMemory);
106          * @brief This method sets the memory status of the images.
107          * @param onMemory This is true if the images are in the memory.
108          */
109         void SetStatus(const bool& onMemory);
110         // ----------------------------------------------------------------------------------
111         /*! @fn void SetImages(VTKImageDataPointerType imgUndo,
112          VTKImageDataPointerType imgRedo);
113          * @brief This method sets the undo/redo Images.
114          * @param imgUndo The undo image.
115          * @param imgRedo The redo image.
116          */
117         void SetImages(VTKImageDataPointerType imgUndo,
118                         VTKImageDataPointerType imgRedo);
119         // ----------------------------------------------------------------------------------
120         /*! @fn void LoadImagesToMemory(const StringType& gPath);
121          * @brief This method takes the images from disk and load them to the principal memory.
122          * @param gPath The global path where the images are stored.
123          */
124         void LoadImagesToMemory(const StringType& gPath);
125         // ----------------------------------------------------------------------------------
126         /*! @fn void RemoveImagesFromMemory(const StringType& gPath);
127          * @brief This method removes the images from the principal memory.
128          * @param gPath The global path where the images are stored.
129          */
130         void RemoveImagesFromMemory(const StringType& gPath);
131         // ----------------------------------------------------------------------------------
132         /*! @fn void SaveImagesOnDisk(const StringType& gPath);
133          * @brief This method stores the images in the hard disk.
134          * @param  gPath The global path where the images are stored.
135          */
136         void SaveImagesOnDisk(const StringType& gPath);
137         // ----------------------------------------------------------------------------------
138         /*! @fn void RemoveImagesFromDisk(const StringType& gPath);
139          * @brief This method removes the images from the hard disk (permanently)
140          * @param gPath The global path where the images are stored.
141          */
142         void RemoveImagesFromDisk(const StringType& gPath);
143         // ----------------------------------------------------------------------------------
144         /*! @fn VTKImageDataPointerType GetUndoImage();
145          * @brief This method returns the undo image.
146          * @return
147          */
148         VTKImageDataPointerType GetUndoImage();
149         // ----------------------------------------------------------------------------------
150         /*! @fn VTKImageDataPointerType GetRedoImage();
151          * @brief This method returns the redo image.
152          * @return
153          */
154         VTKImageDataPointerType GetRedoImage();
155         // ----------------------------------------------------------------------------------
156         /*! @fn StringType GetImageName();
157          * @brief This method returns the ImagesName.
158          * @return
159          */
160         StringType GetImageName();
161         // ----------------------------------------------------------------------------------
162         /*! @fn ImageMManagerType* GetImageMManager();
163          * @brief This method returns the Image Modification Manager.
164          * @return
165          */
166         ImageMManagerType* GetImageMManager();
167         // ----------------------------------------------------------------------------------
168         /*! @fn void SaveImageAsMHD(const StringType& filename,
169          VTKImageDataPointerType image);
170          * @brief This method saves an image in a MHD format.
171          * @param filename The filename.
172          * @param VTKImageDataPointerType image.
173          */
174         void SaveImageAsMHD(const StringType& filename,
175                         VTKImageDataPointerType image);
176         // ----------------------------------------------------------------------------------
177         /*! @fn bool GetStatus();
178          * @brief This method returns true if the images are located in the principal memory.
179          * @return
180          */
181         bool GetStatus();
182         // ----------------------------------------------------------------------------------
183 private:
184         VTKImageDataPointerType m_UndoImage; //!<This is the undo image.
185         VTKImageDataPointerType m_RedoImage; //!<This is the redo image
186         StringType m_ImageName; //!<This is the base name of the images.
187         ImageMManagerType* m_ImageMManager; //!<This is the modification manager of the images.
188         bool m_OnMemory; //!<This is true if the images are in memory.
189         bool m_OnDisk; //!<This is true if the images are in disk.
190
191 };
192
193 #endif /* IMAGEINFO_H_ */