]> Creatis software - creaMaracasVisu.git/commitdiff
#3012 creaMaracasVisu Bug New Normal - Update Image in ViewerNV #3065 creaMara...
authorEduardo DAVILA <davila@localhost.localdomain>
Fri, 3 Mar 2017 13:02:42 +0000 (14:02 +0100)
committerEduardo DAVILA <davila@localhost.localdomain>
Fri, 3 Mar 2017 13:02:42 +0000 (14:02 +0100)
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualView3VContour.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBullEyeSector.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewPoint.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewRoi.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.h

index 27f0b07b450ba22675547c0ef4be3278d97cb372..e6791913123eb47141f75923ba91727f9a0d03a7 100644 (file)
@@ -123,6 +123,11 @@ void manualView3VContour::RefreshContour()  // virtula
                
        }// for
 
+//EED 2017-03-02
+       if (_pts!=NULL) { 
+               _pts->Modified(); 
+       }
+
 }
 
 // ----------------------------------------------------------------------------
index 79011538b27779b299a7955c9521820a5b6dad53..0bbdadc97890262b2010c1e950a3f702b39751b1 100644 (file)
@@ -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();
index 1120152be15da3656d7f4ad19ecc2c2d666279c8..2a8a7588e493cbe8acdf0ca10f334b5d22f836f7 100644 (file)
@@ -74,7 +74,8 @@
 // ----------------------------------------------------------------------------
 
 
-class creaMaracasVisu_EXPORT manualViewBaseContour{
+class creaMaracasVisu_EXPORT manualViewBaseContour
+{
 
 //---------------------------------------------------
 // PUBLIC METHODS & ATTS
index 1702eead866f7f4ab43cc0fe23f4722dbd503329..60148cab5d189a4e5dcb8738770ca6448ee06b68 100644 (file)
@@ -74,7 +74,8 @@ void manualViewBullEyeSector::RefreshContour()
                        
                        
                }// for
-               
+               //EED 2017-03-02
+               _pts->Modified();
        } // if _pts
 
 }
index 6119fcd00be7850ceee4692522f8a952f19229e6..f2aac544f42d586b04c478843ea5d26d47b744b6 100644 (file)
@@ -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();
 }
 
 // ----------------------------------------------------------------------------
index 4a0dedcfc1feb49cb776d0ed02119a905beee28f..5a8625a28c989d0fa69267dcd2216e028b9aac4b 100644 (file)
@@ -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();
        }
 }
 
index 0fd4501ec8eb8c6de9a720ed0dac0de90fc802b1..1eb8d06da4f695dde1c27af09d2a5e4fa4f03a10 100644 (file)
@@ -85,6 +85,10 @@ void manualViewRoi::RefreshContour() // virtual
                                _pts->SetPoint(1, 0 , 0 , 0);
                } // if
        }
+
+//EED 2017-03-02
+       _pts->Modified();
+
 }
 
 // ----------------------------------------------------------------------------
index cdfc9918532601438b1690cc80ac92c0ccc0e42b..242c9bd68a415e957e507a4b342621031bfd4746 100644 (file)
@@ -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);
index 108b5913765e923e3c7e8d1d0eea9b9868dbc690..1d9ff304bb673656854c3d459791030b54ee880f 100644 (file)
@@ -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; i<size; i++)
                        {
                                tmpCollection->AddItem ( (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; i<size; i++)
                        {
-                               printf(" wxVtkMPR3DView::VisibleImageActor %d\n" , i);
                                tmpCollection->AddItem ( (vtkActor*)collectionActors->GetItemAsObject(0)  );                    
                                _wxvtk3Dbaseview->GetRenderer()->RemoveActor( (vtkProp*)tmpCollection->GetItemAsObject(i) );
                        } // for
index 32624a50b213a59d12842f9a9c0cfa284aa79757..790d3bc01c7b708f97561878cd7e7e2157a18db2 100644 (file)
@@ -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();
index 989dec22e3955f4ef17d1724e1146a5c93fff0c7..b3f971d53abf4a8136d221bb8977178020af8d08 100644 (file)
@@ -60,7 +60,7 @@ public:
 
 
        virtual void Refresh();
-       void            UpdateControlPanel();
+       void            UpdateControlPanel(bool firsttime=true);
 
        bool            GetVisibleX();
        bool            GetVisibleY();