]> Creatis software - creaMaracasVisu.git/commitdiff
DFCH
authorDiego Caceres <Diego.Caceres@creatis.insa-lyon.fr>
Mon, 7 Nov 2011 11:40:19 +0000 (11:40 +0000)
committerDiego Caceres <Diego.Caceres@creatis.insa-lyon.fr>
Mon, 7 Nov 2011 11:40:19 +0000 (11:40 +0000)
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/image3DDequeUR.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageDequeUR.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx

index 93efb5bd6752b03e74448dfa1a8f781ed1c6b69f..d24c809cd3da16102cb71b97bdcad5167331c336 100755 (executable)
@@ -9,7 +9,7 @@ Image3DDequeUR::Image3DDequeUR() {
 }
 //virtual
 Image3DDequeUR::~Image3DDequeUR() {
-
+       this->CleanHardDisk();
 }
 //virtual
 void Image3DDequeUR::AddImageToUndoContainer(VTKImageDataPointerType img,
@@ -95,6 +95,12 @@ void Image3DDequeUR::SetGlobalPath(const StringType& globalPath) {
        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);
 }
index cdcdefb7ee7ee61abd2cd6a42f7a1dfbb9a4fbf0..dd861b2f998981342378675e0a09fa161000e719 100755 (executable)
@@ -18,6 +18,7 @@ public:
        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,
index a20630aa8d844ef1a7fefc0d38179b7807a736b0..b7b852267fd0833b8e1f4da4458b9be44105a8b4 100755 (executable)
@@ -11,6 +11,7 @@
 #include <iostream>
 #include <string>
 #include <deque>
+#include <unistd.h>
 #include <vtkImageData.h>
 #include <vtkSmartPointer.h>
 #include "imageInfoUR.h"
index d788dbc06ebc9d5aea9963ba9b8b546a9be2dea8..263bce86e31e90fed1592bef4f245f485f92bedb 100755 (executable)
@@ -59,6 +59,8 @@ void ImageInfoUR::LoadImageMHDToMemory(const StringType& gPath) {
 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);
@@ -68,5 +70,8 @@ void ImageInfoUR::SaveImageAsMHD(const StringType& gPath) {
 }
 
 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());
 }