]> Creatis software - creaMaracasVisu.git/commitdiff
#3351 creaMaracas Visu Bug New Normal - Refresh ViewerNV
authorEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Tue, 28 Jan 2020 11:35:31 +0000 (12:35 +0100)
committerEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Tue, 28 Jan 2020 11:35:31 +0000 (12:35 +0100)
bbtk/src/bbmaracasvisuViewerNV.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h

index 262107d1ba0ee8f63f44fd481b6970533d8d7e64..b5a0e89b00cb363ad9a646e09566cb2ea983f9c2 100644 (file)
@@ -94,7 +94,7 @@ void ViewerNV::Process()
                }else if (img != _currentimg){
                        _mwxwidget->SetImage(img);
                }
-               _mwxwidget->RefreshView();
+//             _mwxwidget->RefreshView();
                _currenttype    = type;
                _currentimg     = img;
                _point.clear();
@@ -135,7 +135,6 @@ void ViewerNV::Process()
                        }
                }
                _mwxwidget->SetInterpolate( bbGetInputInterpolate() );
-
 /* Borrame
                if (wvbv1!=NULL) 
                {
@@ -149,10 +148,6 @@ void ViewerNV::Process()
                }
 
 */
-
-
-
-
        }//  mwxwidget != NULL
 }
 
@@ -213,29 +208,32 @@ void ViewerNV::bbUserFinalizeProcessing()
 
 //-----------------------------------------------------------------
 
-
-
-bool ViewerNV::compareVectors(std::vector<int> type,std::vector<int> currenttype){
-
+bool ViewerNV::compareVectors(std::vector<int> type,std::vector<int> currenttype)
+{
        bool ret = true;
-
-       if(type.size()==currenttype.size()){
-               for(int i = 0; i < (int)(type.size()) && ret; i++){
-                       if(type[i]!=currenttype[i]){
+       if(type.size()==currenttype.size())
+       {
+               for(int i = 0; i < (int)(type.size()) && ret; i++)
+               {
+                       if(type[i]!=currenttype[i])
+                       {
                                ret = false;
-                       }
-               }
+                       } // if
+               } // for
        }else{
                ret=false;
-       }
+       } // type size
        return ret;
 }
 
-void ViewerNV::updateObservers(){
+void ViewerNV::updateObservers()
+{
        vtkRenderWindowInteractor* interactor;
        interactor = bbGetOutputInteractor1();
-       if(interactor){
-               if (bbGetInputObs1()!=NULL){
+       if(interactor)
+       {
+               if (bbGetInputObs1()!=NULL)
+               {
                  bbGetInputObs1()->SetInteractor(interactor);
                  bbGetInputObs1()->EnabledOn();
                }
@@ -259,7 +257,7 @@ void ViewerNV::updateObservers(){
                  bbGetInputObs5()->SetInteractor(interactor);
                  bbGetInputObs5()->EnabledOn();
                }
-       }
+       } // if interactor
 }
 
 }
index cb1dc1e54e6b971f4456fed694c69f6fe4cc45e0..189bdfaeac5523108b4271a7e1a01a9310ede443 100644 (file)
@@ -48,27 +48,27 @@ vtkMPR3DDataViewer::vtkMPR3DDataViewer()
 //-------------------------------------------------------------------
 vtkMPR3DDataViewer::~vtkMPR3DDataViewer()
 {
-       if(_outlineData) {_outlineData-> Delete();}
-       if(_mapOutline)  {_mapOutline-> Delete();}
-       if(_outline)     {_outline-> Delete();}
-
-//     if (_bwLut)                             _bwLut->Delete();
-//     if (_hueLut)                    _hueLut->Delete();
-//     if (_satLut)                    _satLut->Delete();
-       if (_ctfun)                             _ctfun->Delete();
-       if (_saggitalColors)    _saggitalColors ->Delete();
-       if (_saggital)                  _saggital->Delete();
-       if (_axialColors)               _axialColors->Delete();
-       if (_axial)                             _axial->Delete();
-       if (_coronalColors)             _coronalColors->Delete();
-       if (_coronal)                   _coronal->Delete();
-
+       if(_outlineData)                {_outlineData           -> Delete();}
+       if(_mapOutline)                 {_mapOutline            -> Delete();}
+       if(_outline)                    {_outline                       -> Delete();}
+//     if (_bwLut)                             {_bwLut                         -> Delete();}
+//     if (_hueLut)                    {_hueLut                        -> Delete();}
+//     if (_satLut)                    {_satLut                        -> Delete();}
+       if (_ctfun)                             {_ctfun                         -> Delete();}
+       if (_saggitalColors)    {_saggitalColors        -> Delete();}
+       if (_saggital)                  {_saggital                      -> Delete();}
+       if (_axialColors)               {_axialColors           -> Delete();}
+       if (_axial)                             {_axial                         -> Delete();}
+       if (_coronalColors)             {_coronalColors         -> Delete();}
+       if (_coronal)                   {_coronal                       -> Delete();}
 }
+
 //-------------------------------------------------------------------
 vtkActor* vtkMPR3DDataViewer::GetOutlineActor()
 {
        return _outline;
 }
+
 //-------------------------------------------------------------------
 vtkImageActor* vtkMPR3DDataViewer::GetImageActor(int id)
 {
@@ -143,18 +143,25 @@ void vtkMPR3DDataViewer::SetImage()
 {
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
-       _saggitalColors ->SetInput( _vtkmprbasedata->GetImageData() );
-       _axialColors    ->SetInput( _vtkmprbasedata->GetImageData() );
-       _coronalColors  ->SetInput( _vtkmprbasedata->GetImageData() );
-       _outlineData    ->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() );
+       _saggitalColors -> SetInput( _vtkmprbasedata->GetImageData() );
+       _axialColors    -> SetInput( _vtkmprbasedata->GetImageData() );
+       _coronalColors  -> SetInput( _vtkmprbasedata->GetImageData() );
+       _outlineData    -> SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() );
 #else
-       _saggitalColors ->SetInputData( _vtkmprbasedata->GetImageData() );
-       _axialColors    ->SetInputData( _vtkmprbasedata->GetImageData() );
-       _coronalColors  ->SetInputData( _vtkmprbasedata->GetImageData() );
-       _outlineData    ->SetInputData((vtkDataSet *) _vtkmprbasedata->GetImageData() );
+       _saggitalColors -> SetInputData( _vtkmprbasedata->GetImageData() );
+       _axialColors    -> SetInputData( _vtkmprbasedata->GetImageData() );
+       _coronalColors  -> SetInputData( _vtkmprbasedata->GetImageData() );
+
+//EED 2020-01-27  this is to slow ??? how can we accelerated
+//     _saggitalColors -> Update();
+//     _axialColors    -> Update();
+//     _coronalColors  -> Update();
+
+       _outlineData    -> SetInputData((vtkDataSet *) _vtkmprbasedata->GetImageData() );
 #endif
 }
 
+
 //-------------------------------------------------------------------
 void vtkMPR3DDataViewer::Configure()
 {
index 38c2a0fbb635d34b6e896401c8403a268d28084e..bdd59c28b457de0254f54633991adb2932f7f098 100644 (file)
@@ -61,35 +61,27 @@ public:
        void                                            SetPositionZ(int pos);
        void                                            SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
        vtkMPRBaseData*                         GetVtkMPRBaseData();
-       
        vtkColorTransferFunction        *GetvtkColorTransferFunction();
        std::vector<double >            *GetctFunVectorPoint();
        std::vector<double >            *GetctFunVectorRed();
        std::vector<double >            *GetctFunVectorGreen();
        std::vector<double >            *GetctFunVectorBlue();
-
        void setColorTransferFunction(vtkColorTransferFunction* colortable);
-
 private:
-       
        bool                                            _visiblePosition[3];
-
        // outline
        vtkOutlineFilter                        *_outlineData;
        vtkPolyDataMapper                       *_mapOutline;
        vtkActor                                        *_outline;
-
        //
        vtkColorTransferFunction        *_ctfun;
        std::vector<double>                     _ctFunVectorPoint;
        std::vector<double>                     _ctFunVectorRed;
        std::vector<double>                     _ctFunVectorGreen;
        std::vector<double>                     _ctFunVectorBlue;
-
 //     vtkLookupTable                          *_bwLut;
 //     vtkLookupTable                          *_hueLut;
 //     vtkLookupTable                          *_satLut;
-
        vtkImageMapToColors                     *_saggitalColors;
        vtkImageActor                           *_saggital;
        vtkImageMapToColors                     *_axialColors;
@@ -97,8 +89,6 @@ private:
        vtkImageMapToColors                     *_coronalColors;
        vtkImageActor                           *_coronal;
        vtkMPRBaseData                          *_vtkmprbasedata;
-
-
 };
 
 #endif /*VTKMPR3DDATAVIEWER_H_*/
index b1cdee3530e10b67257efff1588725c7c55fb819..b8aac4632ca32d93ad410ede07033416673dbe5e 100644 (file)
@@ -446,14 +446,14 @@ void wxMaracas_ViewerWidget::SetImage( vtkImageData *image )
        {
                mwxsphereview->SetImage();
        }
-       if (mwxvtkclipping3Dview!=NULL)
-       {
-               mwxvtkclipping3Dview->GetVtkClipping3DDataViewer()->SetImage();
-       }               
        if (mwxvtkmpr3Dview!=NULL)
        {
                mwxvtkmpr3Dview->SetImage();
        }
+       if (mwxvtkclipping3Dview!=NULL)
+       {
+               mwxvtkclipping3Dview->GetVtkClipping3DDataViewer()->SetImage();
+       }               
                
 //EED 26/11/2009
 //             ConfigureVTK();
index ff657c29a3f3435aa181c765e04677aa938bcfd4..153716271ed9f8a15423575f909d58e069d77a6e 100644 (file)
@@ -330,9 +330,35 @@ void wxVtkMPR3DView::SetImage()
        // -- Plane widget
        _probe->SetSource( imageData );
 #else
+
+
+       double colorWindow      = _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorWindow();
+       double colorLevel       = _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorLevel();
+
+       double spc[3];
+       vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
+       if(image)
+       {
+               image->GetSpacing(spc);
+       }else{
+               spc[0] = 0;
+               spc[1] = 0;
+               spc[2] = 0;
+       }
+       double x = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetX();
+       double y = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY();
+       double z = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ();
+
        _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);
+       _planeWidgetZ->SetSlicePosition( z*spc[2] );
+
        // -- Plane widget
        _probe->SetSourceData( imageData );
 #endif
@@ -342,9 +368,8 @@ void wxVtkMPR3DView::SetImage()
 //-------------------------------------------------------------------
 vtkImagePlaneWidget* wxVtkMPR3DView::GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker)
 {
-       vtkProperty* prop1                                      = 0;
-       vtkImagePlaneWidget* planeWidget        = 0;
-       planeWidget                                                     = vtkImagePlaneWidget::New();
+       vtkProperty* prop1                                      = NULL;
+       vtkImagePlaneWidget* planeWidget        = vtkImagePlaneWidget::New();
        planeWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() );
        planeWidget->EnabledOff();
        vtkImageData *image                                     = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
@@ -486,7 +511,6 @@ void wxVtkMPR3DView::RefreshView()   // virtual
 {
        double spc[3];
        vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
-
        if(image)
        {
                image->GetSpacing(spc);
@@ -505,9 +529,6 @@ void wxVtkMPR3DView::RefreshView()   // virtual
        double y = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY();
        double z = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ();
 
-       SetColorWindow( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorWindow() );
-       SetColorLevel( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorLevel() );
-
        double normal[3];
        // FreePlaneX
        _planeWidgetX->GetNormal(normal);
@@ -536,7 +557,7 @@ void wxVtkMPR3DView::RefreshView()   // virtual
                _planeWidgetZ->GetReslice()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
                _planeWidgetZ->GetTexture()->SetInterpolate( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetInterpolate() );
        }
-               
+
        x=x*spc[0];
        y=y*spc[1];
        z=z*spc[2];
@@ -598,7 +619,8 @@ wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview() throw (char*)
 //-------------------------------------------------------------------
 
 //-------------------------------------------------------------------
-void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){
+void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible)
+{
        /*if(visible == false)
                printf("CPR: wxVtkMPR3DView::VisibleImageActor-> visibleActor == false \n");
        else
@@ -608,7 +630,8 @@ void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){
        }
        */
        if (visible!=_vtkmpr3Ddataviewer->GetVisiblePosition(idPosition)){
-               if (visible==false){
+               if (visible==false)
+               {
                        _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition)  );
                } else {
 //EED 21/07/2013
@@ -707,18 +730,13 @@ void wxVtkMPR3DView::InitOrientationPointWidget()
 }
 
 //-------------------------------------------------------------------
-void wxVtkMPR3DView::SetColorWindow(double colorWindow)
+void wxVtkMPR3DView::SetWindowColorLevel(double colorWindow , double colorLevel)
 {
-       double colorLevel = _planeWidgetX->GetLevel();
        _planeWidgetX->SetWindowLevel(colorWindow,colorLevel);
+       _planeWidgetY->SetWindowLevel(colorWindow,colorLevel);
+       _planeWidgetZ->SetWindowLevel(colorWindow,colorLevel);
 }
 
-//-------------------------------------------------------------------
-void wxVtkMPR3DView::SetColorLevel(double colorLevel)
-{
-       double colorWindow = _planeWidgetX->GetWindow();
-       _planeWidgetX->SetWindowLevel(colorWindow,colorLevel);
-}
 
 //-------------------------------------------------------------------
 // EED 25 Janvier 2007 testLoic
index 5ab97aab8a567c76b03aa70a38567a5e3eb85f70..4eb27ee95e0c8ce3dcdaf4ee46c236fbd9332a67 100644 (file)
@@ -70,13 +70,16 @@ public:
 
        //Free planes
        //-------------------------------------------------------------------
-       void ConfigureFreePlanes();
-       vtkImagePlaneWidget* GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker);
-       void FreePlaneVisible(int plane, bool ok);
-       void FreePlaneInteraction(bool ok);
-       void SetFreePlanesOrtho();
-       void SetColorWindow(double colorWindow);
-       void SetColorLevel(double colorLevel);
+       void                                    ConfigureFreePlanes();
+       vtkImagePlaneWidget*    GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker);
+       void                                    FreePlaneVisible(int plane, bool ok);
+       void                                    FreePlaneInteraction(bool ok);
+       void                                    SetFreePlanesOrtho();
+/*Borrame
+       void                                    SetColorWindow(double colorWindow);
+       void                                    SetColorLevel(double colorLevel);
+*/
+       void                                    SetWindowColorLevel(double colorWindow , double colorLevel);
 
 private:
        wxVtk3DBaseView                                 *_wxvtk3Dbaseview;