From d71eb767914726a9fbfa51d95b518b959d0bb4a5 Mon Sep 17 00:00:00 2001 From: Romulo Pinho Date: Thu, 19 Apr 2012 16:19:21 +0200 Subject: [PATCH] fusion legend is now an option --- vv/qt_ui/vvOverlayPanel.ui | 81 +++++++++++++++++++++----------------- vv/vvMainWindow.cxx | 7 ++-- vv/vvMainWindow.h | 2 +- vv/vvOverlayPanel.cxx | 7 +++- vv/vvOverlayPanel.h | 4 +- vv/vvSlicer.cxx | 3 +- vv/vvSlicer.h | 2 + vv/vvSlicerManager.cxx | 4 +- vv/vvSlicerManager.h | 4 ++ 9 files changed, 69 insertions(+), 45 deletions(-) diff --git a/vv/qt_ui/vvOverlayPanel.ui b/vv/qt_ui/vvOverlayPanel.ui index dfe6ede..dd7c83d 100644 --- a/vv/qt_ui/vvOverlayPanel.ui +++ b/vv/qt_ui/vvOverlayPanel.ui @@ -535,46 +535,14 @@ p, li { white-space: pre-wrap; } - - - - 0 - - - - B&W - - - - - Heat - - - - - Cold - - - - - Dosimetry - - - - - Full Color Range - - - - - + Window : - + 4 @@ -593,14 +561,14 @@ p, li { white-space: pre-wrap; } - + Level : - + 4 @@ -619,7 +587,7 @@ p, li { white-space: pre-wrap; } - + @@ -632,6 +600,45 @@ p, li { white-space: pre-wrap; } + + + + 0 + + + + B&W + + + + + Heat + + + + + Cold + + + + + Dosimetry + + + + + Full Color Range + + + + + + + + Show legend + + + diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 303ab3a..c08462c 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -316,8 +316,8 @@ vvMainWindow::vvMainWindow():vvMainWindowBase() connect(overlayPanel,SIGNAL(VFPropertyUpdated(int,int,int,int,double,double,double)),this,SLOT(SetVFProperty(int,int,int,int,double,double,double))); connect(overlayPanel,SIGNAL(OverlayPropertyUpdated(int,int,double,double)), this,SLOT(SetOverlayProperty(int,int,double,double))); - connect(overlayPanel,SIGNAL(FusionPropertyUpdated(int,int,int,double,double)), - this,SLOT(SetFusionProperty(int,int,int,double,double))); + connect(overlayPanel,SIGNAL(FusionPropertyUpdated(int,int,int,double,double, bool)), + this,SLOT(SetFusionProperty(int,int,int,double,double, bool))); connect(landmarksPanel,SIGNAL(UpdateRenderWindows()),this,SLOT(UpdateRenderWindows())); playMode = 0;//pause @@ -2221,7 +2221,7 @@ void vvMainWindow::SetOverlayProperty(int color, int linked, double window, doub //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ -void vvMainWindow::SetFusionProperty(int opacity, int thresOpacity, int colormap,double window, double level) +void vvMainWindow::SetFusionProperty(int opacity, int thresOpacity, int colormap,double window, double level, bool showLegend) { int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); if (mSlicerManagers[index]->GetSlicer(0)->GetFusion()) { @@ -2230,6 +2230,7 @@ void vvMainWindow::SetFusionProperty(int opacity, int thresOpacity, int colormap mSlicerManagers[index]->SetFusionThresholdOpacity(thresOpacity); mSlicerManagers[index]->SetFusionWindow(window); mSlicerManagers[index]->SetFusionLevel(level); + mSlicerManagers[index]->SetFusionShowLegend(showLegend); mSlicerManagers[index]->SetColorMap(0); mSlicerManagers[index]->Render(); } diff --git a/vv/vvMainWindow.h b/vv/vvMainWindow.h index 1650571..bbdfe26 100644 --- a/vv/vvMainWindow.h +++ b/vv/vvMainWindow.h @@ -154,7 +154,7 @@ public slots: void SetVFProperty(int subsampling,int scale,int lut, int width, double r, double g, double b); void SetOverlayProperty(int color, int linked, double window, double level); - void SetFusionProperty(int opacity, int tresOpacity, int colormap,double window,double level); + void SetFusionProperty(int opacity, int tresOpacity, int colormap,double window,double level, bool showLegend); void GoToCursor(); void PlayPause(); diff --git a/vv/vvOverlayPanel.cxx b/vv/vvOverlayPanel.cxx index 28d8939..bbd2443 100644 --- a/vv/vvOverlayPanel.cxx +++ b/vv/vvOverlayPanel.cxx @@ -38,6 +38,8 @@ vvOverlayPanel::vvOverlayPanel(QWidget * parent):QWidget(parent) scaleSpinBox->setEnabled(0); lutCheckBox->hide(); lutCheckBox->setEnabled(0); + fusionShowLegendCheckBox->setChecked(true); + connect(subSamplingSpinBox,SIGNAL(editingFinished()),this,SLOT(setVFProperty())); connect(scaleSpinBox,SIGNAL(editingFinished()),this,SLOT(setVFProperty())); connect(lutCheckBox,SIGNAL(clicked()),this,SLOT(setVFProperty())); @@ -51,6 +53,7 @@ vvOverlayPanel::vvOverlayPanel(QWidget * parent):QWidget(parent) connect(fusionLevelSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty())); connect(fusionOpacitySpin,SIGNAL(valueChanged(double)),this,SLOT(setFusionSpinProperty())); connect(fusionThresSpin,SIGNAL(valueChanged(double)),this,SLOT(setFusionSpinProperty())); + connect(fusionShowLegendCheckBox,SIGNAL(stateChanged(int)),this,SLOT(setFusionProperty())); connect(overlayWindowSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setOverlayProperty())); connect(overlayLevelSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setOverlayProperty())); connect(overlayLinkCheckBox,SIGNAL(stateChanged(int)),this,SLOT(setOverlayProperty())); @@ -227,7 +230,7 @@ void vvOverlayPanel::setFusionProperty() fusionThresSpin->setValue(thresOpacityHorizontalSlider->value()); emit FusionPropertyUpdated(opacityHorizontalSlider->value(), thresOpacityHorizontalSlider->value(), fusionColorMapComboBox->currentIndex(), - fusionWindowSpinBox->value(), fusionLevelSpinBox->value()); + fusionWindowSpinBox->value(), fusionLevelSpinBox->value(), fusionShowLegendCheckBox->isChecked()); } void vvOverlayPanel::setFusionSpinProperty() @@ -255,5 +258,7 @@ void vvOverlayPanel::VFColorChangeRequest() this->setVFProperty(); } + + #endif /* end #define _vvOverlayPanel_CXX */ diff --git a/vv/vvOverlayPanel.h b/vv/vvOverlayPanel.h index 4a89a1f..bd9e972 100644 --- a/vv/vvOverlayPanel.h +++ b/vv/vvOverlayPanel.h @@ -47,6 +47,8 @@ public: void getCurrentVectorInfo(int visibility, double x, double y, double z, double value); void getCurrentOverlayInfo(int visibility,double valueOver, double valueRef); void getCurrentFusionInfo(int visibility,double value); + + bool getShowLegend(); public slots: void setVFProperty(); @@ -58,7 +60,7 @@ public slots: signals: void VFPropertyUpdated(int subsampling, int scale, int log, int width, double r, double g, double b); void OverlayPropertyUpdated(int color, int linked, double window, double level); - void FusionPropertyUpdated(int opacity, int thresOpacity, int colormap, double window, double level); + void FusionPropertyUpdated(int opacity, int thresOpacity, int colormap, double window, double level, bool showLegend); private: diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index 714d3d9..cba898c 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -130,6 +130,7 @@ vvSlicer::vvSlicer() legend->SetVisibility(0); legend->SetLabelFormat("%.1f"); this->GetRenderer()->AddActor(legend); + showFusionLegend = true; this->WindowLevel->Delete(); this->WindowLevel = vvImageMapToWLColors::New(); @@ -1241,7 +1242,7 @@ double vvSlicer::GetScalarComponentAsDouble(vtkImageData *image, double X, doubl //---------------------------------------------------------------------------- void vvSlicer::Render() { - if (this->mFusion) { + if (this->mFusion && showFusionLegend) { legend->SetLookupTable(this->GetFusionMapper()->GetLookupTable()); legend->UseOpacityOn(); legend->SetVisibility(1); diff --git a/vv/vvSlicer.h b/vv/vvSlicer.h index a5156f2..b9cc334 100644 --- a/vv/vvSlicer.h +++ b/vv/vvSlicer.h @@ -80,6 +80,7 @@ public: vvImage::Pointer GetFusion() { return mFusion; } + void ShowFusionLegend(bool show) { showFusionLegend = show; } /**Get/Set an actor's visibility ("overlay, fusion, vf, contour...") Overlay index is the index of the overlay by type, eg. if there are @@ -244,6 +245,7 @@ protected: int * mReducedExtent; int * mInitialExtent; bool mLinkOverlayWindowLevel; + bool showFusionLegend; private: void UpdateOrientation(); diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index 2373aba..7cce9dd 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); @@ -1279,6 +1280,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); } diff --git a/vv/vvSlicerManager.h b/vv/vvSlicerManager.h index aff339a..9858d69 100644 --- a/vv/vvSlicerManager.h +++ b/vv/vvSlicerManager.h @@ -136,6 +136,9 @@ class vvSlicerManager : public QObject { void SetFusionLevel(double level) { mFusionLevel = level; } + void SetFusionShowLegend(int show) { + mFusionShowLegend = show; + } double GetColorWindow(); double GetColorLevel(); @@ -245,6 +248,7 @@ protected: int mFusionColorMap; double mFusionWindow; double mFusionLevel; + bool mFusionShowLegend; int mPreset; vvImageReader::LoadedImageType mType; -- 2.45.1