From 1d97c744a9d7726cbd8c64ee22b17d10c3820d3e Mon Sep 17 00:00:00 2001 From: Romulo Pinho Date: Wed, 18 Apr 2012 16:11:27 +0200 Subject: [PATCH] image fusion now display colour legend too - even the alpha threshold --- vv/vvSlicer.cxx | 8 +++++++- vv/vvSlicerManager.cxx | 8 +++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index d2a6ba7..714d3d9 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -1241,8 +1241,14 @@ double vvSlicer::GetScalarComponentAsDouble(vtkImageData *image, double X, doubl //---------------------------------------------------------------------------- void vvSlicer::Render() { - if (this->GetWindowLevel()->GetLookupTable() && !this->mOverlay && !this->mFusion) { + if (this->mFusion) { + legend->SetLookupTable(this->GetFusionMapper()->GetLookupTable()); + legend->UseOpacityOn(); + legend->SetVisibility(1); + } + else if (this->GetWindowLevel()->GetLookupTable()) {// && !this->mOverlay && !this->mFusion) { legend->SetLookupTable(this->GetWindowLevel()->GetLookupTable()); + legend->UseOpacityOff(); legend->SetVisibility(1); } else legend->SetVisibility(0); diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index d9ed42e..2373aba 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -1236,15 +1236,17 @@ void vvSlicerManager::SetColorMap(int colormap) double v[4]; // set color table transparency + double alpha_range=(double)mFusionThresOpacity/10; double range_end = frange[0] + (double)mFusionThresOpacity*(frange[1] - frange[0])/100; - double curr_value = frange[0]; + double curr_value = fusRange[0]; int nvalues = fusLUT->GetNumberOfTableValues(); - //for (double i = frange[0]; i <= alpha_range_end; i++) { for (double i = 0; curr_value < range_end; i++) { fusLUT->GetTableValue(i, v); v[3] = 0; + //if (curr_value >= -alpha_range && curr_value <= alpha_range) v[3] = pow(fabs(curr_value/alpha_range),2); + //else v[3] = 1; fusLUT->SetTableValue(i, v); - curr_value += (frange[1] - frange[0])/nvalues; + curr_value += (fusRange[1] - fusRange[0])/nvalues; } } for ( unsigned int i = 0; i < mSlicers.size(); i++) { -- 2.47.1