From: Eduardo DAVILA Date: Thu, 25 Jul 2013 14:26:23 +0000 (+0200) Subject: Comments X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4ebf92429cae4c60761aa8798a5135c7512d83bc;p=creaMaracasVisu.git Comments --- diff --git a/bbtk/src/bbmaracasvisuShowNPoints.cxx b/bbtk/src/bbmaracasvisuShowNPoints.cxx index 764e2a9..b33daa4 100644 --- a/bbtk/src/bbmaracasvisuShowNPoints.cxx +++ b/bbtk/src/bbmaracasvisuShowNPoints.cxx @@ -164,6 +164,7 @@ WidgetShowNPoints::~WidgetShowNPoints() { } +//------------------------------------------------------------------------ void WidgetShowNPoints::SetRadio(double radio) { this->mradio=radio; @@ -212,7 +213,7 @@ void WidgetShowNPoints::SetOpacity(double opacity) { this->mopacity=opacity; //NTU: For Slider - sdrOpacity->SetValue(this->mopacity/100.0); + sdrOpacity->SetValue(this->mopacity*100.0); } //------------------------------------------------------------------------ @@ -632,12 +633,15 @@ void WidgetShowNPoints::UpdatePoints(wxCommandEvent &event) } //NTU: For updating - SetOutputBox(); +//EED SetOutputBox(); + renderer->GetRenderWindow()->Render(); + } BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ShowNPoints) BBTK_BLACK_BOX_IMPLEMENTATION(ShowNPoints,bbtk::WxBlackBox); +//----------------------------------------------------------------- void ShowNPoints::Process() { if (mwxwidget!=NULL) @@ -653,20 +657,23 @@ void ShowNPoints::Process() bbSetOutputlstPointsY( mwxwidget->GetLstPointsY() ); bbSetOutputlstPointsZ( mwxwidget->GetLstPointsZ() ); bbSetOutputlstLabels( mwxwidget->GetLstLabels() ); + } // mwxwidget } +//----------------------------------------------------------------- void ShowNPoints::CreateWidget(wxWindow* parent) { mwxwidget = new WidgetShowNPoints( parent, this); bbSetOutputWidget( mwxwidget ); } +//----------------------------------------------------------------- void ShowNPoints::bbUserSetDefaultValues() { mwxwidget = NULL; - bbSetInputRadio(1); + bbSetInputRadio(10); bbSetInputOpacity(1); std::vector colour; diff --git a/bbtk/src/bbmaracasvisuShowNPoints.h b/bbtk/src/bbmaracasvisuShowNPoints.h index 8681289..d9ecccc 100644 --- a/bbtk/src/bbmaracasvisuShowNPoints.h +++ b/bbtk/src/bbmaracasvisuShowNPoints.h @@ -69,8 +69,9 @@ namespace bbcreaMaracasVisu std::vector GetLstPointsZ(); std::vector GetLstLabels(); - void AddPoint(int x, int y, int z, std::string label); - + void AddPoint(int x, int y, int z, std::string label); + + private: std::string CleanSpaces(std::string ss); @@ -102,6 +103,7 @@ namespace bbcreaMaracasVisu wxStaticText *txtNrPoints; wxSlider *sdrOpacity; wxSlider *sdrRadio; + }; class /*BBTK_EXPORT*/ ShowNPoints @@ -138,8 +140,8 @@ BBTK_BEGIN_DESCRIBE_BLACK_BOX(ShowNPoints,bbtk::WxBlackBox); BBTK_INPUT(ShowNPoints,Renderer,"Renderer",vtkRenderer*,""); BBTK_INPUT(ShowNPoints,Image,"vktkImageData",vtkImageData*,""); BBTK_INPUT(ShowNPoints,Colour,"Colour of the actor",std::vector,"colour"); - BBTK_INPUT(ShowNPoints,Opacity,"Opacity of the actor",double,""); - BBTK_INPUT(ShowNPoints,Radio,"Radio of the spheres",double,""); + BBTK_INPUT(ShowNPoints,Opacity,"Opacity of the actor 0..1 (default 1)",double,""); + BBTK_INPUT(ShowNPoints,Radio,"Radio of the spheres 1..50 (default 10)",double,""); BBTK_INPUT(ShowNPoints,Type,"Type of the widget. 0(default): N-points, 1:Just one point",int,""); BBTK_OUTPUT(ShowNPoints , lstPointsX , " list of points X ", std::vector ,""); BBTK_OUTPUT(ShowNPoints , lstPointsY , " list of points Y ", std::vector ,""); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index 6bdef1c..e67cc22 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -387,6 +387,9 @@ vtkImagePlaneWidget* wxVtkMPR3DView::GetPlaneWidget(unsigned char activationkey, //------------------------------------------------------------------- void wxVtkMPR3DView::SetFreePlanesOrtho() { + + + _planeWidgetX->SetPlaneOrientationToXAxes(); _planeWidgetY->SetPlaneOrientationToYAxes(); _planeWidgetZ->SetPlaneOrientationToZAxes(); @@ -400,13 +403,44 @@ void wxVtkMPR3DView::FreePlaneVisible(int plane, bool ok) { if(_planeWidgetX) { - if ((plane==1) && (ok==true)) _planeWidgetX->EnabledOn(); - if ((plane==2) && (ok==true)) _planeWidgetY->EnabledOn(); - if ((plane==3) && (ok==true)) _planeWidgetZ->EnabledOn(); + if (ok==true) + { +//EED 21/07/2013 +// 1. Make backup of actors +// 2. Putting out all the actors +// 3. Add vtkImagageActor in first place +// 4. Putting again the originals actors +// 5. Refresh + + // step 1, step 2 + vtkActorCollection *tmpCollection = vtkActorCollection::New(); + vtkActorCollection *collectionActors = _wxvtk3Dbaseview->GetRenderer()->GetActors(); + int i,size=collectionActors->GetNumberOfItems(); + for (i=0; iAddItem ( (vtkActor*)collectionActors->GetItemAsObject(0) ); + _wxvtk3Dbaseview->GetRenderer()->RemoveActor( (vtkProp*)tmpCollection->GetItemAsObject(i) ); + } // for + + // step 3 + if ((plane==1) && (ok==true)) _planeWidgetX->EnabledOn(); + if ((plane==2) && (ok==true)) _planeWidgetY->EnabledOn(); + if ((plane==3) && (ok==true)) _planeWidgetZ->EnabledOn(); + + // step 4 + for (i=0; iGetRenderer()->AddActor( (vtkProp*)tmpCollection->GetItemAsObject(i) ); + } // for + tmpCollection->Delete(); + + // step 5 Refresh + _wxvtk3Dbaseview->GetRenderer()->GetRenderWindow()->Render(); + } // if ok if ((plane==1) && (ok==false)) _planeWidgetX->EnabledOff(); if ((plane==2) && (ok==false)) _planeWidgetY->EnabledOff(); if ((plane==3) && (ok==false)) _planeWidgetZ->EnabledOff(); - } + } // if _planeWidgetX } //------------------------------------------------------------------- @@ -544,7 +578,36 @@ void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){ if (visible==false){ _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) ); } else { +//EED 21/07/2013 +// 1. Make backup of actors +// 2. Putting out all the actors +// 3. Add vtkImagageActor in first place +// 4. Putting again the originals actors +// 5. Refresh + + // step 1, step 2 + vtkActorCollection *tmpCollection = vtkActorCollection::New(); + vtkActorCollection *collectionActors = _wxvtk3Dbaseview->GetRenderer()->GetActors(); + int i,size=collectionActors->GetNumberOfItems(); + for (i=0; iAddItem ( (vtkActor*)collectionActors->GetItemAsObject(0) ); + _wxvtk3Dbaseview->GetRenderer()->RemoveActor( (vtkProp*)tmpCollection->GetItemAsObject(i) ); + } // for + + // step 3 _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) ); + + // step 4 + for (i=0; iGetRenderer()->AddActor( (vtkProp*)tmpCollection->GetItemAsObject(i) ); + } // for + tmpCollection->Delete(); + + // step 5 Refresh + _wxvtk3Dbaseview->GetRenderer()->GetRenderWindow()->Render(); + } _vtkmpr3Ddataviewer->SetVisiblePosition(idPosition,visible); }