]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx
#3012 creaMaracasVisu Bug New Normal - Update Image in ViewerNV #3065 creaMara...
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / vtkMPR3DDataViewer.cxx
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);