1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
28 * @brief This file contains the ImageInfoUR class.
30 * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
40 #include <vtkImageData.h>
41 #include <vtkMetaImageWriter.h>
42 #include <vtkMetaImageReader.h>
43 #include <vtkSmartPointer.h>
44 #include "regionStructUR.h"
45 #include "imageModificationManager.h"
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.
55 // ----------------------------------------------------------------------------------
56 /*! @typedef vtkSmartPointer<vtkImageData> VTKImageDataPointerType;
57 * @brief Defines the pointer of vtkImageDate type.
59 typedef vtkSmartPointer<vtkImageData> VTKImageDataPointerType;
60 // ----------------------------------------------------------------------------------
61 /*! @typedef vtkSmartPointer<vtkMetaImageReader> VTKMetaImageReaderPointerType;
62 * @brief Defines the pointer of vtkMetaImageReader type.
64 typedef vtkSmartPointer<vtkMetaImageReader> VTKMetaImageReaderPointerType;
65 // ----------------------------------------------------------------------------------
66 /*! @typedef vtkSmartPointer<vtkMetaImageWriter> VTKMetaImageWriterPointerType;
67 * @brief Defines the pointer of vtkMetaImageWriter type.
69 typedef vtkSmartPointer<vtkMetaImageWriter> VTKMetaImageWriterPointerType;
70 // ----------------------------------------------------------------------------------
71 /*! @typedef std::string StringType;
72 * @brief Redefinition of the string type.
74 typedef std::string StringType;
75 // ----------------------------------------------------------------------------------
76 /*! @typedef ImageMManager ImageMManagerType;
77 * @brief Definition of the ImageMManager type.
79 typedef ImageMManager ImageMManagerType;
80 // ----------------------------------------------------------------------------------
82 // ----------------------------------------------------------------------------------
83 /*! @fn ImageInfoUR();
84 * @brief This is the default constructor.
87 // ----------------------------------------------------------------------------------
88 /*! @fn virtual ~ImageInfoUR();
89 * @brief This is the destructor.
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.
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.
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.
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.
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.
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.
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.
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.
142 void RemoveImagesFromDisk(const StringType& gPath);
143 // ----------------------------------------------------------------------------------
144 /*! @fn VTKImageDataPointerType GetUndoImage();
145 * @brief This method returns the undo image.
148 VTKImageDataPointerType GetUndoImage();
149 // ----------------------------------------------------------------------------------
150 /*! @fn VTKImageDataPointerType GetRedoImage();
151 * @brief This method returns the redo image.
154 VTKImageDataPointerType GetRedoImage();
155 // ----------------------------------------------------------------------------------
156 /*! @fn StringType GetImageName();
157 * @brief This method returns the ImagesName.
160 StringType GetImageName();
161 // ----------------------------------------------------------------------------------
162 /*! @fn ImageMManagerType* GetImageMManager();
163 * @brief This method returns the Image Modification Manager.
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.
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.
182 // ----------------------------------------------------------------------------------
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.
193 #endif /* IMAGEINFO_H_ */