X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FThresholdImageView%2FLayerImageBase.cxx;h=f2ebd6f981d0099dcfbbb481bcefa969de89ec17;hb=cef231b63d21ad7ac9914306a0a012666c24f00a;hp=d7e3e7284cfb40319a7f7f6176bcbccf876ae29a;hpb=2154a89395b7e9869b0e3dea859425d52a5aa9bd;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx index d7e3e72..f2ebd6f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx @@ -67,7 +67,7 @@ class ColorLayerObserver : public vtkCommand{ _layerimagebase->SetX( vtkmprbasedata->GetX() ); _layerimagebase->SetY( vtkmprbasedata->GetY() ); _layerimagebase->SetZ( vtkmprbasedata->GetZ() ); - _layerimagebase->onThresholdChange(); + _layerimagebase->onThresholdChange(); } // if basedata } // if wxvtkbaseview @@ -191,6 +191,7 @@ void LayerImageBase::SetImage(vtkImageData* image) spcBase[5]=0; _image = image; + _image->Update(); _image->GetWholeExtent(ext); dimensionOriginalLayer[0] = ext[1]-ext[0]+1; dimensionOriginalLayer[1] = ext[3]-ext[2]+1; @@ -216,7 +217,6 @@ void LayerImageBase::SetImage(vtkImageData* image) SetZ( dimBase[2]*spcBase[2]/2 ); } // if imagebase } // if wxvtkbaseview - _image->Update(); _image->GetScalarRange( _range ); _thresholdTable = vtkLookupTable::New(); @@ -301,6 +301,12 @@ void LayerImageBase::GetDimensionBase(int *dim) } +//------------------------------------------------------------------------------ +void LayerImageBase::SetColorBarPosition(std::vector &colorbarposition) +{ + _colorBarPosition=colorbarposition; +} + //------------------------------------------------------------------------------ void LayerImageBase::SetRangeForColorBar(std::vector &range) { @@ -389,24 +395,6 @@ void LayerImageBase::CleanXYZ(double &x, double &y, double &z) z = maxSize; } -/* - - if ( x > (ext[1]-ext[0]) ) - { - z=ext[1]-ext[0]; - } - - if ( y > (ext[3]-ext[2]) ) - { - z=ext[3]-ext[2]; - } - - if ( z > (ext[5]-ext[4]) ) - { - z=ext[5]-ext[4]; - } -*/ - } //---------------------------------------------------------------------------- @@ -418,10 +406,12 @@ void LayerImageBase::onThreshold() double y=GetY(); double z=GetZ(); + x = x*_spcBase[0]; y = y*_spcBase[1]; z = z*_spcBase[2]; + CleanXYZ(x,y,z); vtkCamera *camera = _baseView->GetRenderer()->GetActiveCamera(); @@ -432,6 +422,7 @@ void LayerImageBase::onThreshold() directionViewer = wxvtk2dbasevie->GetDirection(); } // ParallelProjection + if (!GetActorPresent()) { if (_thresholdTable==NULL) @@ -449,8 +440,16 @@ void LayerImageBase::onThreshold() { _thresholdActor = vtkImageActor::New( ); _scalarbarActor = vtkScalarBarActor::New(); - _thresholdActor->SetOpacity( 0.6 ); + if (_colorBarPosition.size()==2) + { + _scalarbarActor->SetDisplayPosition(_colorBarPosition[0],_colorBarPosition[1]); + } else { + _scalarbarActor->SetDisplayPosition(0,0); + } + + _thresholdActor->SetOpacity( 0 ); _thresholdActor->InterpolateOn( ); + if (directionViewer==0) { _thresholdActor->SetPosition( 900-1,0,0 ); @@ -553,7 +552,7 @@ void LayerImageBase::onThresholdChangeOpacity (int opacity) { if (_actorPresent) { - _thresholdActor->SetOpacity(opacity*0.1); + _thresholdActor->SetOpacity(opacity/100.0); } }