-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Add option for displaying vertical slice controller
The slice controller currently can only display the slice offset slider, but more controls can be added later. Vertical slice offset slider is implemented because: - it has become the standard for slice browsing in medical image viewers. - it allows saving some precious screen real estate vertically: the horizontal slice controller at the top of the slice view can be hidden in custom applications that do not require sophisticated slice manipulation. - if the slice offset slider is displayed on the side then there is space for more buttons in the slice view controller at the top - reducing the need to push the little push-pin icon to access certain features The feature is still being developed, so there is no GUI yet for enabling vertical slice offset slider and hide slice view controller at the top, but these can be activated in Python in custom modules and applications: for slice in ['Red', 'Yellow', 'Green']: sw = slicer.app.layoutManager().sliceWidget(slice) sw.setSliceOffsetSliderOrientation(qt.Qt.Vertical) #sw.setSliceOffsetSliderOrientation(qt.Qt.Horizontal) sw.sliceController().setVisible(False) #sw.sliceController().setVisible(True)
- Loading branch information
Showing
19 changed files
with
894 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
Libs/MRML/Widgets/DesignerPlugins/qMRMLSliceVerticalControllerWidgetPlugin.cxx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "qMRMLSliceVerticalControllerWidgetPlugin.h" | ||
#include "qMRMLSliceVerticalControllerWidget.h" | ||
|
||
// -------------------------------------------------------------------------- | ||
qMRMLSliceVerticalControllerWidgetPlugin::qMRMLSliceVerticalControllerWidgetPlugin(QObject *_parent) | ||
: QObject(_parent) | ||
{ | ||
} | ||
|
||
// -------------------------------------------------------------------------- | ||
QWidget *qMRMLSliceVerticalControllerWidgetPlugin::createWidget(QWidget *_parent) | ||
{ | ||
qMRMLSliceVerticalControllerWidget* _widget = new qMRMLSliceVerticalControllerWidget(_parent); | ||
return _widget; | ||
} | ||
|
||
// -------------------------------------------------------------------------- | ||
QString qMRMLSliceVerticalControllerWidgetPlugin::domXml() const | ||
{ | ||
return "<ui language=\"c++\">\n" | ||
"<widget class=\"qMRMLSliceVerticalControllerWidget\" name=\"MRMLSliceVerticalControllerWidget\">\n" | ||
"</widget>\n" | ||
"</ui>\n"; | ||
} | ||
|
||
// -------------------------------------------------------------------------- | ||
QIcon qMRMLSliceVerticalControllerWidgetPlugin::icon() const | ||
{ | ||
return QIcon(); | ||
} | ||
|
||
// -------------------------------------------------------------------------- | ||
QString qMRMLSliceVerticalControllerWidgetPlugin::includeFile() const | ||
{ | ||
return "qMRMLSliceVerticalControllerWidget.h"; | ||
} | ||
|
||
// -------------------------------------------------------------------------- | ||
bool qMRMLSliceVerticalControllerWidgetPlugin::isContainer() const | ||
{ | ||
return false; | ||
} | ||
|
||
// -------------------------------------------------------------------------- | ||
QString qMRMLSliceVerticalControllerWidgetPlugin::name() const | ||
{ | ||
return "qMRMLSliceVerticalControllerWidget"; | ||
} |
23 changes: 23 additions & 0 deletions
23
Libs/MRML/Widgets/DesignerPlugins/qMRMLSliceVerticalControllerWidgetPlugin.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef __qMRMLSliceVerticalControllerWidgetPlugin_h | ||
#define __qMRMLSliceVerticalControllerWidgetPlugin_h | ||
|
||
#include "qMRMLWidgetsAbstractPlugin.h" | ||
|
||
class QMRML_WIDGETS_PLUGINS_EXPORT qMRMLSliceVerticalControllerWidgetPlugin : public QObject, | ||
public qMRMLWidgetsAbstractPlugin | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
qMRMLSliceVerticalControllerWidgetPlugin(QObject *_parent = nullptr); | ||
|
||
QWidget *createWidget(QWidget *_parent) override; | ||
QString domXml() const override; | ||
QIcon icon() const override; | ||
QString includeFile() const override; | ||
bool isContainer() const override; | ||
QString name() const override; | ||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
Libs/MRML/Widgets/Resources/UI/qMRMLSliceVerticalControllerWidget.ui
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>qMRMLSliceVerticalControllerWidget</class> | ||
<widget class="qMRMLWidget" name="qMRMLSliceVerticalControllerWidget"> | ||
<property name="enabled"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>84</width> | ||
<height>319</height> | ||
</rect> | ||
</property> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="minimumSize"> | ||
<size> | ||
<width>0</width> | ||
<height>0</height> | ||
</size> | ||
</property> | ||
<property name="maximumSize"> | ||
<size> | ||
<width>16777215</width> | ||
<height>16777215</height> | ||
</size> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Vertical Slice Controller</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<property name="leftMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="topMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="rightMargin"> | ||
<number>0</number> | ||
</property> | ||
<property name="bottomMargin"> | ||
<number>0</number> | ||
</property> | ||
<item> | ||
<widget class="qMRMLSliderWidget" name="SliceVerticalOffsetSlider"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="styleSheet"> | ||
<string notr="true">QSlider::groove:vertical { | ||
background-color: black; | ||
margin: 0px 0px 0px 0px; | ||
border: none; | ||
width: 12px; | ||
} | ||
|
||
QSlider::handle:vertical { | ||
background-color: rgba(200, 200, 200, 200);; | ||
border-width: 1px; | ||
margin-top: -5px; | ||
margin-bottom: -5px; | ||
height: 50px; | ||
border-radius: 5px; | ||
} | ||
|
||
QSlider::handle:vertical:hover { | ||
background-color: rgba(150, 150, 150, 200); | ||
border-radius: 5px; | ||
} | ||
|
||
QSlider::handle:vertical:pressed { | ||
background-color: rgba(0, 150, 150, 200); | ||
border-radius: 5px; | ||
}</string> | ||
</property> | ||
<property name="spinBoxVisible"> | ||
<bool>false</bool> | ||
</property> | ||
<property name="quantity"> | ||
<string notr="true">length</string> | ||
</property> | ||
<property name="orientation"> | ||
<enum>Qt::Vertical</enum> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<customwidgets> | ||
<customwidget> | ||
<class>qMRMLSliderWidget</class> | ||
<extends>ctkSliderWidget</extends> | ||
<header>qMRMLSliderWidget.h</header> | ||
</customwidget> | ||
<customwidget> | ||
<class>qMRMLWidget</class> | ||
<extends>QWidget</extends> | ||
<header>qMRMLWidget.h</header> | ||
<container>1</container> | ||
</customwidget> | ||
<customwidget> | ||
<class>ctkSliderWidget</class> | ||
<extends>QWidget</extends> | ||
<header>ctkSliderWidget.h</header> | ||
</customwidget> | ||
</customwidgets> | ||
<resources/> | ||
<connections/> | ||
</ui> |
Oops, something went wrong.