X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FvtkMPR3DDataViewer.cxx;h=5c4e0c7f98622ae20d7411600b68a06ce5e05848;hb=25e3adf442d6a8d357d52410267445c54426c525;hp=ff72cc520cea6d0aba29689ae9fc82244269c954;hpb=439cc05f12e61d0ba090ec0c2ba8701d382238d7;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx index ff72cc5..5c4e0c7 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx @@ -34,7 +34,6 @@ vtkMPR3DDataViewer::vtkMPR3DDataViewer() _visiblePosition[2]=false; _ctfun = NULL; _vtkmprbasedata = NULL; - _ctfun = NULL; _saggitalColors = NULL; _saggital = NULL; @@ -139,6 +138,22 @@ std::vector* vtkMPR3DDataViewer::GetctFunVectorBlue() return &_ctFunVectorBlue; } +//------------------------------------------------------------------- +void vtkMPR3DDataViewer::SetImage() +{ +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _saggitalColors->SetInput( _vtkmprbasedata->GetImageData() ); + _axialColors->SetInput( _vtkmprbasedata->GetImageData() ); + _coronalColors->SetInput( _vtkmprbasedata->GetImageData() ); +#else + _saggitalColors->SetInputData( _vtkmprbasedata->GetImageData() ); + _axialColors->SetInputData( _vtkmprbasedata->GetImageData() ); + _coronalColors->SetInputData( _vtkmprbasedata->GetImageData() ); +#endif + _outlineData -> SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() ); +} + //------------------------------------------------------------------- void vtkMPR3DDataViewer::Configure() { @@ -167,45 +182,69 @@ void vtkMPR3DDataViewer::Configure() _satLut->SetValueRange (1, 1); */ - double range[2]; double delta; - if(_vtkmprbasedata->GetImageData()) { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _vtkmprbasedata->GetImageData()->Update(); +#else + // .. +#endif + _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); - if(_ctfun==NULL) { _ctfun = vtkColorTransferFunction::New(); @@ -235,99 +274,144 @@ 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(); - _saggitalColors->SetInput( _vtkmprbasedata->GetImageData() ); - + // _saggitalColors->SetLookupTable(_bwLut); - _saggitalColors->SetLookupTable(_ctfun); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _saggitalColors->SetInput( _vtkmprbasedata->GetImageData() ); +#else + _saggitalColors->SetInputData( _vtkmprbasedata->GetImageData() ); + _saggitalColors->Update(); +#endif - - if(_saggital==NULL){ + + if(_saggital==NULL) + { _saggital = vtkImageActor::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _saggital->SetInput(_saggitalColors->GetOutput()); +#else + _saggital->SetInputData(_saggitalColors->GetOutput()); +#endif } //_saggitalColors->Update(); - - // Create the second (axial) plane of the three planes. We use the // same approach as before except that the extent differs. - - if(_axialColors==NULL){ + if(_axialColors==NULL) + { _axialColors = vtkImageMapToColors::New(); } - _axialColors->RemoveAllInputs(); - _axialColors->SetInput( _vtkmprbasedata->GetImageData() ); // _axialColors->SetLookupTable(_hueLut); _axialColors->SetLookupTable(_ctfun); - if(_axial==NULL){ + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _axialColors->SetInput( _vtkmprbasedata->GetImageData() ); +#else + _axialColors->SetInputData( _vtkmprbasedata->GetImageData() ); + _axialColors->Update(); +#endif + + if(_axial==NULL) + { _axial = vtkImageActor::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _axial->SetInput(_axialColors->GetOutput()); +#else + _axial->SetInputData(_axialColors->GetOutput()); +#endif + } //_axialColors->Update(); - - // 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(); - _coronalColors->SetInput( _vtkmprbasedata->GetImageData() ); // _coronalColors->SetLookupTable(_satLut); _coronalColors->SetLookupTable(_ctfun); - if(_coronal==NULL){ + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _coronalColors->SetInput( _vtkmprbasedata->GetImageData() ); +#else + _coronalColors->SetInputData( _vtkmprbasedata->GetImageData() ); + _coronalColors->Update(); +#endif + + + if(_coronal==NULL) + { _coronal = vtkImageActor::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _coronal->SetInput(_coronalColors->GetOutput()); - } - - +#else + _coronal->SetInputData(_coronalColors->GetOutput()); +#endif + } // if _coronal + // An outline provides context around the data. // - if(_outlineData==NULL){ + if(_outlineData==NULL) + { _outlineData = vtkOutlineFilter::New(); - } + } // if _outlineData _outlineData->RemoveAllInputs(); - if(_vtkmprbasedata->GetImageData()){ + if(_vtkmprbasedata->GetImageData()) + { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() ); - } +#else + _outlineData->SetInputData((vtkDataSet *) _vtkmprbasedata->GetImageData() ); + _outlineData->Update(); +#endif + } // if _image - if(_mapOutline==NULL){ + if(_mapOutline==NULL) + { _mapOutline = vtkPolyDataMapper::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _mapOutline->SetInput(_outlineData->GetOutput()); +#else + _mapOutline->SetInputData(_outlineData->GetOutput()); +#endif + } _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); - - - - } //------------------------------------------------------------------- @@ -394,7 +478,8 @@ bool vtkMPR3DDataViewer::GetVisiblePosition(int idPosition) return _visiblePosition[idPosition]; } -void vtkMPR3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){ +void vtkMPR3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable) +{ if(_saggitalColors) { _saggitalColors->SetLookupTable(colortable);