+/*!
+ * @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 <iostream>
#include <sstream>
+// ----------------------------------------------------------------------------------
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) {
//Managing memory
this->ManageMemory();
}
+// ----------------------------------------------------------------------------------
//virtual
ImageInfoUR* Image3DDequeUR::Undo() {
ImageInfoUR* imgRet = NULL;
} //fi
return (imgRet);
}
-
+// ----------------------------------------------------------------------------------
//virtual
ImageInfoUR* Image3DDequeUR::Redo() {
ImageInfoUR* imgRet = NULL;
}
return (imgRet);
}
+// ----------------------------------------------------------------------------------
//virtual
void Image3DDequeUR::CleanURContainerFromIndex(const int& index) {
int count = 0;
this->m_ImgURDeque.pop_back();
} //rof
}
-
+// ----------------------------------------------------------------------------------
//virtual
void Image3DDequeUR::ManageMemory() {
int imgURDequeSize = this->m_ImgURDeque.size();
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()) {
StringType imageName = this->m_IDImages + ss.str();
return (imageName);
}
+// ----------------------------------------------------------------------------------
-/*
- * 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_
#include "imageDequeUR.h"
#include <ctime>
+/*! @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<ImageInfoUR*> ImageInfoDeque;
+ * @brief Defines the deque of ImageInfoUR for the undo/redo.
+ */
+ typedef std::deque<ImageInfoUR*> 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; //!<This is the container of the images for undo and redo.
+ int m_CurrentURPos; //!<This is the index where is located the undo and redo state.
+ StringType m_GlobalPath; //!<This is the string with the global path.
+ StringType m_IDImages; //!<This is the string with the ID of the images (For the filenames).
};
#endif /* IMAGE3DDEQUEUR_H_ */
+/*!
+ * @file imageDequeUR.cxx
+ * @brief This file contains the implementation of the ImageDequeUR class.
+ * @author Info-Dev
+ * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
+ * @date 2011-11-15
+ */
+
#include "imageDequeUR.h"
+// ----------------------------------------------------------------------------------
ImageDequeUR::ImageDequeUR() {
}
+// ----------------------------------------------------------------------------------
ImageDequeUR::~ImageDequeUR() {
}
+// ----------------------------------------------------------------------------------
void ImageDequeUR::AddImagesToURContainer(VTKImageDataPointerType imgUndo,
VTKImageDataPointerType imgRedo, ImageMManager* imMManager) {
}
-
+// ----------------------------------------------------------------------------------
void ImageDequeUR::CleanURContainerFromIndex(const int& index) {
}
-
+// ----------------------------------------------------------------------------------
void ImageDequeUR::ManageMemory() {
}
-
+// ----------------------------------------------------------------------------------
ImageInfoUR* ImageDequeUR::Undo() {
return NULL;
}
+// ----------------------------------------------------------------------------------
ImageInfoUR* ImageDequeUR::Redo() {
return NULL;
}
+// ----------------------------------------------------------------------------------
-/*
- * ImageDeque.h
- *
- * Created on: Sep 22, 2011
- * Author: caceres
+/*!
+ * @file imageDequeUR.h
+ * @brief This file contains the Image3DDequeUR class. -- Abstract class
+ * @author Info-Dev
+ * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
+ * @date 2011-11-15
*/
#ifndef IMAGEDEQUE_H_
#include <iostream>
#include <string>
#include <deque>
-//EED-11/11/2011 comment for windows compilation// #include <unistd.h>
#include <vtkImageData.h>
#include <vtkSmartPointer.h>
#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<ImageInfoUR*> ImageInfoDeque;
+ //typedef definition
+ // ----------------------------------------------------------------------------------
+ /*! @typedef vtkSmartPointer<vtkImageData> VTKImageDataPointerType;
+ * @brief Defines the pointer of vtkImageDate type.
+ */
typedef vtkSmartPointer<vtkImageData> 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_ */
-/*
- * 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;
//Updating status
this->m_OnMemory = true;
}
-
+// ----------------------------------------------------------------------------------
void ImageInfoUR::RemoveImagesFromMemory(const StringType& gPath) {
if (!this->m_OnDisk) {
this->SaveImagesOnDisk(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();
w->SetFileName(filename.c_str());
w->Write();
}
+// ----------------------------------------------------------------------------------
-/*
- * 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_
#include <iostream>
#include <string>
+#include <cstdio>
#include <vtkImageData.h>
#include <vtkMetaImageWriter.h>
#include <vtkMetaImageReader.h>
#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<vtkImageData> VTKImageDataPointerType;
+ * @brief Defines the pointer of vtkImageDate type.
+ */
typedef vtkSmartPointer<vtkImageData> VTKImageDataPointerType;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef vtkSmartPointer<vtkMetaImageReader> VTKMetaImageReaderPointerType;
+ * @brief Defines the pointer of vtkMetaImageReader type.
+ */
typedef vtkSmartPointer<vtkMetaImageReader> VTKMetaImageReaderPointerType;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef vtkSmartPointer<vtkMetaImageWriter> VTKMetaImageWriterPointerType;
+ * @brief Defines the pointer of vtkMetaImageWriter type.
+ */
typedef vtkSmartPointer<vtkMetaImageWriter> 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; //!<This is the undo image.
+ VTKImageDataPointerType m_RedoImage; //!<This is the redo image
+ StringType m_ImageName; //!<This is the base name of the images.
+ ImageMManagerType* m_ImageMManager; //!<This is the modification manager of the images.
+ bool m_OnMemory; //!<This is true if the images are in memory.
+ bool m_OnDisk; //!<This is true if the images are in disk.
};
-/*
- * imageManagement.cxx
- *
- * Created on: Oct 28, 2011
- * Author: caceres
+/*!
+ * @file imageMManager.cxx
+ * @brief This file contains the implementation of the ImageMManager class.
+ * @author Info-Dev
+ * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
+ * @date 2011-11-15
*/
#include "imageModificationManager.h"
+// ----------------------------------------------------------------------------------
ImageMManager::ImageMManager() {
}
+// ----------------------------------------------------------------------------------
ImageMManager::ImageMManager(ImageMManager* manager) {
this->m_RegionStruct = manager->GetModifiedRegion();
}
+// ----------------------------------------------------------------------------------
ImageMManager::~ImageMManager() {
}
-
+// ----------------------------------------------------------------------------------
void ImageMManager::CleanModifiedRegion() {
int min = std::numeric_limits<int>::min();
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) {
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);
}
+// ----------------------------------------------------------------------------------
-/*
- * 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_
#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<int, std::map<int, std::map<int, bool> > > 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_ */
-/*
- * 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();
this->UpdateUndoImage();
}
}
+// ----------------------------------------------------------------------------------
//virtual
void ImageUndoRedo::Redo() {
ImageInfoUR* imageInfo = this->m_ImagesDeque->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);
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();
imgResult->Update();
return (imgResult);
}
-
+// ----------------------------------------------------------------------------------
void ImageUndoRedo::SetCurrentImage(VTKImageDataPointerType img) {
this->m_CurrentImage = img;
}
+// ----------------------------------------------------------------------------------
//virtual
void ImageUndoRedo::DrawUR(ImageInfoUR* imageInfo, const bool& undo) {
VTKImageDataPointerType img;
}
this->m_ImagesDeque->ManageMemory();
}
-
+// ----------------------------------------------------------------------------------
-/*
- * 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_
#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; //!<The manager of the ImagesDeque.
+ VTKImageDataPointerType m_UndoImage; //!< This is the image for undo t(m_CurrentImage - 1).
+ VTKImageDataPointerType m_CurrentImage; //!< This is the current image (The modification image).
};
-/*
- * managerUR.cxx
- *
- * Created on: Sep 26, 2011
- * Author: caceres
+/*!
+ * @file managerUR.cxx
+ * @brief This file contains the ManagerUR class.
+ * @author Info-Dev
+ * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
+ * @date 2011-11-15
*/
#include "managerUR.h"
+// ----------------------------------------------------------------------------------
ManagerUR::ManagerUR() {
}
+// ----------------------------------------------------------------------------------
ManagerUR::~ManagerUR() {
}
-void ManagerUR::SetImage(vtkImageData *image) {
+// ----------------------------------------------------------------------------------
+void ManagerUR::SetImage(VTKImageDataPointerType image) {
}
+// ----------------------------------------------------------------------------------
void ManagerUR::Undo() {
}
+// ----------------------------------------------------------------------------------
void ManagerUR::Redo() {
}
+// ----------------------------------------------------------------------------------
void ManagerUR::SetURImages(ImageMManagerType* imMManager) {
}
-
-void ManagerUR::DrawUR(ImageInfoUR imageInfo, const bool& undo) {
+// ----------------------------------------------------------------------------------
+void ManagerUR::DrawUR(ImageInfoUR* imageInfo, const bool& undo) {
}
+// ----------------------------------------------------------------------------------
-/*
- * managerUR.h
- *
- * Created on: Sep 26, 2011
- * Author: caceres
+/*!
+ * @file managerUR.h
+ * @brief This file contains the ManagerUR class. -- Abstract class
+ * @author Info-Dev
+ * @author Diego CACERES (diego.caceres[AT]creatis.insa-lyon.fr)
+ * @date 2011-11-15
*/
#ifndef MANAGERUR_H_
#include "image3DDequeUR.h"
#include "imageModificationManager.h"
#include "regionStructUR.h"
+#include "imageInfoUR.h"
+/*! @class ManagerUR managerUR.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.
+ */
class ManagerUR {
public:
- typedef Image3DDequeUR IDequeType;
+ //typedef definition
+ // ----------------------------------------------------------------------------------
+ /*! @typedef RegionStructUR RegionSType;
+ * @brief Redefines the ImageMManagerType.
+ */
typedef RegionStructUR RegionSType;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef ImageMManager ImageMManagerType;
+ * @brief Redefines the ImageMManager type.
+ */
typedef ImageMManager ImageMManagerType;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef vtkSmartPointer<vtkImageData> VTKImageDataPointerType;
+ * @brief Defines the pointer of vtkImageDate type.
+ */
typedef vtkSmartPointer<vtkImageData> VTKImageDataPointerType;
+ // ----------------------------------------------------------------------------------
+ /*! @typedef vtkSmartPointer<vtkExtractVOI> VTKExtractVOIPointerType;
+ * @brief Defines the pointer of vtkExtractVOI type.
+ */
typedef vtkSmartPointer<vtkExtractVOI> 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_ */
-/*
- * 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_ */