]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx
changes in viewers, now is possible to initialize them with out an image but the...
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / vtkMPR3DDataViewer.cxx
index acbeb2fbab85102c475d0373251833fbe3f05912..07c0ec1d1274530fcc15cc1ecedf00f33c688859 100644 (file)
@@ -24,20 +24,20 @@ vtkMPR3DDataViewer::vtkMPR3DDataViewer()
 //-------------------------------------------------------------------
 vtkMPR3DDataViewer::~vtkMPR3DDataViewer()
 {
-       _outlineData            -> Delete();
-       _mapOutline                     -> Delete();
-       _outline                        -> Delete();
-
-//     if (_bwLut)                             _bwLut                          -> Delete();
-//     if (_hueLut)                    _hueLut                         -> Delete();
-//     if (_satLut)                    _satLut                         -> Delete();
-       if (_ctfun)                             _ctfun                          -> Delete();
-       if (_saggitalColors)    _saggitalColors         -> Delete();
-       if (_saggital)                  _saggital                       -> Delete();
-       if (_axialColors)               _axialColors            -> Delete();
-       if (_axial)                             _axial                          -> Delete();
-       if (_coronalColors)             _coronalColors          -> Delete();
-       if (_coronal)                   _coronal                        -> Delete();
+       _outlineData-> Delete();
+       _mapOutline-> Delete();
+       _outline-> Delete();
+
+//     if (_bwLut)             _bwLut->Delete();
+//     if (_hueLut)            _hueLut->Delete();
+//     if (_satLut)            _satLut->Delete();
+       if (_ctfun)             _ctfun->Delete();
+       if (_saggitalColors)    _saggitalColors ->Delete();
+       if (_saggital)          _saggital->Delete();
+       if (_axialColors)       _axialColors->Delete();
+       if (_axial)             _axial->Delete();
+       if (_coronalColors)     _coronalColors->Delete();
+       if (_coronal)           _coronal->Delete();
 
 }
 //-------------------------------------------------------------------
@@ -140,8 +140,17 @@ void vtkMPR3DDataViewer::Configure()
 
 
        double range[2];
-       _vtkmprbasedata->GetImageData()->GetScalarRange(range);
-       double max = range[1];
+       double max;
+       
+       if(_vtkmprbasedata->GetImageData()){
+               _vtkmprbasedata->GetImageData()->GetScalarRange(range);
+               max = range[1];
+       }else{
+               max = 1;
+       }
+       
+       
+       
 
        _ctFunVectorPoint.clear();
        _ctFunVectorPoint.push_back(max*0/4);
@@ -205,11 +214,12 @@ void vtkMPR3DDataViewer::Configure()
        }
        _saggitalColors->RemoveAllInputs();
        
-    _saggitalColors->SetInput( _vtkmprbasedata->GetImageData() );
+       if(_vtkmprbasedata->GetImageData()){
+               _saggitalColors->SetInput( _vtkmprbasedata->GetImageData() );
+       }
 //    _saggitalColors->SetLookupTable(_bwLut);
        
     _saggitalColors->SetLookupTable(_ctfun);
-
        
 
        if(_saggital==NULL){
@@ -229,7 +239,9 @@ void vtkMPR3DDataViewer::Configure()
        }
 
        _axialColors->RemoveAllInputs();
-    _axialColors->SetInput( _vtkmprbasedata->GetImageData() );
+       if(_vtkmprbasedata->GetImageData()){
+               _axialColors->SetInput( _vtkmprbasedata->GetImageData() );
+       }
 //    _axialColors->SetLookupTable(_hueLut);
     _axialColors->SetLookupTable(_ctfun);
 
@@ -247,7 +259,9 @@ void vtkMPR3DDataViewer::Configure()
                _coronalColors = vtkImageMapToColors::New();
        }
        _coronalColors->RemoveAllInputs();
-    _coronalColors->SetInput( _vtkmprbasedata->GetImageData() );
+       if(_vtkmprbasedata->GetImageData()){
+               _coronalColors->SetInput( _vtkmprbasedata->GetImageData() );
+       }
 //    _coronalColors->SetLookupTable(_satLut);
     _coronalColors->SetLookupTable(_ctfun);
 
@@ -264,7 +278,9 @@ void vtkMPR3DDataViewer::Configure()
                _outlineData = vtkOutlineFilter::New();
        }
        _outlineData->RemoveAllInputs();
-    _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() );
+       if(_vtkmprbasedata->GetImageData()){
+               _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() );
+       }
 
        if(_mapOutline==NULL){
                _mapOutline = vtkPolyDataMapper::New();
@@ -281,8 +297,8 @@ void vtkMPR3DDataViewer::Configure()
        
     
 
-       int ext[6];
-       _vtkmprbasedata->GetImageData()->GetExtent(ext);
+       //int ext[6];
+       //_vtkmprbasedata->GetImageData()->GetExtent(ext);
 
        
 
@@ -332,4 +348,11 @@ void vtkMPR3DDataViewer::SetVisiblePosition(int idPosition, bool visible)
 bool vtkMPR3DDataViewer::GetVisiblePosition(int idPosition)
 {
        return _visiblePosition[idPosition];
-}
\ No newline at end of file
+}
+
+void vtkMPR3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){
+       _saggitalColors->SetLookupTable(colortable);
+        _coronalColors->SetLookupTable(colortable);
+       _axialColors->SetLookupTable(colortable);
+}
+