From 3283472f764535492122c3b2ade020a749c1bd2a Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 3 Mar 2017 14:02:42 +0100 Subject: [PATCH] #3012 creaMaracasVisu Bug New Normal - Update Image in ViewerNV #3065 creaMaracasVisu Bug New Normal - Refresh manual contour --- .../manualContour/manualView3VContour.cpp | 5 ++ .../manualContour/manualViewBaseContour.cpp | 6 +- .../manualContour/manualViewBaseContour.h | 3 +- .../manualContour/manualViewBullEyeSector.cpp | 3 +- .../manualContour/manualViewContour.cpp | 3 + .../widgets/manualContour/manualViewPoint.cpp | 20 +++-- .../widgets/manualContour/manualViewRoi.cpp | 4 + .../wxWindows/widgets/vtkMPR3DDataViewer.cxx | 86 ++++++++++++------- .../wxWindows/widgets/wxVtkMPR3DView.cxx | 27 ++++-- .../widgets/wxVtkMPR3DViewCntrlPanel.cxx | 14 +-- .../widgets/wxVtkMPR3DViewCntrlPanel.h | 2 +- 11 files changed, 115 insertions(+), 58 deletions(-) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualView3VContour.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualView3VContour.cpp index 27f0b07..e679191 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualView3VContour.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualView3VContour.cpp @@ -123,6 +123,11 @@ void manualView3VContour::RefreshContour() // virtula }// for +//EED 2017-03-02 + if (_pts!=NULL) { + _pts->Modified(); + } + } // ---------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp index 7901153..0bbdadc 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp @@ -286,8 +286,10 @@ void manualViewBaseContour::ConstructVTKObjects() //EED 29Mars2009 //_pts->SetPoint(0, 0 , 0 , -1000 ); //_pts->SetPoint(1, 0 , 0 , 1000 ); - _pts->SetPoint(0, -1000 , -1000 , -1000 ); - _pts->SetPoint(1, 1000 , 1000 , 1000 ); + +//EED 2017-03-02 +// _pts->SetPoint(0, -1000 , -1000 , -1000 ); +// _pts->SetPoint(1, 1000 , 1000 , 1000 ); // This is the structure for the spline _splineCell = vtkCellArray::New(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.h index 1120152..2a8a758 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.h @@ -74,7 +74,8 @@ // ---------------------------------------------------------------------------- -class creaMaracasVisu_EXPORT manualViewBaseContour{ +class creaMaracasVisu_EXPORT manualViewBaseContour +{ //--------------------------------------------------- // PUBLIC METHODS & ATTS diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBullEyeSector.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBullEyeSector.cpp index 1702eea..60148ca 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBullEyeSector.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBullEyeSector.cpp @@ -74,7 +74,8 @@ void manualViewBullEyeSector::RefreshContour() }// for - + //EED 2017-03-02 + _pts->Modified(); } // if _pts } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp index 6119fcd..f2aac54 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp @@ -173,6 +173,9 @@ void manualViewContour::RefreshContour() // virtual _minY=_minY-1.0; _maxX=_maxX+1.0; _maxY=_maxY+1.0; + +//EED 2017-03-02 + _pts->Modified(); } // ---------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewPoint.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewPoint.cpp index 4a0dedc..5a8625a 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewPoint.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewPoint.cpp @@ -119,14 +119,15 @@ vtkActor* manualViewPoint::CreateVtkPointActor() _pts = vtkPoints::New(); _pts->SetNumberOfPoints(8); - _pts->SetPoint(0, -1000 , -1000 , 0 ); - _pts->SetPoint(1, 1000 , -1000 , 0 ); - _pts->SetPoint(2, 1000 , 1000 , 0 ); - _pts->SetPoint(3, -1000 , 1000 , 0 ); - _pts->SetPoint(4, -1000 , 1000 , 0 ); - _pts->SetPoint(5, -1000 , 1000 , 0 ); - _pts->SetPoint(6, -1000 , 1000 , 0 ); - _pts->SetPoint(7, -1000 , 1000 , 0 ); +//EED +// _pts->SetPoint(0, -1000 , -1000 , 0 ); +// _pts->SetPoint(1, 1000 , -1000 , 0 ); +// _pts->SetPoint(2, 1000 , 1000 , 0 ); +// _pts->SetPoint(3, -1000 , 1000 , 0 ); +// _pts->SetPoint(4, -1000 , 1000 , 0 ); +// _pts->SetPoint(5, -1000 , 1000 , 0 ); +// _pts->SetPoint(6, -1000 , 1000 , 0 ); +// _pts->SetPoint(7, -1000 , 1000 , 0 ); vtkCellArray *lines = vtkCellArray::New(); lines->InsertNextCell(17); @@ -190,6 +191,9 @@ void manualViewPoint::SetPositionXY(double x, double y,double i_range,double pos _pts->SetPoint(5, x+range, y+range, posZ+range); _pts->SetPoint(6, x+range, y-range, posZ+range); _pts->SetPoint(7, x-range, y-range, posZ+range); + +//EED 2017-03-02 + _pts->Modified(); } } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewRoi.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewRoi.cpp index 0fd4501..1eb8d06 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewRoi.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewRoi.cpp @@ -85,6 +85,10 @@ void manualViewRoi::RefreshContour() // virtual _pts->SetPoint(1, 0 , 0 , 0); } // if } + +//EED 2017-03-02 + _pts->Modified(); + } // ---------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx index cdfc991..242c9bd 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx @@ -181,34 +181,57 @@ void vtkMPR3DDataViewer::Configure() if(_vtkmprbasedata->GetImageData()) { + _vtkmprbasedata->GetImageData()->Update(); + _vtkmprbasedata->GetImageData()->Modified(); _vtkmprbasedata->GetImageData()->GetScalarRange(range); delta = range[1]-range[0]; - + if (delta==0) + { + printf("EED vtkMPR3DDataViewer::Configure Warning! image Range [0,0] -> changed to [0,1000] \n" ); + delta=1000; + } // if delta + _ctFunVectorPoint.clear(); - _ctFunVectorPoint.push_back( range[0] + delta*0/4 ); - _ctFunVectorPoint.push_back( range[0] + delta*1/4 ); - _ctFunVectorPoint.push_back( range[0] + delta*2/4 ); - _ctFunVectorPoint.push_back( range[0] + delta*3/4 ); - _ctFunVectorPoint.push_back( range[0] + delta*4/4 ); + _ctFunVectorPoint.push_back( range[0] + delta*0/8 ); + _ctFunVectorPoint.push_back( range[0] + delta*1/8 ); + _ctFunVectorPoint.push_back( range[0] + delta*2/8 ); + _ctFunVectorPoint.push_back( range[0] + delta*3/8 ); + _ctFunVectorPoint.push_back( range[0] + delta*4/8 ); + _ctFunVectorPoint.push_back( range[0] + delta*5/8 ); + _ctFunVectorPoint.push_back( range[0] + delta*6/8 ); + _ctFunVectorPoint.push_back( range[0] + delta*7/8 ); + _ctFunVectorPoint.push_back( range[0] + delta*8/8 ); _ctFunVectorRed.clear(); _ctFunVectorRed.push_back(0.0); - _ctFunVectorRed.push_back(1.0); _ctFunVectorRed.push_back(0.0); _ctFunVectorRed.push_back(0.0); _ctFunVectorRed.push_back(0.0); + _ctFunVectorRed.push_back(0.5); + _ctFunVectorRed.push_back(1.0); + _ctFunVectorRed.push_back(1.0); + _ctFunVectorRed.push_back(1.0); + _ctFunVectorRed.push_back(0.5); _ctFunVectorGreen.clear(); _ctFunVectorGreen.push_back(0.0); _ctFunVectorGreen.push_back(0.0); - _ctFunVectorGreen.push_back(0.0); + _ctFunVectorGreen.push_back(0.5); + _ctFunVectorGreen.push_back(1.0); + _ctFunVectorGreen.push_back(1.0); _ctFunVectorGreen.push_back(1.0); - _ctFunVectorGreen.push_back(0.2); + _ctFunVectorGreen.push_back(0.5); + _ctFunVectorGreen.push_back(0.0); + _ctFunVectorGreen.push_back(0.0); _ctFunVectorBlue.clear(); + _ctFunVectorBlue.push_back(0.5); + _ctFunVectorBlue.push_back(1.0); + _ctFunVectorBlue.push_back(1.0); + _ctFunVectorBlue.push_back(1.0); + _ctFunVectorBlue.push_back(0.5); _ctFunVectorBlue.push_back(0.0); _ctFunVectorBlue.push_back(0.0); - _ctFunVectorBlue.push_back(1.0); _ctFunVectorBlue.push_back(0.0); _ctFunVectorBlue.push_back(0.0); @@ -241,7 +264,8 @@ void vtkMPR3DDataViewer::Configure() // specifying the DisplayExtent, the pipeline requests data of this extent // and the vtkImageMapToColors only processes a slice of data. - if(_saggitalColors==NULL){ + if(_saggitalColors==NULL) + { _saggitalColors = vtkImageMapToColors::New(); } _saggitalColors->RemoveAllInputs(); @@ -252,7 +276,8 @@ void vtkMPR3DDataViewer::Configure() _saggitalColors->SetLookupTable(_ctfun); - if(_saggital==NULL){ + if(_saggital==NULL) + { _saggital = vtkImageActor::New(); _saggital->SetInput(_saggitalColors->GetOutput()); } @@ -264,7 +289,8 @@ void vtkMPR3DDataViewer::Configure() // same approach as before except that the extent differs. - if(_axialColors==NULL){ + if(_axialColors==NULL) + { _axialColors = vtkImageMapToColors::New(); } @@ -273,7 +299,8 @@ void vtkMPR3DDataViewer::Configure() // _axialColors->SetLookupTable(_hueLut); _axialColors->SetLookupTable(_ctfun); - if(_axial==NULL){ + if(_axial==NULL) + { _axial = vtkImageActor::New(); _axial->SetInput(_axialColors->GetOutput()); } @@ -283,7 +310,8 @@ void vtkMPR3DDataViewer::Configure() // Create the third (coronal) plane of the three planes. We use // the same approach as before except that the extent differs. - if(_coronalColors==NULL){ + if(_coronalColors==NULL) + { _coronalColors = vtkImageMapToColors::New(); } _coronalColors->RemoveAllInputs(); @@ -291,7 +319,8 @@ void vtkMPR3DDataViewer::Configure() // _coronalColors->SetLookupTable(_satLut); _coronalColors->SetLookupTable(_ctfun); - if(_coronal==NULL){ + if(_coronal==NULL) + { _coronal = vtkImageActor::New(); _coronal->SetInput(_coronalColors->GetOutput()); } @@ -300,40 +329,34 @@ void vtkMPR3DDataViewer::Configure() // An outline provides context around the data. // - if(_outlineData==NULL){ + if(_outlineData==NULL) + { _outlineData = vtkOutlineFilter::New(); } _outlineData->RemoveAllInputs(); - if(_vtkmprbasedata->GetImageData()){ + if(_vtkmprbasedata->GetImageData()) + { _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() ); } - if(_mapOutline==NULL){ + if(_mapOutline==NULL) + { _mapOutline = vtkPolyDataMapper::New(); _mapOutline->SetInput(_outlineData->GetOutput()); } _mapOutline->Update(); //_mapOutline->RemoveAllInputs(); - if(_outline==NULL){ + if(_outline==NULL) + { _outline = vtkActor::New(); _outline->SetMapper(_mapOutline); _outline->GetProperty()->SetColor(0,0,0); } } - - - - - - //int ext[6]; //_vtkmprbasedata->GetImageData()->GetExtent(ext); - - - - } //------------------------------------------------------------------- @@ -400,7 +423,8 @@ bool vtkMPR3DDataViewer::GetVisiblePosition(int idPosition) return _visiblePosition[idPosition]; } -void vtkMPR3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){ +void vtkMPR3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable) +{ if(_saggitalColors) { _saggitalColors->SetLookupTable(colortable); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index 108b591..1d9ff30 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -417,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 @@ -427,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) ); @@ -450,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(); @@ -507,7 +507,9 @@ void wxVtkMPR3DView::RefreshView() // virtual spc[1] = 0; spc[2] = 0; } - //this->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData()->GetSpacing(spc); + +// GetVtkMPR3DDataViewer()->Configure(); + //double nx=1,ny=0,nz=0; // JPRx Refresh(); @@ -518,7 +520,6 @@ void wxVtkMPR3DView::RefreshView() // virtual SetColorWindow( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorWindow() ); SetColorLevel( _vtkmpr3Ddataviewer->GetVtkMPRBaseData()->GetColorLevel() ); - double normal[3]; // FreePlaneX _planeWidgetX->GetNormal(normal); @@ -552,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]; @@ -564,6 +569,11 @@ void wxVtkMPR3DView::RefreshView() // virtual _planeWidget->UpdatePlacement(); _planeWidget->GetPolyData(_vtkplane); } + + if (_wxvtkmpr3DviewCntrlPanel!=NULL) + { + _wxvtkmpr3DviewCntrlPanel->UpdateControlPanel(false); + } // if _wxvtkmpr3DviewCntrlPanel } //------------------------------------------------------------------- @@ -620,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 diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx index 32624a5..790d3bc 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx @@ -280,7 +280,7 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV } //------------------------------------------------------------------- -void wxVtkMPR3DViewCntrlPanel::UpdateControlPanel() +void wxVtkMPR3DViewCntrlPanel::UpdateControlPanel(bool firsttime) { vtkMPRBaseData* basedata = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData(); if(basedata != NULL){ @@ -288,15 +288,19 @@ void wxVtkMPR3DViewCntrlPanel::UpdateControlPanel() vtkImageData* img = basedata->GetImageData(); int x0,x1,y0,y1,z0,z1; - if(img){ + if(img) + { img->GetExtent(x0,x1,y0,y1,z0,z1); _positionX->SetRange(x0,x1); _positionY->SetRange(y0,y1); _positionZ->SetRange(z0,z1); - _positionX->SetValue((x0+x1)/2); - _positionY->SetValue((y0+y1)/2); - _positionZ->SetValue((z0+z1)/2); + if (firsttime==true) + { + _positionX->SetValue((x0+x1)/2); + _positionY->SetValue((y0+y1)/2); + _positionZ->SetValue((z0+z1)/2); + } // if firsttime //EED 12April2012 This make a floting window in MacOs and Linux with for windows // _positionX->Update(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.h index 989dec2..b3f971d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.h @@ -60,7 +60,7 @@ public: virtual void Refresh(); - void UpdateControlPanel(); + void UpdateControlPanel(bool firsttime=true); bool GetVisibleX(); bool GetVisibleY(); -- 2.47.1