From: Diego Caceres Date: Tue, 15 Nov 2011 12:43:38 +0000 (+0000) Subject: DFCH: ManualPaint + imageUndoRedo: Undo/Redo functionality its now working =) =) X-Git-Tag: v1.0.4~39 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=a55972486c881d811de6c5d2b68f5d1b2885ac11;p=creaMaracasVisu.git DFCH: ManualPaint + imageUndoRedo: Undo/Redo functionality its now working =) =) Project status = 98% - Management of temporary files (Is now working with outside bugs) - Documentation (100%) - Clean code (90%) God Job!! =) --- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.cxx index c010cb9..41c2969 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.cxx @@ -1,15 +1,26 @@ +/*! + * @file image3DDequeUR.cxx + * @brief This file contains the implementation of the Image3DDequeUR class. + * @author Info-Dev + * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * @date 2011-11-15 + */ + #include "image3DDequeUR.h" #include #include +// ---------------------------------------------------------------------------------- Image3DDequeUR::Image3DDequeUR() { this->m_GlobalPath = "/home/caceres/temporal/"; this->m_CurrentURPos = -1; } +// ---------------------------------------------------------------------------------- //virtual Image3DDequeUR::~Image3DDequeUR() { this->CleanHardDisk(); } +// ---------------------------------------------------------------------------------- //virtual void Image3DDequeUR::AddImagesToURContainer(VTKImageDataPointerType imgUndo, VTKImageDataPointerType imgRedo, ImageMManager* imMManager) { @@ -25,6 +36,7 @@ void Image3DDequeUR::AddImagesToURContainer(VTKImageDataPointerType imgUndo, //Managing memory this->ManageMemory(); } +// ---------------------------------------------------------------------------------- //virtual ImageInfoUR* Image3DDequeUR::Undo() { ImageInfoUR* imgRet = NULL; @@ -36,7 +48,7 @@ ImageInfoUR* Image3DDequeUR::Undo() { } //fi return (imgRet); } - +// ---------------------------------------------------------------------------------- //virtual ImageInfoUR* Image3DDequeUR::Redo() { ImageInfoUR* imgRet = NULL; @@ -51,6 +63,7 @@ ImageInfoUR* Image3DDequeUR::Redo() { } return (imgRet); } +// ---------------------------------------------------------------------------------- //virtual void Image3DDequeUR::CleanURContainerFromIndex(const int& index) { int count = 0; @@ -63,7 +76,7 @@ void Image3DDequeUR::CleanURContainerFromIndex(const int& index) { this->m_ImgURDeque.pop_back(); } //rof } - +// ---------------------------------------------------------------------------------- //virtual void Image3DDequeUR::ManageMemory() { int imgURDequeSize = this->m_ImgURDeque.size(); @@ -85,21 +98,21 @@ void Image3DDequeUR::ManageMemory() { this->m_GlobalPath); } } - +// ---------------------------------------------------------------------------------- void Image3DDequeUR::SetGlobalPath(const StringType& globalPath) { this->m_GlobalPath = globalPath; } - +// ---------------------------------------------------------------------------------- void Image3DDequeUR::CleanHardDisk() { for (unsigned int i = 0; i < this->m_ImgURDeque.size(); i++) { this->m_ImgURDeque[i]->RemoveImagesFromDisk(this->m_GlobalPath); } } - +// ---------------------------------------------------------------------------------- Image3DDequeUR::StringType Image3DDequeUR::GetGlobalPath() { return (this->m_GlobalPath); } - +// ---------------------------------------------------------------------------------- Image3DDequeUR::StringType Image3DDequeUR::GetImageName(const int & pos) { //Giving a name to an image using the date and time if (this->m_IDImages.empty()) { @@ -118,3 +131,4 @@ Image3DDequeUR::StringType Image3DDequeUR::GetImageName(const int & pos) { StringType imageName = this->m_IDImages + ss.str(); return (imageName); } +// ---------------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.h index 53e3e4a..86a6473 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.h @@ -1,8 +1,9 @@ -/* - * image3DDequeUR.h - * - * Created on: Sep 26, 2011 - * Author: caceres +/*! + * @file image3DDequeUR.h + * @brief This file contains the Image3DDequeUR class. + * @author Info-Dev + * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * @date 2011-11-15 */ #ifndef IMAGE3DDEQUEUR_H_ @@ -11,25 +12,94 @@ #include "imageDequeUR.h" #include +/*! @class Image3DDequeUR image3DDequeUR.h "image3DDequeUR.cxx" + * @brief This class contains the management of the undo/redo deque - Concrete Class + * @details This class derives from ImageDequeUR. + */ class Image3DDequeUR: public ImageDequeUR { public: + //typedef definition + // ---------------------------------------------------------------------------------- + /*! @typedef std::deque ImageInfoDeque; + * @brief Defines the deque of ImageInfoUR for the undo/redo. + */ + typedef std::deque ImageInfoDeque; + // ---------------------------------------------------------------------------------- +public: + // ---------------------------------------------------------------------------------- + /*! @fn Image3DDequeUR(); + * @brief This is the default constructor. + */ Image3DDequeUR(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual ~Image3DDequeUR(); + * @brief This is the destructor. + */ virtual ~Image3DDequeUR(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual void AddImagesToURContainer(VTKImageDataPointerType imgUndo, + VTKImageDataPointerType imgRedo, ImageMManager* imMManager); + * @brief This method adds the images for undo and redo in a container + * @param imgUndo The undoImage cropped. + * @param imgRedo The redoImage cropped. + * @param imManager The image manager. + */ virtual void AddImagesToURContainer(VTKImageDataPointerType imgUndo, VTKImageDataPointerType imgRedo, ImageMManager* imMManager); + // ---------------------------------------------------------------------------------- + /*! @fn virtual void CleanURContainerFromIndex(const int& index); + * @brief This method allows to clean the container from a given index. + * @param index The index. + */ virtual void CleanURContainerFromIndex(const int& index); + // ---------------------------------------------------------------------------------- + /*! @fn virtual void ManageMemory(); + * @brief This method cleans the memory. + * @details This method cleans the principal memory when the images are not in use. + */ virtual void ManageMemory(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual ImageInfoUR* Undo(); + * @brief This method is the undo action. + * @return + */ virtual ImageInfoUR* Undo(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual ImageInfoUR* Redo(); + * @brief This method is the redo action. + * @return + */ virtual ImageInfoUR* Redo(); + // ---------------------------------------------------------------------------------- + /*! @fn void SetGlobalPath(const StringType& globalPath); + * @brief This method sets the global path where the temporary files will be stored. + * @param globalPath The String with the path. + */ void SetGlobalPath(const StringType& globalPath); + // ---------------------------------------------------------------------------------- + /*! @fn StringType GetGlobalPath(); + * @brief This method returns a String with the global path. + * @return + */ StringType GetGlobalPath(); + // ---------------------------------------------------------------------------------- + /*! @fn StringType GetImageName(const int & pos); + * @brief This method returns a String with an image name which won't be repeated. + * @param pos The position of the container to manage a sequence. + * @return + */ StringType GetImageName(const int & pos); + // ---------------------------------------------------------------------------------- + /*! @fn void CleanHardDisk(); + * @brief This method cleans the hard disk of the temporary files. + */ void CleanHardDisk(); + // ---------------------------------------------------------------------------------- protected: - ImageInfoDeque m_ImgURDeque; - int m_CurrentURPos; - StringType m_GlobalPath; - StringType m_IDImages; + ImageInfoDeque m_ImgURDeque; //! #include #include -//EED-11/11/2011 comment for windows compilation// #include #include #include #include "imageInfoUR.h" #include "imageModificationManager.h" +/*! @class ImageDequeUR imageDequeUR.h "imageDequeUR.cxx" + * @brief This class contains the management of the undo/redo - Abstract Class + */ class ImageDequeUR { public: - typedef std::deque ImageInfoDeque; + //typedef definition + // ---------------------------------------------------------------------------------- + /*! @typedef vtkSmartPointer VTKImageDataPointerType; + * @brief Defines the pointer of vtkImageDate type. + */ typedef vtkSmartPointer VTKImageDataPointerType; + // ---------------------------------------------------------------------------------- + /*! @typedef std::string StringType; + * @brief Redefinition of the string type. + */ typedef std::string StringType; + // ---------------------------------------------------------------------------------- + /*! @typedef ImageMManager ImageMManagerType; + * @brief Definition of the ImageMManager type. + */ typedef ImageMManager ImageMManagerType; + // ---------------------------------------------------------------------------------- public: + // ---------------------------------------------------------------------------------- + /*! @fn ImageDequeUR(); + * @brief This is the default constructor. + */ ImageDequeUR(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual ~ImageDequeUR(); + * @brief This is the destructor. + */ virtual ~ImageDequeUR(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual void AddImagesToURContainer(VTKImageDataPointerType imgUndo, + VTKImageDataPointerType imgRedo, ImageMManager* imMManager); + * @brief This method adds the images for undo and redo in a container + * @param imgUndo The undoImage cropped. + * @param imgRedo The redoImage cropped. + * @param imManager The image manager. + */ virtual void AddImagesToURContainer(VTKImageDataPointerType imgUndo, VTKImageDataPointerType imgRedo, ImageMManager* imMManager); + // ---------------------------------------------------------------------------------- + /*! @fn virtual void CleanURContainerFromIndex(const int& index); + * @brief This method allows to clean the container from a given index. + * @param index The index. + */ virtual void CleanURContainerFromIndex(const int& index); + // ---------------------------------------------------------------------------------- + /*! @fn virtual void ManageMemory(); + * @brief This method cleans the memory. + * @details This method cleans the principal memory when the images are not in use. + */ virtual void ManageMemory(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual ImageInfoUR* Undo(); + * @brief This method is the undo action. + * @return + */ virtual ImageInfoUR* Undo(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual ImageInfoUR* Redo(); + * @brief This method is the redo action. + * @return + */ virtual ImageInfoUR* Redo(); + // ---------------------------------------------------------------------------------- + /*! @fn void SetGlobalPath(const StringType& globalPath); + * @brief This method sets the global path where the temporary files will be stored. + * @param globalPath The String with the path. + */ }; #endif /* IMAGEDEQUE_H_ */ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx index e3608d4..9364d73 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx @@ -1,58 +1,61 @@ -/* - * ImageInfo.cxx - * - * Created on: Sep 22, 2011 - * Author: caceres +/*! + * @file imageInfoUR.cxx + * @brief This file contains the implementation of the ImageInfoUR class. + * @author Info-Dev + * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * @date 2011-11-15 */ + #include "imageInfoUR.h" +// ---------------------------------------------------------------------------------- ImageInfoUR::ImageInfoUR() { this->m_OnMemory = false; this->m_OnDisk = false; } - +// ---------------------------------------------------------------------------------- ImageInfoUR::~ImageInfoUR() { } - +// ---------------------------------------------------------------------------------- void ImageInfoUR::SetImageName(const StringType &imgName) { this->m_ImageName = imgName; } - +// ---------------------------------------------------------------------------------- void ImageInfoUR::SetImageMManager(ImageMManagerType* imMManager) { this->m_ImageMManager = imMManager; } - +// ---------------------------------------------------------------------------------- void ImageInfoUR::SetStatus(const bool& onMemory) { this->m_OnMemory = onMemory; } - +// ---------------------------------------------------------------------------------- ImageInfoUR::StringType ImageInfoUR::GetImageName() { return (this->m_ImageName); } - +// ---------------------------------------------------------------------------------- ImageInfoUR::VTKImageDataPointerType ImageInfoUR::GetUndoImage() { return (this->m_UndoImage); } - +// ---------------------------------------------------------------------------------- ImageInfoUR::VTKImageDataPointerType ImageInfoUR::GetRedoImage() { return (this->m_RedoImage); } - +// ---------------------------------------------------------------------------------- ImageInfoUR::ImageMManagerType* ImageInfoUR::GetImageMManager() { return (this->m_ImageMManager); } - +// ---------------------------------------------------------------------------------- bool ImageInfoUR::GetStatus() { return (this->m_OnMemory); } - +// ---------------------------------------------------------------------------------- void ImageInfoUR::SetImages(VTKImageDataPointerType imgUndo, VTKImageDataPointerType imgRedo) { this->m_UndoImage = imgUndo; this->m_RedoImage = imgRedo; this->SetStatus(true); } - +// ---------------------------------------------------------------------------------- void ImageInfoUR::LoadImagesToMemory(const StringType& gPath) { //setting paths StringType filename = gPath + this->m_ImageName; @@ -73,7 +76,7 @@ void ImageInfoUR::LoadImagesToMemory(const StringType& gPath) { //Updating status this->m_OnMemory = true; } - +// ---------------------------------------------------------------------------------- void ImageInfoUR::RemoveImagesFromMemory(const StringType& gPath) { if (!this->m_OnDisk) { this->SaveImagesOnDisk(gPath); @@ -82,27 +85,28 @@ void ImageInfoUR::RemoveImagesFromMemory(const StringType& gPath) { this->m_RedoImage = NULL; this->SetStatus(false); } - +// ---------------------------------------------------------------------------------- void ImageInfoUR::SaveImagesOnDisk(const StringType& gPath) { this->m_OnDisk = true; - //managing temporary files -//EED-11/11/2011 mkstemp((char*) filename.c_str()); StringType filename = gPath + this->m_ImageName; StringType undoImagePath = filename + "_Undo.mhd"; StringType redoImagePath = filename + "_Redo.mhd"; this->SaveImageAsMHD(undoImagePath, this->m_UndoImage); this->SaveImageAsMHD(redoImagePath, this->m_RedoImage); } - +// ---------------------------------------------------------------------------------- void ImageInfoUR::RemoveImagesFromDisk(const StringType& gPath) { StringType filename = gPath + this->m_ImageName; StringType undoImagePathMHD = filename + "_Undo.mhd"; StringType redoImagePathMHD = filename + "_Redo.mhd"; StringType undoImagePathRAW = filename + "_Undo.raw"; StringType redoImagePathRAW = filename + "_Redo.raw"; - //Unlink the files!! + remove(undoImagePathMHD.c_str()); + remove(redoImagePathMHD.c_str()); + remove(undoImagePathRAW.c_str()); + remove(redoImagePathRAW.c_str()); } - +// ---------------------------------------------------------------------------------- void ImageInfoUR::SaveImageAsMHD(const StringType& filename, VTKImageDataPointerType image) { VTKMetaImageWriterPointerType w = VTKMetaImageWriterPointerType::New(); @@ -112,3 +116,4 @@ void ImageInfoUR::SaveImageAsMHD(const StringType& filename, w->SetFileName(filename.c_str()); w->Write(); } +// ---------------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.h index 9a41c82..ede17ab 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.h @@ -1,8 +1,9 @@ -/* - * ImageInfo.h - * - * Created on: Sep 22, 2011 - * Author: caceres +/*! + * @file imageInfoUR.h + * @brief This file contains the ImageInfoUR class. + * @author Info-Dev + * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * @date 2011-11-15 */ #ifndef IMAGEINFO_H_ @@ -10,6 +11,7 @@ #include #include +#include #include #include #include @@ -17,46 +19,149 @@ #include "regionStructUR.h" #include "imageModificationManager.h" -/* - * Tenga cuidado que siempre se va a referir a dos imagenes (UNDO/REDO) entonces de las dos imagenes es el mismo solo que - * finalizan distinto. +/*! @class ImageInfoUR imageInfoUR.h "imageInfoUR.cxx" + * @brief This class contains the information of the undo/redo + * @details This class contains the two images (undo and redo) and the ImageMManager. */ - class ImageInfoUR { public: + //typedef definition + // ---------------------------------------------------------------------------------- + /*! @typedef vtkSmartPointer VTKImageDataPointerType; + * @brief Defines the pointer of vtkImageDate type. + */ typedef vtkSmartPointer VTKImageDataPointerType; + // ---------------------------------------------------------------------------------- + /*! @typedef vtkSmartPointer VTKMetaImageReaderPointerType; + * @brief Defines the pointer of vtkMetaImageReader type. + */ typedef vtkSmartPointer VTKMetaImageReaderPointerType; + // ---------------------------------------------------------------------------------- + /*! @typedef vtkSmartPointer VTKMetaImageWriterPointerType; + * @brief Defines the pointer of vtkMetaImageWriter type. + */ typedef vtkSmartPointer VTKMetaImageWriterPointerType; - typedef ImageMManager ImageMManagerType; + // ---------------------------------------------------------------------------------- + /*! @typedef std::string StringType; + * @brief Redefinition of the string type. + */ typedef std::string StringType; + // ---------------------------------------------------------------------------------- + /*! @typedef ImageMManager ImageMManagerType; + * @brief Definition of the ImageMManager type. + */ + typedef ImageMManager ImageMManagerType; + // ---------------------------------------------------------------------------------- public: + // ---------------------------------------------------------------------------------- + /*! @fn ImageInfoUR(); + * @brief This is the default constructor. + */ ImageInfoUR(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual ~ImageInfoUR(); + * @brief This is the destructor. + */ virtual ~ImageInfoUR(); + // ---------------------------------------------------------------------------------- + /*! @fn void SetImageName(const StringType &imgName); + * @brief This method sets the image name for the undo/redo. + * @param imgName The imageName. + */ void SetImageName(const StringType &imgName); + // ---------------------------------------------------------------------------------- + /*! @fn void SetImageMManager(ImageMManagerType *imMManager); + * @brief This method set the image modification manager. + * @param imMManager The pointer of the manager. + */ void SetImageMManager(ImageMManagerType *imMManager); + // ---------------------------------------------------------------------------------- + /*! @fn void SetStatus(const bool& onMemory); + * @brief This method sets the memory status of the images. + * @param onMemory This is true if the images are in the memory. + */ void SetStatus(const bool& onMemory); + // ---------------------------------------------------------------------------------- + /*! @fn void SetImages(VTKImageDataPointerType imgUndo, + VTKImageDataPointerType imgRedo); + * @brief This method sets the undo/redo Images. + * @param imgUndo The undo image. + * @param imgRedo The redo image. + */ void SetImages(VTKImageDataPointerType imgUndo, VTKImageDataPointerType imgRedo); + // ---------------------------------------------------------------------------------- + /*! @fn void LoadImagesToMemory(const StringType& gPath); + * @brief This method takes the images from disk and load them to the principal memory. + * @param gPath The global path where the images are stored. + */ void LoadImagesToMemory(const StringType& gPath); + // ---------------------------------------------------------------------------------- + /*! @fn void RemoveImagesFromMemory(const StringType& gPath); + * @brief This method removes the images from the principal memory. + * @param gPath The global path where the images are stored. + */ void RemoveImagesFromMemory(const StringType& gPath); + // ---------------------------------------------------------------------------------- + /*! @fn void SaveImagesOnDisk(const StringType& gPath); + * @brief This method stores the images in the hard disk. + * @param gPath The global path where the images are stored. + */ void SaveImagesOnDisk(const StringType& gPath); + // ---------------------------------------------------------------------------------- + /*! @fn void RemoveImagesFromDisk(const StringType& gPath); + * @brief This method removes the images from the hard disk (permanently) + * @param gPath The global path where the images are stored. + */ void RemoveImagesFromDisk(const StringType& gPath); + // ---------------------------------------------------------------------------------- + /*! @fn VTKImageDataPointerType GetUndoImage(); + * @brief This method returns the undo image. + * @return + */ VTKImageDataPointerType GetUndoImage(); + // ---------------------------------------------------------------------------------- + /*! @fn VTKImageDataPointerType GetRedoImage(); + * @brief This method returns the redo image. + * @return + */ VTKImageDataPointerType GetRedoImage(); + // ---------------------------------------------------------------------------------- + /*! @fn StringType GetImageName(); + * @brief This method returns the ImagesName. + * @return + */ StringType GetImageName(); + // ---------------------------------------------------------------------------------- + /*! @fn ImageMManagerType* GetImageMManager(); + * @brief This method returns the Image Modification Manager. + * @return + */ ImageMManagerType* GetImageMManager(); + // ---------------------------------------------------------------------------------- + /*! @fn void SaveImageAsMHD(const StringType& filename, + VTKImageDataPointerType image); + * @brief This method saves an image in a MHD format. + * @param filename The filename. + * @param VTKImageDataPointerType image. + */ void SaveImageAsMHD(const StringType& filename, VTKImageDataPointerType image); + // ---------------------------------------------------------------------------------- + /*! @fn bool GetStatus(); + * @brief This method returns true if the images are located in the principal memory. + * @return + */ bool GetStatus(); - + // ---------------------------------------------------------------------------------- private: - VTKImageDataPointerType m_UndoImage; - VTKImageDataPointerType m_RedoImage; - StringType m_ImageName; - ImageMManagerType* m_ImageMManager; - bool m_OnMemory; - bool m_OnDisk; + VTKImageDataPointerType m_UndoImage; //!m_RegionStruct = manager->GetModifiedRegion(); } +// ---------------------------------------------------------------------------------- ImageMManager::~ImageMManager() { } - +// ---------------------------------------------------------------------------------- void ImageMManager::CleanModifiedRegion() { int min = std::numeric_limits::min(); @@ -28,8 +32,8 @@ void ImageMManager::CleanModifiedRegion() { this->m_RegionStruct.minZ = max; this->m_RegionStruct.maxZ = min; this->m_ValidRegion = false; - -} //DFCH +} +// ---------------------------------------------------------------------------------- void ImageMManager::CalculateMinMaxRegion(const int& i, const int& j, const int& k) { if (i >= 0 && j >= 0 && k >= 0) { @@ -56,17 +60,17 @@ void ImageMManager::CalculateMinMaxRegion(const int& i, const int& j, else { this->m_ValidRegion = false; } //esle -} //DFCH - +} +// ---------------------------------------------------------------------------------- void ImageMManager::AddModifiedPixel(const int& i, const int& j, const int& k) { - //this->m_PixelMap[i][j][k] = true; this->CalculateMinMaxRegion(i, j, k); -} //DFCH - +} +// ---------------------------------------------------------------------------------- bool ImageMManager::ValidateRegion() { return (m_ValidRegion); } - +// ---------------------------------------------------------------------------------- RegionStructUR ImageMManager::GetModifiedRegion() { return (this->m_RegionStruct); } +// ---------------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageModificationManager.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageModificationManager.h index 196d65e..44561d3 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageModificationManager.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageModificationManager.h @@ -1,8 +1,9 @@ -/* - * imageManagement.h - * - * Created on: Oct 28, 2011 - * Author: caceres +/*! + * @file imageMManager.h + * @brief This file contains the ImageMManager class. + * @author Info-Dev + * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * @date 2011-11-15 */ #ifndef IMAGEMANAGEMENT_H_ @@ -14,22 +15,60 @@ #include "regionStructUR.h" +/*! @class ImageMManager imageMManager.h "imageMManager.cxx" + * @brief This class contains the modification manager of the undo/redo + * @details This class contains the region and some information about the undo/redo + */ class ImageMManager { public: - typedef std::map > > PixelModMap; //x,y,z -public: + // ---------------------------------------------------------------------------------- + /*! @fn ImageMManager(); + * @brief This is the default constructor. + */ ImageMManager(); + // ---------------------------------------------------------------------------------- + /*! @fn ImageMManager(ImageMManager* manager); + * @brief This is the parameterized constructor. + */ ImageMManager(ImageMManager* manager); + // ---------------------------------------------------------------------------------- + /*! @fn virtual ~ImageMManager(); + * @brief This is the destructor. + */ virtual ~ImageMManager(); - void CleanModifiedRegion(); //DFCH - void AddModifiedPixel(const int& i, const int& j, const int& k); //DFCH - bool ValidateRegion();//DFCH - RegionStructUR GetModifiedRegion(); //DFCH + // ---------------------------------------------------------------------------------- + /*! @fn void CleanModifiedRegion(); + * @brief This method cleans the modification Region. + */ + void CleanModifiedRegion(); + // ---------------------------------------------------------------------------------- + /*! @fn void AddModifiedPixel(const int& i, const int& j, const int& k); + * @brief This method adds the coordinates of the region modified. + */ + void AddModifiedPixel(const int& i, const int& j, const int& k); + // ---------------------------------------------------------------------------------- + /*! @fn bool ValidateRegion(); + * @brief This method returns true if the region modified is valid. + * @return + */ + bool ValidateRegion(); + // ---------------------------------------------------------------------------------- + /*! @fn RegionStructUR GetModifiedRegion(); + * @brief This method returns the modification region. + * @return + */ + RegionStructUR GetModifiedRegion(); + // ---------------------------------------------------------------------------------- private: - void CalculateMinMaxRegion(const int& i, const int& j, const int& k); //DFCH + // ---------------------------------------------------------------------------------- + /*! @fn + * @brief This method make the calculation of the minimun and maximum of the region modified. + */ + void CalculateMinMaxRegion(const int& i, const int& j, const int& k); + // ---------------------------------------------------------------------------------- private: - RegionStructUR m_RegionStruct; - bool m_ValidRegion; + RegionStructUR m_RegionStruct; //!< This is the Region structure. + bool m_ValidRegion; //!< This is true if the region is valid. }; #endif /* IMAGEMANAGEMENT_H_ */ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx index 7cc28e5..7672f4e 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx @@ -1,19 +1,23 @@ -/* - * imageUndoRedo.cxx - * - * Created on: Sep 26, 2011 - * Author: caceres +/*! + * @file imageUndoRedo.cxx + * @brief This file contains the implementation of the ImageUndoRedo class. + * @author Info-Dev + * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * @date 2011-11-15 */ #include "imageUndoRedo.h" +// ---------------------------------------------------------------------------------- ImageUndoRedo::ImageUndoRedo() { this->m_ImagesDeque = new IDequeType(); } +// ---------------------------------------------------------------------------------- //virtual ImageUndoRedo::~ImageUndoRedo() { } +// ---------------------------------------------------------------------------------- //virtual void ImageUndoRedo::Undo() { ImageInfoUR* imageInfo = this->m_ImagesDeque->Undo(); @@ -22,6 +26,7 @@ void ImageUndoRedo::Undo() { this->UpdateUndoImage(); } } +// ---------------------------------------------------------------------------------- //virtual void ImageUndoRedo::Redo() { ImageInfoUR* imageInfo = this->m_ImagesDeque->Redo(); @@ -30,11 +35,13 @@ void ImageUndoRedo::Redo() { this->UpdateUndoImage(); } } +// ---------------------------------------------------------------------------------- void ImageUndoRedo::SetImage(VTKImageDataPointerType image) { this->m_CurrentImage = image; this->m_CurrentImage->Update(); this->UpdateUndoImage(); } +// ---------------------------------------------------------------------------------- //virtual void ImageUndoRedo::SetURImages(ImageMManagerType* imMManager) { ImageMManagerType* newImageManager = new ImageMManagerType(imMManager); @@ -51,14 +58,14 @@ void ImageUndoRedo::SetURImages(ImageMManagerType* imMManager) { std::cerr << "INVALID REGION" << std::endl; } } - +// ---------------------------------------------------------------------------------- void ImageUndoRedo::UpdateUndoImage() { this->m_CurrentImage->Update(); this->m_UndoImage = VTKImageDataPointerType::New(); this->m_UndoImage->DeepCopy(m_CurrentImage); this->m_UndoImage->Update(); } - +// ---------------------------------------------------------------------------------- ImageUndoRedo::VTKImageDataPointerType ImageUndoRedo::GetImageRegion( const RegionSType& region, VTKImageDataPointerType img) { VTKExtractVOIPointerType extract = VTKExtractVOIPointerType::New(); @@ -70,10 +77,11 @@ ImageUndoRedo::VTKImageDataPointerType ImageUndoRedo::GetImageRegion( imgResult->Update(); return (imgResult); } - +// ---------------------------------------------------------------------------------- void ImageUndoRedo::SetCurrentImage(VTKImageDataPointerType img) { this->m_CurrentImage = img; } +// ---------------------------------------------------------------------------------- //virtual void ImageUndoRedo::DrawUR(ImageInfoUR* imageInfo, const bool& undo) { VTKImageDataPointerType img; @@ -98,4 +106,4 @@ void ImageUndoRedo::DrawUR(ImageInfoUR* imageInfo, const bool& undo) { } this->m_ImagesDeque->ManageMemory(); } - +// ---------------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.h index 7866f8e..66be0fc 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.h @@ -1,8 +1,9 @@ -/* - * imageUndoRedo.h - * - * Created on: Sep 26, 2011 - * Author: caceres +/*! + * @file imageUndoRedo.h + * @brief This file contains the ImageUndoRedo class. + * @author Info-Dev + * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * @date 2011-11-15 */ #ifndef IMAGEUNDOREDO_H_ @@ -10,26 +11,80 @@ #include "managerUR.h" +/*! @class ImageUndoRedo imageUndoRedo.h "imageUndoRedo.cxx" + * @brief This class manages the undo/redo -- Concrete Class + * @details This class derives from ManagerUR + */ class ImageUndoRedo: public ManagerUR { + public: + //typedef definition + // ---------------------------------------------------------------------------------- + /*! @typedef typedef Image3DDequeUR IDequeType; + * @brief Redefines the Image3DDequeUR type + */ + typedef Image3DDequeUR IDequeType; + // ---------------------------------------------------------------------------------- +public: + // ---------------------------------------------------------------------------------- + /*! @fn ImageUndoRedo(); + * @brief This is the default constructor. + */ ImageUndoRedo(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual ~ImageUndoRedo(); + * @brief This is the destructor. + */ virtual ~ImageUndoRedo(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual void Undo(); + * @brief This method manages the undo action. + */ virtual void Undo(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual void Redo(); + * @brief This method manages the redo action. + */ virtual void Redo(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual void SetImage(VTKImageDataPointerType image); + * @brief This method sets the modification image (The image which will be modified an manipulated) + */ virtual void SetImage(VTKImageDataPointerType image); + // ---------------------------------------------------------------------------------- + /*! @fn virtual void SetURImages(ImageMManagerType* imMManager); + * @brief This methods adds a new image Undo/Redo. + */ virtual void SetURImages(ImageMManagerType* imMManager); + // ---------------------------------------------------------------------------------- + /*! @fn void UpdateUndoImage(); + * @brief This method updates the undo image t(m_CurrentImage - 1). + */ void UpdateUndoImage(); + // ---------------------------------------------------------------------------------- + /*! @fn void SetCurrentImage(VTKImageDataPointerType img); + * @brief This method sets the image to be manipulated. + */ void SetCurrentImage(VTKImageDataPointerType img); + // ---------------------------------------------------------------------------------- + /*! @fn VTKImageDataPointerType GetImageRegion(const RegionSType& region, + VTKImageDataPointerType img); + * @brief This method extract from an image the region of interest (In the undo/redo returns the volume of the modified or t-1 image). + */ VTKImageDataPointerType GetImageRegion(const RegionSType& region, VTKImageDataPointerType img); protected: + // ---------------------------------------------------------------------------------- + /*! @fn virtual void DrawUR(ImageInfoUR* imageInfo, const bool& undo); + * @brief This method writes in the visualized image the changes of the undo/redo. + */ virtual void DrawUR(ImageInfoUR* imageInfo, const bool& undo); - + // ---------------------------------------------------------------------------------- protected: - IDequeType* m_ImagesDeque; - VTKImageDataPointerType m_UndoImage; - VTKImageDataPointerType m_CurrentImage; + IDequeType* m_ImagesDeque; //! VTKImageDataPointerType; + * @brief Defines the pointer of vtkImageDate type. + */ typedef vtkSmartPointer VTKImageDataPointerType; + // ---------------------------------------------------------------------------------- + /*! @typedef vtkSmartPointer VTKExtractVOIPointerType; + * @brief Defines the pointer of vtkExtractVOI type. + */ typedef vtkSmartPointer VTKExtractVOIPointerType; + // ---------------------------------------------------------------------------------- + /*! @typedef std::string StringType; + * @brief Redefinition of the string type + */ typedef std::string StringType; + // ---------------------------------------------------------------------------------- public: + // ---------------------------------------------------------------------------------- + /*! @fn ManagerUR(); + * @brief This is the default constructor. + */ ManagerUR(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual ~ManagerUR(); + * @brief This is the destructor. + */ virtual ~ManagerUR(); - virtual void SetImage(vtkImageData *image); + // ---------------------------------------------------------------------------------- + /*! @fn virtual void Undo(); + * @brief This method manages the undo action. + */ virtual void Undo(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual void Redo(); + * @brief This method manages the redo action. + */ virtual void Redo(); + // ---------------------------------------------------------------------------------- + /*! @fn virtual void SetImage(VTKImageDataPointerType image); + * @brief This method sets the modification image (The image which will be modified an manipulated) + */ + virtual void SetImage(VTKImageDataPointerType image); + // ---------------------------------------------------------------------------------- + /*! @fn virtual void SetURImages(ImageMManagerType* imMManager); + * @brief This methods adds a new image Undo/Redo. + */ virtual void SetURImages(ImageMManagerType* imMManager); + // ---------------------------------------------------------------------------------- protected: - virtual void DrawUR(ImageInfoUR imageInfo, const bool& undo); - + // ---------------------------------------------------------------------------------- + /*! @fn virtual void DrawUR(ImageInfoUR* imageInfo, const bool& undo); + * @brief This method writes in the visualized image the changes of the undo/redo. + */ + virtual void DrawUR(ImageInfoUR* imageInfo, const bool& undo); + // ---------------------------------------------------------------------------------- }; #endif /* MANAGERUR_H_ */ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/regionStructUR.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/regionStructUR.h index a6aac62..4373a6b 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/regionStructUR.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/regionStructUR.h @@ -1,20 +1,25 @@ -/* - * RegionStruct.h - * - * Created on: Sep 22, 2011 - * Author: caceres +/*! + * @file regionStructUR.h + * @brief This file contains the RegionStructUR struct. + * @author Info-Dev + * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr) + * @date 2011-11-15 */ #ifndef REGIONSTRUCT_H_ #define REGIONSTRUCT_H_ +/*! @class RegionStructUR reegionStructUR.h "managerUR.cxx" + * @brief This class manages the Undo/Redo -- Abstract Class. + * @details This class allows the communication between others libraries who wants to use it. + */ struct RegionStructUR { - int minX; - int maxX; - int minY; - int maxY; - int minZ; - int maxZ; + int minX; //!< This is the minimum X + int maxX; //!< This is the Maximum X + int minY; //!< This is the minimum Y + int maxY; //!< This is the Maximum Y + int minZ; //!< This is the minimum Z + int maxZ; //!< This is the Maximum Z }; #endif /* REGIONSTRUCT_H_ */