X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvSlicerManager.cxx;h=3f6f9139fc2e1bec9540eb3480dc49c52b2fdc34;hb=031521534da503d7a4f32d97568e8ad567e73092;hp=e739eef8e56f866983a78d28a5fbeb0fa3eff33b;hpb=318e088575f1fe3e043230f829e8175b316ca056;p=clitk.git diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index e739eef..3f6f913 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -62,7 +62,8 @@ vvSlicerManager::vvSlicerManager(int numberOfSlicers) mFusionColorMap = 3; mFusionWindow = 1000; mFusionLevel = 1000; - + mFusionShowLegend = true; + mLandmarks = NULL; mLinkedId.resize(0); @@ -1116,13 +1117,17 @@ void vvSlicerManager::SetLocalColorWindowing(const int slicer, const bool bCtrlK double min, max; int t = this->mSlicers[slicer]->GetTSlice(); if(bCtrlKey && this->mSlicers[slicer]->GetFusion()) { - this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max, this->mSlicers[slicer]->GetFusion()->GetVTKImages()[t]); + this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max, + this->mSlicers[slicer]->GetFusion()->GetVTKImages()[t], + this->mSlicers[slicer]->GetFusion()->GetTransform()); this->SetFusionWindow(max-min); this->SetFusionLevel(0.5*(min+max)); this->SetColorMap(mColorMap); } else if(bCtrlKey && this->mSlicers[slicer]->GetOverlay()) { - this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max, this->mSlicers[slicer]->GetOverlay()->GetVTKImages()[t]); + this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max, + this->mSlicers[slicer]->GetOverlay()->GetVTKImages()[t], + this->mSlicers[slicer]->GetOverlay()->GetTransform()); if(this->mSlicers[slicer]->GetLinkOverlayWindowLevel()){ this->SetColorWindow(max-min); this->SetColorLevel(0.5*(min+max)); @@ -1132,7 +1137,9 @@ void vvSlicerManager::SetLocalColorWindowing(const int slicer, const bool bCtrlK } } else { - this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max, this->mSlicers[slicer]->GetInput()); + this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max, + this->mSlicers[slicer]->GetImage()->GetVTKImages()[t], + this->mSlicers[slicer]->GetImage()->GetTransform()); this->SetColorWindow(max-min); this->SetColorLevel(0.5*(min+max)); this->SetPreset(6); @@ -1184,14 +1191,15 @@ void vvSlicerManager::SetColorMap(int colormap) case 4: if (LUT == NULL) LUT = vtkLookupTable::New(); - LUT->SetValueRange(0,1); + LUT->SetValueRange(1,1); LUT->SetSaturationRange(1,1); LUT->SetHueRange(0,1); + LUT->SetAlphaRange(1, 1); break; case 5: if (LUT == NULL) LUT = vtkLookupTable::New(); - LUT->SetValueRange(0.,1); + LUT->SetValueRange(1,1); LUT->SetSaturationRange(1,1); LUT->SetHueRange(1,0.1); //LUT->SetRampToLinear(); @@ -1232,15 +1240,20 @@ void vvSlicerManager::SetColorMap(int colormap) } fusLUT->ForceBuild(); + double v[4]; // set color table transparency - double alpha_range_end = frange[0] + (double)mFusionThresOpacity*(frange[1] - frange[0])/100; - for (double i = frange[0]; i < alpha_range_end; i++) { - double v[4]; - vtkIdType index = fusLUT->GetIndex(i); - fusLUT->GetTableValue(index, v); + //double alpha_range=(double)mFusionThresOpacity/10; + double range_end = fusRange[0] + (double)mFusionThresOpacity*(fusRange[1] - fusRange[0])/100; + double curr_value = fusRange[0]; + int nvalues = fusLUT->GetNumberOfTableValues(); + for (double i = 0; curr_value < range_end; i++) { + fusLUT->GetTableValue(i, v); v[3] = 0; - fusLUT->SetTableValue(index, v); + //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 += (fusRange[1] - fusRange[0])/nvalues; } } for ( unsigned int i = 0; i < mSlicers.size(); i++) { @@ -1273,6 +1286,7 @@ void vvSlicerManager::SetColorMap(int colormap) } if (mSlicers[i]->GetFusion()) { + mSlicers[i]->ShowFusionLegend(mFusionShowLegend); mSlicers[i]->GetFusionMapper()->SetLookupTable(fusLUT); mSlicers[i]->GetFusionActor()->SetOpacity(double(mFusionOpacity)/100); }