]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageUndoRedo.cxx
#3335 creaMaracasVisu Feature New Normal - Manual Paint Model Undo Redo from box
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / imageUndoRedo / imageUndoRedo.cxx
index 0054735ef663557ac7b0a5d08e49407a7522486c..cba183cac36e253477109ac70bcdc0734dc50be8 100755 (executable)
 #include "imageUndoRedo.h"
 
 // ----------------------------------------------------------------------------------
-ImageUndoRedo::ImageUndoRedo( )
+ImageUndoRedo::ImageUndoRedo()
 {
        this->m_ImagesDeque = new IDequeType( );
 }
+
 // ----------------------------------------------------------------------------------
 //virtual
 ImageUndoRedo::~ImageUndoRedo( )
 {
-
 }
+
 // ----------------------------------------------------------------------------------
 //virtual
 void ImageUndoRedo::Undo( )
 {
-printf("EED ImageUndoRedo::Undo Start\n");
        ImageInfoUR* imageInfo = this->m_ImagesDeque->Undo( );
        if( imageInfo != NULL)
        {
                this->DrawUR( imageInfo, true );
                this->UpdateUndoImage( );
        } //if  imageInfo
-printf("EED ImageUndoRedo::Undo End\n");
-
 }
 // ----------------------------------------------------------------------------------
 //virtual
@@ -73,7 +71,6 @@ void ImageUndoRedo::Redo( )
 void ImageUndoRedo::SetImage( VTKImageDataPointerType image )
 {
        this->m_CurrentImage = image;
-
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
        this->m_CurrentImage->Update( );
@@ -123,12 +120,8 @@ void ImageUndoRedo::UpdateUndoImage( )
 // ----------------------------------------------------------------------------------
 ImageUndoRedo::VTKImageDataPointerType ImageUndoRedo::GetImageRegion( const RegionSType& region, VTKImageDataPointerType img )
 {
-printf("EED ImageUndoRedo::GetImageRegion Start\n");
        VTKExtractVOIPointerType extract = VTKExtractVOIPointerType::New( );
        extract->SetVOI( region.minX, region.maxX, region.minY, region.maxY,region.minZ, region.maxZ );
-
-printf("EED ImageUndoRedo::GetImageRegion region %d %d   %d %d   %d %d\n", region.minX, region.maxX, region.minY, region.maxY,region.minZ, region.maxZ );
-
        extract->SetSampleRate( 1, 1, 1 );
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
@@ -138,15 +131,12 @@ printf("EED ImageUndoRedo::GetImageRegion region %d %d   %d %d   %d %d\n", regio
        extract->Update();
 #endif
        VTKImageDataPointerType imgResult = extract->GetOutput( );
-
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
        imgResult->Update( );
 #else
        imgResult->Modified( );
 #endif
-
-printf("EED ImageUndoRedo::GetImageRegion End\n");
        return ( imgResult );
 }
 // ----------------------------------------------------------------------------------
@@ -158,7 +148,6 @@ void ImageUndoRedo::SetCurrentImage( VTKImageDataPointerType img )
 //virtual
 void ImageUndoRedo::DrawUR( ImageInfoUR* imageInfo, const bool& undo )
 {
-printf("EED ImageUndoRedo::DrawUR Start\n");
        VTKImageDataPointerType img;
        if( undo )
        {
@@ -166,14 +155,14 @@ printf("EED ImageUndoRedo::DrawUR Start\n");
        } else {
                img = imageInfo->GetRedoImage( );
        } //else
-       RegionSType region = imageInfo->GetImageMManager( )->GetModifiedRegion( );
+       RegionSType region                      = imageInfo->GetImageMManager()->GetModifiedRegion();
+       m_RestorBaseInitialPointX       = imageInfo->GetImageMManager()->GetBaseInitialPointX();
+       m_RestorBaseInitialPointY       = imageInfo->GetImageMManager()->GetBaseInitialPointY();
+       m_RestorBaseInitialPointZ       = imageInfo->GetImageMManager()->GetBaseInitialPointZ();
+
        if( img != NULL)
        {
-               int *dim                        = img->GetDimensions( );
-printf("EED ImageUndoRedo::DrawUR dim = %d %d %d\n", dim[0],dim[1],dim[2]);
-               int ext[6]; img->GetExtent( ext );
-printf("EED ImageUndoRedo::DrawUR ext = %d %d   %d %d    %d %d\n", ext[0],ext[1],ext[2],ext[3],ext[4],ext[5] );
-       
+               int *dim                        = img->GetDimensions( );        
                int sizeXImageIn        = dim[ 0 ];
                size_t linesize         = sizeXImageIn * sizeof(unsigned short);
                for( int j = region.minY, y = 0; j <= region.maxY; j++, y++ )
@@ -188,6 +177,21 @@ printf("EED ImageUndoRedo::DrawUR ext = %d %d   %d %d    %d %d\n", ext[0],ext[1]
                this->m_CurrentImage->Modified( );
        } // if img
        this->m_ImagesDeque->ManageMemory( );
-printf("EED ImageUndoRedo::DrawUR End\n");
 }
 // ----------------------------------------------------------------------------------
+
+int ImageUndoRedo::GetRestorBaseInitialPointX() 
+{
+       return  m_RestorBaseInitialPointX;
+}
+
+int ImageUndoRedo::GetRestorBaseInitialPointY() 
+{
+       return  m_RestorBaseInitialPointY;
+}
+
+int ImageUndoRedo::GetRestorBaseInitialPointZ() 
+{
+       return  m_RestorBaseInitialPointZ;
+}
+