]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx
#3474 Refresh optimization DrawAxisTree3D Box
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxVtkMPR3DView.cxx
index 97f4faddad7b6ed23a2900a44470d55bbdbf48b1..23b6ce1ad4b199dde4a41aa3525362bc8b08d38b 100644 (file)
@@ -41,6 +41,7 @@
 #include "vtkCellPicker.h"
 #include "vtkInteractorStyleBaseView.h"
 #include <vtkImageReslice.h>
+#include "vtkTexture.h"
 
 
 
@@ -332,8 +333,8 @@ void wxVtkMPR3DView::SetImage()
 #else
 
 
-       double colorWindow      = _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorWindow();
-       double colorLevel       = _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorLevel();
+//     double colorWindow      = _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorWindow();
+//     double colorLevel       = _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorLevel();
 
        double spc[3];
        vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
@@ -349,16 +350,44 @@ void wxVtkMPR3DView::SetImage()
        double y = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY();
        double z = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ();
 
+
+/*
+       if (mchange==NULL)
+       {
+               mchange = vtkImageChangeInformation::New();
+               mchange->SetInputData( imageData );
+               mchange->Modified();    //important
+               mchange->Update();    //important
+               _planeWidgetX->SetInputData( mchange->GetOutput() );
+               _planeWidgetY->SetInputData( mchange->GetOutput() );
+               _planeWidgetZ->SetInputData( mchange->GetOutput() );
+       } else {
+               mchange->SetInputData( imageData );
+               mchange->Modified();    //important
+               mchange->Update();    //important
+       }
+       
+*/
+
+
+
+
        _planeWidgetX->SetInputData( imageData );
-       _planeWidgetX->SetWindowLevel(colorWindow,colorLevel,1);
-       _planeWidgetX->SetSlicePosition( x*spc[0] );
        _planeWidgetY->SetInputData( imageData );
-       _planeWidgetY->SetWindowLevel(colorWindow,colorLevel,1);
-       _planeWidgetY->SetSlicePosition( y*spc[1] );
        _planeWidgetZ->SetInputData( imageData );
-       _planeWidgetZ->SetWindowLevel(colorWindow,colorLevel,1);
+//EED 2021-06-23       
+//     _planeWidgetX->SetWindowLevel(colorLevel,colorWindow,1);
+//     _planeWidgetY->SetWindowLevel(colorLevel,colorWindow,1);
+//     _planeWidgetY->SetWindowLevel(colorLevel,colorWindow,1);
+       _planeWidgetX->SetSlicePosition( x*spc[0] );
+       _planeWidgetY->SetSlicePosition( y*spc[1] );
        _planeWidgetZ->SetSlicePosition( z*spc[2] );
 
+       _planeWidgetX->GetTexture()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
+       _planeWidgetY->GetTexture()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
+       _planeWidgetZ->GetTexture()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
+
+
        // -- Plane widget
        _probe->SetSourceData( imageData );
 #endif
@@ -534,7 +563,7 @@ void wxVtkMPR3DView::RefreshView()   // virtual
        {
                _planeWidgetX->SetSlicePosition( x*spc[0] );
 //EED 2016/02/19
-//             _planeWidgetX->GetReslice()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
+               _planeWidgetX->GetReslice()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
                _planeWidgetX->GetTexture()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
        }
        // FreePlaneY
@@ -555,9 +584,9 @@ void wxVtkMPR3DView::RefreshView()   // virtual
                _planeWidgetZ->GetReslice()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
                _planeWidgetZ->GetTexture()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
        }
-
+    
        SetWindowColorLevel(_vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorWindow() , _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorLevel() );
-
+    
        x = x*spc[0];
        y = y*spc[1];
        z = z*spc[2];
@@ -587,7 +616,7 @@ void wxVtkMPR3DView::RefreshView()   // virtual
 #else
                _probe->Update();
 #endif
-       }
+       } //_pointWidget
 
        if (_wxvtkmpr3DviewCntrlPanel!=NULL)
        {
@@ -867,13 +896,13 @@ void wxVtkMPR3DView::TestLoic1()
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
        _3DSliceMapper->SetInput(change->GetOutput( ) );
+       _3DSliceMapper->ImmediateModeRenderingOn( );
 #else
        _3DSliceMapper->SetInputData(change->GetOutput( ) );
 #endif
 
        _3DSliceMapper->SetLookupTable( _bwlookup );
        _3DSliceMapper->SetScalarRange( _range );
-       _3DSliceMapper->ImmediateModeRenderingOn( );
 
        vtkActor *_3DSliceActor = vtkActor::New( );
        _3DSliceActor->SetMapper( _3DSliceMapper );