}
//virtual
Image3DDequeUR::~Image3DDequeUR() {
-
+ this->CleanHardDisk();
}
//virtual
void Image3DDequeUR::AddImageToUndoContainer(VTKImageDataPointerType img,
this->m_GlobalPath = globalPath;
}
+void Image3DDequeUR::CleanHardDisk() {
+ for (unsigned int i = 0; i < this->m_ImgUndoDeque.size(); i++) {
+ this->m_ImgUndoDeque[i]->RemoveImageFromDisk(this->m_GlobalPath);
+ }
+}
+
Image3DDequeUR::StringType Image3DDequeUR::GetGlobalPath() {
return (this->m_GlobalPath);
}
void SetGlobalPath(const StringType& globalPath);
StringType GetGlobalPath();
StringType GetImageName(const int & pos, const bool& undo);
+ void CleanHardDisk();
virtual void AddImageToUndoContainer(VTKImageDataPointerType img,
ImageMManagerType* imMManager);
virtual void AddImageToRedoContainer(VTKImageDataPointerType img,
#include <iostream>
#include <string>
#include <deque>
+#include <unistd.h>
#include <vtkImageData.h>
#include <vtkSmartPointer.h>
#include "imageInfoUR.h"
void ImageInfoUR::SaveImageAsMHD(const StringType& gPath) {
this->m_OnDisk = true;
StringType filename = gPath + this->m_ImageName;
+ //managing temporary files
+ mkstemp((char*) filename.c_str());
VTKMetaImageWriterPointerType w = VTKMetaImageWriterPointerType::New();
w->SetInput(this->m_Image);
w->SetCompression(false);
}
void ImageInfoUR::RemoveImageFromDisk(const StringType& gPath) {
-
+ std::cout << "Borrando archivo" << endl;
+ StringType filename = gPath + this->m_ImageName;
+ std::cout << filename << std::endl;
+ unlink((char*) filename.c_str());
}