From: Eduardo DAVILA Date: Thu, 24 Jun 2021 13:10:02 +0000 (+0200) Subject: #3467 Bug refresh Window Color level in 3D planes ViewerNV X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=688e59e2d8a0f8db3d28dfd5b2f8a256903b2714;p=creaMaracasVisu.git #3467 Bug refresh Window Color level in 3D planes ViewerNV --- diff --git a/bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx b/bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx index 00a2bd6..52ab1bd 100644 --- a/bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx +++ b/bbtk/src/bbmaracasvisuDrawAxisTree3D.cxx @@ -44,6 +44,7 @@ BBTK_BLACK_BOX_IMPLEMENTATION(DrawAxisTree3D,bbtk::AtomicBlackBox); void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis) { +printf("8.1 "); vtkPolyData *polydata = vtkPolyData::New( ); vtkPolyDataMapper *polydatamapper = vtkPolyDataMapper::New(); vtkActor *vtkactor = vtkActor::New(); @@ -58,10 +59,14 @@ void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis) #endif vtkactor->SetMapper(polydatamapper); +printf("8.2 "); + vecVtkPolyData.push_back( polydata ); vecVtkPolyDataMaper.push_back( polydatamapper ); vecVtkActors.push_back( vtkactor ); +printf("8.3 "); + // vtkImageData* img = bbGetInputImage(); unsigned int i,size; double spc[3]; @@ -72,15 +77,21 @@ void DrawAxisTree3D::DrawOneAxis(int iGeneral,int numPoints, int iAxis) int lstpointsXsize =bbGetInputlstPointX().size(); - if( lstpointsXsize>0 ){ - vtkPoints* allPoints = vtkPoints::New( ); -vtkPolyLine *polyline = vtkPolyLine::New(); +printf("8.4 "); + + if( lstpointsXsize>0 ) + { +printf("8.5 "); + vtkPoints *allPoints = vtkPoints::New( ); + vtkPolyLine *polyline = vtkPolyLine::New(); vtkCellArray* allTopology = vtkCellArray::New( ); // allTopology->InsertNextCell( numPoints ); +printf("8.6 "); size=iGeneral+numPoints; for (i=iGeneral;iInsertNextPoint( bbGetInputlstPointX()[i]*spc[0], @@ -92,14 +103,18 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral); // allTopology->InsertCellPoint( i-iGeneral ); } // rof +printf("8.8 "); + allTopology->InsertNextCell(polyline); // create cell array for edges vtkCellArray *edges = vtkCellArray::New(); +printf("8.9 "); // connect edge's and vertexes point ids for(vtkIdType i = iGeneral; i < size-1; i++) { +printf("8.10(%d) ",i); vtkLine *edge = vtkLine::New(); edge->GetPointIds()->SetId(0, i-iGeneral); edge->GetPointIds()->SetId(1, (i-iGeneral+1) ); @@ -110,6 +125,7 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral); // vertexes->InsertNextCell(vertex); } +printf("8.11 "); polydata->SetPoints( allPoints ); polydata->SetLines(edges); // polydata->SetLines( allTopology ); @@ -120,6 +136,8 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral); edges->Delete(); allPoints->Delete(); allTopology->Delete(); +printf("8.12 "); + } // color @@ -127,6 +145,8 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral); if (bbGetInputColourLaw()==1) // the same color for all { +printf("8.13(%d) ",bbGetInputColour().size() ); + r = bbGetInputColour()[0]; g = bbGetInputColour()[1]; b = bbGetInputColour()[2]; @@ -135,6 +155,7 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral); if (bbGetInputColourLaw()==2) // different colors for each segment { +printf("8.14 "); if ( (iAxis*3+1) < (int)(bbGetInputColour().size()) ) { r = bbGetInputColour()[0+iAxis*3]; @@ -145,11 +166,13 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral); g = (rand() % 100) / 100.0; b = (rand() % 100) / 100.0; } +printf("8.15 "); vtkactor->GetProperty()->SetColor( r,g,b ); } // Law 2 color for each segment if (bbGetInputColourLaw()==3) // color for each point { +printf("8.16 "); // Setup the colors array vtkUnsignedCharArray *colors = vtkUnsignedCharArray::New(); colors->SetNumberOfComponents(3); @@ -171,57 +194,70 @@ polyline->GetPointIds()->InsertNextId(i-iGeneral); } // Law 3 color for each point +printf("8.17 "); vtkactor->GetProperty()->SetLineWidth( bbGetInputLineWidth() ); vtkactor->GetProperty()->SetOpacity( bbGetInputOpacity() ); if ( bbGetInputTransform()!=NULL ) { +printf("8.18 "); vtkactor->SetUserTransform( bbGetInputTransform() ); } // Interface Update if (bbGetInputRenderer()!=NULL ) { +printf("8.19 "); bbGetInputRenderer()->AddActor( vtkactor ); } +printf("8.20 "); } void DrawAxisTree3D::Process() { - +printf("1 "); int iGeneral=0; std::vector lstIndexs = bbGetInputlstIndexs(); if ( bbGetInputlstIndexs().size()==0 ) { +printf("2 "); lstIndexs.push_back( bbGetInputlstPointX().size() ); } // if int iAxis,sizeLstAxis=lstIndexs.size(); int iActor,sizeActors = vecVtkActors.size(); int numPoints; +printf("3 "); // if (oldLstSize!=sizeLstAxis) // { // oldLstSize=sizeLstAxis; for (iActor=0 ; iActorRemoveActor( vecVtkActors[iActor] ); vecVtkPolyData[iActor]->Delete(); vecVtkPolyDataMaper[iActor]->Delete(); vecVtkActors[iActor]->Delete(); +printf("6 "); } // if } // for iActor vecVtkPolyData.clear(); vecVtkPolyDataMaper.clear(); vecVtkActors.clear(); +printf("7 "); for ( iAxis=0 ; iAxisGetVtkImageViewer2()->GetWindowLevel()->Modified(); - _imageViewer2XYZ->GetVtkImageViewer2()->Render(); +//EED2120-06-23 _imageViewer2XYZ->GetVtkImageViewer2()->Render(); ////////////// //RaC 04-2010 Look for the description of new changes in vtkInteractorStyleBaseView2D constructor. diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index 97f4fad..fc664f2 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -168,6 +168,8 @@ void wxVtkMPR3DView::RemoveActor(vtkActor* actor) //------------------------------------------------------------------- void wxVtkMPR3DView::Configure() { +printf("EED wxVtkMPR3DView::Configure Configure Start\n"); + vtkImageData *imageData = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); _wxvtk3Dbaseview->Configure(); _wxvtkmpr3DviewCntrlPanel->UpdateControlPanel(); @@ -286,11 +288,15 @@ void wxVtkMPR3DView::Configure() // render window (expressed in pixels). _wxvtk3Dbaseview->GetRenderer()->SetBackground( 0.36 , 0.36 , 0.36 ); //EED 23oct2010 _wxvtk3Dbaseview->GetRenWin()->SetSize(400, 400); + +printf("EED wxVtkMPR3DView::Configure Configure End\n"); + } //------------------------------------------------------------------- void wxVtkMPR3DView::ConfigureFreePlanes() { +printf("EED wxVtkMPR3DView::ConfigureFreePlanes Start\n"); // The shared picker enables us to use 3 planes at one time // and gets the picking order right vtkCellPicker* picker = vtkCellPicker::New(); @@ -314,12 +320,17 @@ void wxVtkMPR3DView::ConfigureFreePlanes() _planeWidgetX->AddObserver(vtkCommand::InteractionEvent, wlipwc ); _planeWidgetY->AddObserver(vtkCommand::InteractionEvent, wlipwc ); _planeWidgetZ->AddObserver(vtkCommand::InteractionEvent, wlipwc ); + + + +printf("EED wxVtkMPR3DView::ConfigureFreePlanes End\n"); } //------------------------------------------------------------------- void wxVtkMPR3DView::SetImage() { +printf("EED wxVtkMPR3DView::SetImage Start\n"); vtkImageData *imageData = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); // Orthogonal planes B&W //EED 2017-01-01 Migration VTK7 @@ -349,20 +360,45 @@ 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] ); // -- Plane widget _probe->SetSourceData( imageData ); #endif _vtkmpr3Ddataviewer->SetImage(); +printf("EED wxVtkMPR3DView::SetImage End %f %f \n", colorWindow,colorLevel ); + } //------------------------------------------------------------------- @@ -499,16 +535,19 @@ void wxVtkMPR3DView::setColorTransferFunction(vtkColorTransferFunction* colortab //------------------------------------------------------------------- void wxVtkMPR3DView::Refresh() // virtual { +printf("EED wxVtkMPR3DView::Refresh Start\n"); _vtkmpr3Ddataviewer->Refresh(); if (_wxvtkmpr3DviewCntrlPanel!=NULL) { _wxvtkmpr3DviewCntrlPanel->Refresh(); } +printf("EED wxVtkMPR3DView::Refresh End\n"); } //------------------------------------------------------------------- void wxVtkMPR3DView::RefreshView() // virtual { +printf("EED wxVtkMPR3DView::RefreshView Start\n"); double spc[3]; vtkImageData *image = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); if(image) @@ -587,12 +626,13 @@ void wxVtkMPR3DView::RefreshView() // virtual #else _probe->Update(); #endif - } + } //_pointWidget if (_wxvtkmpr3DviewCntrlPanel!=NULL) { _wxvtkmpr3DviewCntrlPanel->UpdateControlPanel(false); } // if _wxvtkmpr3DviewCntrlPanel +printf("EED wxVtkMPR3DView::RefreshView End\n"); } //------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h index b98227a..b7bffd4 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h @@ -34,6 +34,7 @@ #include "vtkPlaneWidget.h" #include "vtkPointWidget.h" #include "vtkImagePlaneWidget.h" +#include "vtkImageChangeInformation.h" //class vtkmyPWCallback_3DPointWidget; @@ -103,6 +104,8 @@ private: vtkImagePlaneWidget *_planeWidgetY; vtkImagePlaneWidget *_planeWidgetZ; + vtkImageChangeInformation *mchange; + protected: };