X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvSlicerManager.cxx;h=c38496e5ab50b2389311eb4788f8f8ee428a0178;hb=98eb0c23b8066792d7a77e571fb7d48c9fe02db6;hp=987162cc6b420a0d3c8d25e557174c5b5e27945e;hpb=d48812f39b193a9a8268020574cc8b374bcf73a4;p=clitk.git diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index 987162c..c38496e 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -512,7 +512,6 @@ void vvSlicerManager::SetColorWindow(double s) } //---------------------------------------------------------------------------- - //---------------------------------------------------------------------------- void vvSlicerManager::SetColorLevel(double s) { @@ -522,6 +521,33 @@ void vvSlicerManager::SetColorLevel(double s) } //---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +void vvSlicerManager::SetOverlayColorWindow(double s) +{ + for ( unsigned int i = 0; i < mSlicers.size(); i++) { + mSlicers[i]->SetOverlayColorWindow(s); + } +} +//---------------------------------------------------------------------------- + +//---------------------------------------------------------------------------- +void vvSlicerManager::SetOverlayColorLevel(double s) +{ + for ( unsigned int i = 0; i < mSlicers.size(); i++) { + mSlicers[i]->SetOverlayColorLevel(s); + } +} +//---------------------------------------------------------------------------- + +//---------------------------------------------------------------------------- +void vvSlicerManager::SetLinkOverlayWindowLevel(bool b) +{ + for ( unsigned int i = 0; i < mSlicers.size(); i++) { + mSlicers[i]->SetLinkOverlayWindowLevel(b); + } +} +//---------------------------------------------------------------------------- + //---------------------------------------------------------------------------- void vvSlicerManager::SetCursorAndCornerAnnotationVisibility(int s) { @@ -736,6 +762,54 @@ double vvSlicerManager::GetColorLevel() } //---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +double vvSlicerManager::GetOverlayColorWindow() +{ + if (mSlicers.size()) + return mSlicers[0]->GetOverlayColorWindow(); + return -1; +} +//---------------------------------------------------------------------------- + +//---------------------------------------------------------------------------- +double vvSlicerManager::GetOverlayColorLevel() +{ + if (mSlicers.size()) + return mSlicers[0]->GetOverlayColorLevel(); + return -1; +} +//---------------------------------------------------------------------------- + +//---------------------------------------------------------------------------- +bool vvSlicerManager::GetLinkOverlayWindowLevel() +{ + if (mSlicers.size()) + return mSlicers[0]->GetLinkOverlayWindowLevel(); + return -1; +} +//---------------------------------------------------------------------------- + +//------------------------------------------------------------------------------ +void vvSlicerManager::ResetTransformationToIdentity(const std::string actorType) +{ + if(actorType == "image") + this->GetImage()->GetTransform()->Identity(); + else if(actorType == "overlay") + this->GetSlicer(0)->GetOverlay()->GetTransform()->Identity(); + else if(actorType == "fusion") + this->GetSlicer(0)->GetFusion()->GetTransform()->Identity(); + else if(actorType == "vf") + this->GetVF()->GetTransform()->Identity(); + else + return; + + for(int i=0; i< this->GetNumberOfSlicers(); i++){ + this->GetSlicer(i)->ForceUpdateDisplayExtent(); + this->GetSlicer(i)->ResetCamera(); + this->GetSlicer(i)->Render(); + } +} +//------------------------------------------------------------------------------ //---------------------------------------------------------------------------- void vvSlicerManager::Render() @@ -929,10 +1003,11 @@ void vvSlicerManager::Picked() } //---------------------------------------------------------------------------- + //---------------------------------------------------------------------------- void vvSlicerManager::UpdateWindowLevel() { - emit WindowLevelChanged(mSlicers[0]->GetColorWindow(),mSlicers[0]->GetColorLevel(),mPreset,mColorMap); + emit WindowLevelChanged(); } //---------------------------------------------------------------------------- @@ -1036,14 +1111,34 @@ void vvSlicerManager::SetPreset(int preset) //---------------------------------------------------------------------------- -void vvSlicerManager::SetLocalColorWindowing(const int slicer) +void vvSlicerManager::SetLocalColorWindowing(const int slicer, const bool bCtrlKey) { double min, max; - this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max); - this->SetColorWindow(max-min); - this->SetColorLevel(0.5*(min+max)); - this->UpdateWindowLevel(); + 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->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]); + if(this->mSlicers[slicer]->GetLinkOverlayWindowLevel()){ + this->SetColorWindow(max-min); + this->SetColorLevel(0.5*(min+max)); + } else { + this->SetOverlayColorWindow(max-min); + this->SetOverlayColorLevel(0.5*(min+max)); + } + } + else { + this->mSlicers[slicer]->GetExtremasAroundMousePointer(min, max, this->mSlicers[slicer]->GetInput()); + this->SetColorWindow(max-min); + this->SetColorLevel(0.5*(min+max)); + this->SetPreset(6); + } this->Render(); + this->UpdateWindowLevel(); } //----------------------------------------------------------------------------