Commit 68fb51f7 authored by finetjul's avatar finetjul
Browse files

ENH: Update the qMRMLSliceControllerWidget when nodes are modified

git-svn-id: http://svn.slicer.org/Slicer4/trunk@14699 3bd1e089-480b-0410-8dfb-8563597acbee
parent 11bbe54c
......@@ -422,7 +422,7 @@ Use this display to cross-reference to filmed images or other displays.</string>
<normalon>:/Icons/SlicesLabelOutline.png</normalon>:/Icons/SlicesLabelNoOutline.png</iconset>
</property>
<property name="text">
<string>Don't show label volume outlines</string>
<string>Hide label volume outlines</string>
</property>
<property name="toolTip">
<string>Toggle between showing label map volume with regions outlined or filled.</string>
......@@ -442,21 +442,33 @@ Use this display to cross-reference to filmed images or other displays.</string>
</property>
</action>
<action name="actionCompositingAlpha_blend">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Alpha blend</string>
</property>
</action>
<action name="actionCompositingReverse_alpha_blend">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Reverse alpha blend</string>
</property>
</action>
<action name="actionCompositingAdd">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Add</string>
</property>
</action>
<action name="actionCompositingSubtract">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Subtract</string>
</property>
......@@ -473,18 +485,6 @@ Use this display to cross-reference to filmed images or other displays.</string>
<string>Automatic</string>
</property>
</action>
<action name="actionSliceSpacingModeManual">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../qMRMLWidgets.qrc">
<normaloff>:/Icons/SlicerAutomaticSliceSpacing.png</normaloff>:/Icons/SlicerAutomaticSliceSpacing.png</iconset>
</property>
<property name="text">
<string>Manual</string>
</property>
</action>
<action name="actionLightbox1x1_view">
<property name="checkable">
<bool>true</bool>
......@@ -557,14 +557,6 @@ Use this display to cross-reference to filmed images or other displays.</string>
<string>6x6 view</string>
</property>
</action>
<action name="actionLightboxCustomized_view">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>customized view</string>
</property>
</action>
<action name="actionAdjustDisplayForeground_volume">
<property name="checkable">
<bool>true</bool>
......
......@@ -214,6 +214,11 @@ void qMRMLSliceControllerWidgetPrivate::setupMoreOptionsMenu()
compositingMenu->addAction(this->actionCompositingReverse_alpha_blend);
compositingMenu->addAction(this->actionCompositingAdd);
compositingMenu->addAction(this->actionCompositingSubtract);
QActionGroup* compositingGroup = new QActionGroup(compositingMenu);
compositingGroup->addAction(this->actionCompositingAlpha_blend);
compositingGroup->addAction(this->actionCompositingReverse_alpha_blend);
compositingGroup->addAction(this->actionCompositingAdd);
compositingGroup->addAction(this->actionCompositingSubtract);
advancedMenu->addMenu(compositingMenu);
// Spacing mode
QMenu* sliceSpacingMode = new QMenu(tr("Slice spacing mode"), advancedMenu);
......@@ -325,6 +330,31 @@ void qMRMLSliceControllerWidgetPrivate::updateWidgetFromMRMLSliceNode()
// Update slice visibility toggle
this->SliceVisibilityButton->setChecked(this->MRMLSliceNode->GetSliceVisible());
// Label Outline
bool showOutline = this->MRMLSliceNode->GetUseLabelOutline();
this->actionShow_label_volume_outline->setChecked(showOutline);
this->actionShow_label_volume_outline->setText(showOutline ?
tr("Hide label volume outlines") : tr("Show label volume outlines"));
// Reformat
bool showReformat = this->MRMLSliceNode->GetWidgetVisible();
this->actionShow_reformat_widget->setChecked(showReformat);
this->actionShow_reformat_widget->setText(
showReformat ? tr("Hide reformat widget"): tr("Show reformat widget"));
// Slice spacing mode
this->actionSliceSpacingModeAutomatic->setChecked(
this->MRMLSliceNode->GetSliceSpacingMode() == vtkMRMLSliceNode::AutomaticSliceSpacingMode);
int rows = this->MRMLSliceNode->GetLayoutGridRows();
int columns = this->MRMLSliceNode->GetLayoutGridColumns();
this->actionLightbox1x1_view->setChecked(rows == 1 && columns == 1);
this->actionLightbox1x2_view->setChecked(rows == 1 && columns == 2);
this->actionLightbox1x3_view->setChecked(rows == 1 && columns == 3);
this->actionLightbox1x4_view->setChecked(rows == 1 && columns == 4);
this->actionLightbox1x6_view->setChecked(rows == 1 && columns == 6);
this->actionLightbox1x8_view->setChecked(rows == 1 && columns == 8);
this->actionLightbox2x2_view->setChecked(rows == 2 && columns == 2);
this->actionLightbox3x3_view->setChecked(rows == 3 && columns == 3);
this->actionLightbox6x6_view->setChecked(rows == 6 && columns == 6);
}
// --------------------------------------------------------------------------
......@@ -354,6 +384,26 @@ void qMRMLSliceControllerWidgetPrivate::updateWidgetFromMRMLSliceCompositeNode()
// Update slice link toggle
this->SliceLinkButton->setChecked(this->MRMLSliceCompositeNode->GetLinkedControl());
// Label opacity
this->LabelOpacitySlider->setValue(this->MRMLSliceCompositeNode->GetLabelOpacity());
// Compositing
switch(this->MRMLSliceCompositeNode->GetCompositing())
{
case vtkMRMLSliceCompositeNode::Alpha:
this->actionCompositingAlpha_blend->setChecked(true);
break;
case vtkMRMLSliceCompositeNode::ReverseAlpha:
this->actionCompositingReverse_alpha_blend->setChecked(true);
break;
case vtkMRMLSliceCompositeNode::Add:
this->actionCompositingAdd->setChecked(true);
break;
case vtkMRMLSliceCompositeNode::Subtract:
this->actionCompositingSubtract->setChecked(true);
break;
}
}
// --------------------------------------------------------------------------
......@@ -525,6 +575,7 @@ void qMRMLSliceControllerWidgetPrivate::setForegroundInterpolation(vtkMRMLSliceL
if (displayNode)
{
p->mrmlScene()->SaveStateForUndo(displayNode);
// TODO, update the QAction when the display node is modified
displayNode->SetInterpolate(interpolate);
vtkMRMLVolumeNode* volumeNode = sliceLogic->GetForegroundLayer()->GetVolumeNode();
if (volumeNode)
......@@ -543,6 +594,7 @@ void qMRMLSliceControllerWidgetPrivate::setBackgroundInterpolation(vtkMRMLSliceL
if (displayNode)
{
p->mrmlScene()->SaveStateForUndo(displayNode);
// TODO, update the QAction when the display node is modified
displayNode->SetInterpolate(interpolate);
vtkMRMLVolumeNode* volumeNode = sliceLogic->GetBackgroundLayer()->GetVolumeNode();
if (volumeNode)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment