]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx
DFCH: imageUndoRedo beta1 (Undo Working - problems saving to disk)
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / imageUndoRedo / imageUndoRedo.cxx
index 8864148e34df0ea8c7962e50bd881635c88a5776..55a4e1f24b9fc907f100e6396a65247d05ab75f2 100755 (executable)
@@ -19,7 +19,7 @@ void ImageUndoRedo::Undo() {
        ImageInfoUR* imageInfo = this->m_ImagesDeque->Undo();
        if (imageInfo != NULL)
        {
-               this->SetRedoImage(imageInfo->GetRegion());
+               //this->SetRedoImage(imageInfo->GetRegion());
                this->DrawUR(imageInfo);
        }
 }
@@ -68,18 +68,21 @@ void ImageUndoRedo::SetCurrentImage(VTKImageDataPointerType img) {
 //virtual
 void ImageUndoRedo::DrawUR(ImageInfoUR* imageInfo) {
        VTKImageDataPointerType img = imageInfo->GetImage();
-       for (int i = imageInfo->GetRegion().minX, x = 0;
-                       i <= imageInfo->GetRegion().maxX; i++, x++) {
-               for (int j = imageInfo->GetRegion().minY, y = 0;
-                               j <= imageInfo->GetRegion().maxY; j++, y++) {
-                       for (int k = imageInfo->GetRegion().minZ, z = 0;
-                                       k <= imageInfo->GetRegion().maxZ; k++, z++) {
-                               float value = img->GetScalarComponentAsFloat(i, j, k, 0);
-                               this->m_CurrentImage->SetScalarComponentFromFloat(i, j, k, 0,
-                                               value);
+       if( img != NULL )
+       {
+               for (int i = imageInfo->GetRegion().minX, x = 0;
+                               i <= imageInfo->GetRegion().maxX; i++, x++) {
+                       for (int j = imageInfo->GetRegion().minY, y = 0;
+                                       j <= imageInfo->GetRegion().maxY; j++, y++) {
+                               for (int k = imageInfo->GetRegion().minZ, z = 0;
+                                               k <= imageInfo->GetRegion().maxZ; k++, z++) {
+                                       float value = img->GetScalarComponentAsFloat(i, j, k, 0);
+                                       this->m_CurrentImage->SetScalarComponentFromFloat(i, j, k, 0,
+                                                       value);
+                               } //rof
                        } //rof
                } //rof
-       } //rof
-       this->m_CurrentImage->Modified();
+               this->m_CurrentImage->Modified();
+       }
 }