X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxVtkMPR3DView.cxx;h=1d9ff304bb673656854c3d459791030b54ee880f;hb=3283472f764535492122c3b2ade020a749c1bd2a;hp=378dadec80206f992eda9fbe9c3a01ebb9a64f70;hpb=439cc05f12e61d0ba090ec0c2ba8701d382238d7;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index 378dade..1d9ff30 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -343,6 +343,20 @@ void wxVtkMPR3DView::ConfigureFreePlanes() _planeWidgetZ->AddObserver(vtkCommand::InteractionEvent, wlipwc ); } + +//------------------------------------------------------------------- +void wxVtkMPR3DView::SetImage() +{ + vtkImageData *imageData = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); + // Orthogonal planes B&W + _planeWidgetX->SetInput( imageData ); + _planeWidgetY->SetInput( imageData ); + _planeWidgetZ->SetInput( imageData ); + // -- Plane widget + _probe->SetSource( imageData ); + _vtkmpr3Ddataviewer->SetImage(); +} + //------------------------------------------------------------------- vtkImagePlaneWidget* wxVtkMPR3DView::GetPlaneWidget(unsigned char activationkey, double r, double g, double b, vtkCellPicker* picker) { @@ -390,9 +404,6 @@ vtkImagePlaneWidget* wxVtkMPR3DView::GetPlaneWidget(unsigned char activationkey, //------------------------------------------------------------------- void wxVtkMPR3DView::SetFreePlanesOrtho() { - - - _planeWidgetX->SetPlaneOrientationToXAxes(); _planeWidgetY->SetPlaneOrientationToYAxes(); _planeWidgetZ->SetPlaneOrientationToZAxes(); @@ -406,8 +417,8 @@ void wxVtkMPR3DView::FreePlaneVisible(int plane, bool ok) { if(_planeWidgetX) { - if (ok==true) - { + if (ok==true) + { //EED 21/07/2013 // 1. Make backup of actors // 2. Putting out all the actors @@ -416,9 +427,9 @@ void wxVtkMPR3DView::FreePlaneVisible(int plane, bool ok) // 5. Refresh // step 1, step 2 - vtkActorCollection *tmpCollection = vtkActorCollection::New(); + vtkActorCollection *tmpCollection = vtkActorCollection::New(); vtkActorCollection *collectionActors = _wxvtk3Dbaseview->GetRenderer()->GetActors(); - int i,size=collectionActors->GetNumberOfItems(); + int i,size=collectionActors->GetNumberOfItems(); for (i=0; iAddItem ( (vtkActor*)collectionActors->GetItemAsObject(0) ); @@ -439,7 +450,7 @@ void wxVtkMPR3DView::FreePlaneVisible(int plane, bool ok) // step 5 Refresh _wxvtk3Dbaseview->GetRenderer()->GetRenderWindow()->Render(); - } // if ok + } // if ok if ((plane==1) && (ok==false)) _planeWidgetX->EnabledOff(); if ((plane==2) && (ok==false)) _planeWidgetY->EnabledOff(); if ((plane==3) && (ok==false)) _planeWidgetZ->EnabledOff(); @@ -480,7 +491,6 @@ void wxVtkMPR3DView::Refresh() // virtual { _wxvtkmpr3DviewCntrlPanel->Refresh(); } - } //------------------------------------------------------------------- @@ -489,14 +499,17 @@ void wxVtkMPR3DView::RefreshView() // virtual double spc[3]; vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); - if(image){ + if(image) + { image->GetSpacing(spc); }else{ spc[0] = 0; spc[1] = 0; spc[2] = 0; } - //this->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData()->GetSpacing(spc); + +// GetVtkMPR3DDataViewer()->Configure(); + //double nx=1,ny=0,nz=0; // JPRx Refresh(); @@ -507,7 +520,6 @@ void wxVtkMPR3DView::RefreshView() // virtual SetColorWindow( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorWindow() ); SetColorLevel( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorLevel() ); - double normal[3]; // FreePlaneX _planeWidgetX->GetNormal(normal); @@ -541,7 +553,11 @@ void wxVtkMPR3DView::RefreshView() // virtual y=y*spc[1]; z=z*spc[2]; - if(_pointWidget){ + if(_pointWidget) + { + _pointWidget->SetInput( image ); + _pointWidget->PlaceWidget(); + _pointWidget->SetPosition( x,y,z ); double in[3]; double normal[3]; @@ -553,6 +569,11 @@ void wxVtkMPR3DView::RefreshView() // virtual _planeWidget->UpdatePlacement(); _planeWidget->GetPolyData(_vtkplane); } + + if (_wxvtkmpr3DviewCntrlPanel!=NULL) + { + _wxvtkmpr3DviewCntrlPanel->UpdateControlPanel(false); + } // if _wxvtkmpr3DviewCntrlPanel } //------------------------------------------------------------------- @@ -609,7 +630,6 @@ void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){ int i,size=collectionActors->GetNumberOfItems(); for (i=0; iAddItem ( (vtkActor*)collectionActors->GetItemAsObject(0) ); _wxvtk3Dbaseview->GetRenderer()->RemoveActor( (vtkProp*)tmpCollection->GetItemAsObject(i) ); } // for