diff --git a/Plugins/org.mitk.gui.qt.datamanager/documentation/UserManual/QmitkDatamanager.dox b/Plugins/org.mitk.gui.qt.datamanager/documentation/UserManual/QmitkDatamanager.dox
index f9c36fce44..7c7326558c 100644
--- a/Plugins/org.mitk.gui.qt.datamanager/documentation/UserManual/QmitkDatamanager.dox
+++ b/Plugins/org.mitk.gui.qt.datamanager/documentation/UserManual/QmitkDatamanager.dox
@@ -1,194 +1,192 @@
/**
\page org_mitk_views_datamanager The Data Manager View
\imageMacro{data-manager-dox.svg,"Icon of the Data Manager", 2.00}
\tableofcontents
\section DataManagerIntroduction Introduction
The Datamanager is the central component to manage medical data like images, segmentation masks, registrations, surfaces, point sets, annotations, measurements, etc..
After loading data into the Datamanager the data is shown in the four-view window, the so-called Standard Display.
The user can now start working on the data by interacting with the data inside the Standard Display,
by using the MITK-plugins such as Segmentation or Basic Image Processing or by using the context menu inside the data manager.
\section DataManagerLoadingData Loading Data
There are several ways of loading data into the Datamanager as so-called data nodes:
- drag and drop data (e.g. from a file explorer or desktop) into the Datamanager
- drag and drop data (e.g. from a file explorer or desktop) into one of the four windows of the Standard Display
- use the keyboard shortcut Ctrl + o
- use the Open File Button in the left upper corner and use the Open Dialog
- use File -> Open File... from the top menu
A lot of file-formats can be loaded into MITK, for example:
- 2D-images / 3D-volumes with or without several time steps (*.dcm, *.ima, *.nrrd, ...)
- Surfaces (*.stl, *.vtk, ...)
- Point sets (*.mps)
- and many more
The user can also load a series of 2D images (e.g. image001.png, image002.png ...) to a MITK 3D volume.
To do this, just drag and drop one of those 2D data files into the Datamanager by holding the ALT key.
Note: What really happens is that the data nodes are stored inside a "Data storage" and the Datamanager is just a visual representation of the data inside the "Data storage".
That's why the documentation sometimes uses the term "Data storage" instead of "Datamanager".
\section DataManagerSavingData Saving Data
There are several ways of saving data from the Datamanager:
- use the keyboard shortcut Ctrl + s on a single data node
- use the keyboard shortcut Ctrl + s on multiple data nodes
- use the context menu right-click -> Save on a single data node
- use the context menu right-click -> Save on multiple data nodes
- use File -> Save... from the top menu on a single data node
- use File -> Save... from the top menu on multiple data nodes
\section DataManagerWorking Working with the Datamanager
After loading data into the Datamanager the data appears as data nodes in a sorted list inside the Datamanager.
The user can change the order of the data nodes manually by dragging one or multiple data nodes and dropping them at any position inside the Datamanager.
Data nodes can also be sorted hierarchically as a parent-child-relation.
For example after using the Segmentation-Plugin to create a segmentation on DataNode, the result is created as ChildNode,
which is a child of DataNode (see \ref ParentChild "Parent-Child-Relation" screenshot).
A parent-child-relation can be changed by dragging a child of a data node and dropping it onto another data node.
For this the Property Allow changing of parent nodes needs to be enabled (see \ref DataManagerPreferences "Preferences").
\anchor ParentChild
\imageMacro{QmitkDatamanager_ParentChild.png, "Parent-Child-Relation", 16.00}
\subsection DataManagerNodeVisibility Visibility of data nodes
By default all loaded data nodes are visible in the Standard Display. The visibility is indicated by the checkbox in front of the data node name in the Datamanager.
If a data node is visible, the checkbox is filled - an empty checkbox indicates a hidden data node (see \ref ParentChild "Parent-Child-Relation" screenshot).
Hint: The data nodes are rendered on top of each other, such that the topmost visible data node is always displayed on top of other data nodes. By hiding
the topmost visible data node the next data node becomes the topmost visible data node and the hidden data node is not rendered anymore.
Note: "Visible" does not mean that the node is correctly displayed inside the render windows. The user might have to re-initialize a data node to have it correctly displayed.
\subsection DataManagerNodeSelection Selection of data nodes
Some MITK-plugins contain widgets to control the data nodes that are used for plugin-specific data processing. These widgets can be configured such that they listen to
the current selection of the Datamanager. Having such a plugin active each selection change of data nodes inside the data manager will change the respective selection of
the plugin. The data node selection widgets can have specific node predicates, which means that only specific data nodes can be controlled by the widgets. It might happen
that a selected data node will not be represented in such a selection widget or that the selection widget will be emptied.
\subsection DataManagerNodeRenaming Renaming data nodes
There are two ways of changing the name of a data node inside the Datamanager:
- use the F2 key on a single data node
- double-click on a single data node
In both cases the new name can be accepted by hitting Enter or by clicking somewhere else.
\section DataManagerContextMenu Context Menu
The Datamanager provides a context menu for each data node that can be opened by right-clicking on a data node.
An example of the context-menu can be seen in the \ref ContextMenu "Context menu" screenshot.
The context menu allows to quickly perform common actions on data nodes. These actions differ according to the data type. Some of these actions are described here.
For more actions see the respective modules and plugins (e.g. QmitkCreatePolygonModelAction inside the org_mitk_gui_qt_segmentation-plugin.
- Global Reinit: Re-initializes the render windows to the common bounding box of all data nodes of the data storage that
- have not set "includeInBoundingBox" to false
- are "visible".
In this case it does not matter on which node this action is performed.
- Reinit: Re-initializes the render windows to the common bounding box of all selected data nodes of the data storage that
- have not set "includeInBoundingBox" to false
- are "visible".
- Save: see \ref DataManagerSavingData "Saving Data" section
- Remove: Removes all selected data nodes from the data storage.
- Show only selected nodes: Enables the visibility of all selected data nodes and hides all other data nodes.
- Toggle visibility: Shows / hides each selected data node according to each node's current visibility state.
- Show details: Opens a pop-up window with detailed information about each node, like data type, geometry, DICOM information, file path etc.
- Opacity: Sets the opacity via a slider for the rendering of the selected data node.
- Color: Opens a pop-up window that allows to pick an arbitrary color for the rendering of all selected data nodes.
- Colormap: Opens another submenu with a list of different colormaps that can be chosen for the rendering of all selected data nodes.
- Component: Sets the currently visible data component for the rendering of this particular component of the selected data node.
- Texture Interpolation: Smooths the data visualization for rendering of a selected data node.
- Surface Representation: Opens another submenu with the following entries:
- Points: Visually represents a surface (a data type) as a set of points.
- Wireframe: Visually represents a surface (a data type) as a wireframe model.
- Surface: Visually represents a surface (a data type) as a solid surface.
As the description of the actions showed, it is possible to open / use the context menu with a single data node or with a set of selected data nodes.
If the data types of multiple selected data nodes differ, the actions might not appear / work as expected. Also some actions are not available for a set of selected data nodes.
\anchor ContextMenu
\imageMacro{QmitkDatamanager_ContextMenu.png, "Context menu", 16.00}
\section DataManagerPreferences Preferences
The MITK Workbench provides a preference page for specific plugins. The preference page provided for the Datamanager can be seen in the \ref PreferencePage "Preference page" screenshot.
The user can open the preference page by
- using the keyboard shortcut Ctrl + p
- using Window -> Preferences... from the top menu.
It allows to set the following preferences for the Datamanager, which define the behavior of the Datamanager:
- Place new nodes on top: If enabled, newly added data nodes will be inserted at the top of the list of data nodes inside the Datamanager.
If disabled, newly added nodes will be inserted at the bottom of the list.
- Show helper objects: If enabled, data nodes that have set "helper object" to true will be displayed in the Datamanager.
If disabled, data nodes that have set "helper object" to true will not be visible in the Datamanager.
- Show nodes containing no data: If enabled, data nodes that have no underlying base data defined will be displayed in the Datamanager.
If disabled, data nodes that have no underlying base data defined will not be visible in the Datamanager.
-
- Use surface decimation: If enabled, a newly created surface will be decimated to reduce the number of triangles in the triangle mesh.
- Such a surface can be created as a polygon model from a segmentation (see \ref DataManagerContextMenu "Context Menu").
If disabled, the surface will have its original number of triangles in the triangle mesh.
- Allow changing of parent node: If enabled, the user can change the hierarchy of the data nodes manually by dragging one or multiple data nodes and
dropping them at any position inside the Datamanager (see \ref DataManagerWorking "Working with the Datamanager") for changing the order of the data nodes manually).
\anchor PreferencePage
\imageMacro{QmitkDatamanager_PreferencePage.png, "Preference page", 16.00}
\section DataManagerHotkeys Hotkeys
The MITK Workbench provides hotkeys for specific plugins. The hotkeys provided for the Datamanager can be seen in the \ref Hotkeys "Hotkeys" screenshot.
They allow to expedite common operations in relation to data nodes or the Datamanager.
The user can customize the hotkeys by accessing the preference page:
- using the keyboard shortcut Ctrl + p
- useing Window -> Preferences... from the top menu
- Delete selected nodes Removes all selected data nodes from the data storage.
- Global reinit Re-initializes the render windows to the common bounding box of all data nodes of the data storage that
- have not set "includeInBoundingBox" to false
- are "visible"
In this case it does not matter on which node this action is performed.
- Make all nodes invisible Hides all data nodes of the data storage.
- Reinit selected nodes Re-initializes the render windows to the common bounding box of all selected data nodes of the data storage that
- have not set "includeInBoundingBox" to false
- are "visible"
- Show node information Opens a pop-up window with detailed information about each node, like data type, geometry, DICOM information, file path etc.
- Toggle visibility of selected nodes: Shows / hides each selected data node according to each node's current visibility state.
\anchor Hotkeys
\imageMacro{QmitkDatamanager_Hotkeys.png, "Hotkeys", 16.00}
*/
diff --git a/Plugins/org.mitk.gui.qt.datamanager/plugin.xml b/Plugins/org.mitk.gui.qt.datamanager/plugin.xml
index fac19121f7..24d7a1b211 100644
--- a/Plugins/org.mitk.gui.qt.datamanager/plugin.xml
+++ b/Plugins/org.mitk.gui.qt.datamanager/plugin.xml
@@ -1,28 +1,28 @@
-
+
diff --git a/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerPreferencePage.cpp b/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerPreferencePage.cpp
index cc3a9aab2d..0e65d3117c 100644
--- a/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerPreferencePage.cpp
+++ b/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerPreferencePage.cpp
@@ -1,92 +1,88 @@
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#include "QmitkDataManagerPreferencePage.h"
#include "QmitkDataManagerView.h"
#include
#include
#include
#include
#include
#include
QmitkDataManagerPreferencePage::QmitkDataManagerPreferencePage()
: m_MainControl(nullptr)
{
// nothing here
}
void QmitkDataManagerPreferencePage::Init(berry::IWorkbench::Pointer )
{
// nothing here
}
void QmitkDataManagerPreferencePage::CreateQtControl(QWidget* parent)
{
berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
m_DataManagerPreferencesNode = prefService->GetSystemPreferences()->Node(QmitkDataManagerView::VIEW_ID);
m_MainControl = new QWidget(parent);
m_EnableSingleEditing = new QCheckBox;
m_PlaceNewNodesOnTop = new QCheckBox;
m_ShowHelperObjects = new QCheckBox;
m_ShowNodesContainingNoData = new QCheckBox;
- m_UseSurfaceDecimation = new QCheckBox;
m_AllowParentChange = new QCheckBox;
auto formLayout = new QFormLayout;
formLayout->addRow("&Single click property editing:", m_EnableSingleEditing);
formLayout->addRow("&Place new nodes on top:", m_PlaceNewNodesOnTop);
formLayout->addRow("&Show helper objects:", m_ShowHelperObjects);
formLayout->addRow("&Show nodes containing no data", m_ShowNodesContainingNoData);
- formLayout->addRow("&Use surface decimation:", m_UseSurfaceDecimation);
formLayout->addRow("&Allow changing of parent node:", m_AllowParentChange);
m_MainControl->setLayout(formLayout);
Update();
}
QWidget* QmitkDataManagerPreferencePage::GetQtControl() const
{
return m_MainControl;
}
bool QmitkDataManagerPreferencePage::PerformOk()
{
m_DataManagerPreferencesNode->PutBool("Single click property editing", m_EnableSingleEditing->isChecked());
m_DataManagerPreferencesNode->PutBool("Place new nodes on top", m_PlaceNewNodesOnTop->isChecked());
m_DataManagerPreferencesNode->PutBool("Show helper objects", m_ShowHelperObjects->isChecked());
m_DataManagerPreferencesNode->PutBool("Show nodes containing no data", m_ShowNodesContainingNoData->isChecked());
- m_DataManagerPreferencesNode->PutBool("Use surface decimation", m_UseSurfaceDecimation->isChecked());
m_DataManagerPreferencesNode->PutBool("Allow changing of parent node", m_AllowParentChange->isChecked());
return true;
}
void QmitkDataManagerPreferencePage::PerformCancel()
{
// nothing here
}
void QmitkDataManagerPreferencePage::Update()
{
m_EnableSingleEditing->setChecked(m_DataManagerPreferencesNode->GetBool("Single click property editing", true));
m_PlaceNewNodesOnTop->setChecked(m_DataManagerPreferencesNode->GetBool("Place new nodes on top", true));
m_ShowHelperObjects->setChecked(m_DataManagerPreferencesNode->GetBool("Show helper objects", false));
m_ShowNodesContainingNoData->setChecked(m_DataManagerPreferencesNode->GetBool("Show nodes containing no data", false));
- m_UseSurfaceDecimation->setChecked(m_DataManagerPreferencesNode->GetBool("Use surface decimation", true));
m_AllowParentChange->setChecked(m_DataManagerPreferencesNode->GetBool("Allow changing of parent node", false));
}
diff --git a/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerPreferencePage.h b/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerPreferencePage.h
index 19dcb176cd..f0c478a463 100644
--- a/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerPreferencePage.h
+++ b/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerPreferencePage.h
@@ -1,64 +1,63 @@
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#ifndef QMITKDATAMANAGERPREFERENCEPAGE_H_
#define QMITKDATAMANAGERPREFERENCEPAGE_H_
#include "berryIQtPreferencePage.h"
#include
#include
class QWidget;
class QCheckBox;
struct MITK_QT_DATAMANAGER QmitkDataManagerPreferencePage : public QObject, public berry::IQtPreferencePage
{
Q_OBJECT
Q_INTERFACES(berry::IPreferencePage)
public:
QmitkDataManagerPreferencePage();
void Init(berry::IWorkbench::Pointer workbench) override;
void CreateQtControl(QWidget* widget) override;
QWidget* GetQtControl() const override;
///
/// \see IPreferencePage::PerformOk()
///
bool PerformOk() override;
///
/// \see IPreferencePage::PerformCancel()
///
void PerformCancel() override;
///
/// \see IPreferencePage::Update()
///
void Update() override;
protected:
QWidget* m_MainControl;
QCheckBox* m_EnableSingleEditing;
QCheckBox* m_PlaceNewNodesOnTop;
QCheckBox* m_ShowHelperObjects;
QCheckBox* m_ShowNodesContainingNoData;
- QCheckBox* m_UseSurfaceDecimation;
QCheckBox* m_AllowParentChange;
berry::IPreferences::Pointer m_DataManagerPreferencesNode;
};
#endif /* QMITKDATAMANAGERPREFERENCEPAGE_H_ */
diff --git a/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerView.cpp b/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerView.cpp
index 6af9236c5b..09fad8822f 100644
--- a/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerView.cpp
+++ b/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerView.cpp
@@ -1,235 +1,230 @@
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#include "QmitkDataManagerView.h"
// mitk gui qt datamanager
#include "internal/QmitkDataManagerItemDelegate.h"
#include "internal/QmitkNodeTableViewKeyFilter.h"
// mitk core
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
// qt widgets module
#include
#include
#include
#include
#include
// mitk core services plugin
#include
#include
// mitk gui common plugin
#include
// mitk gui qt application plugin
#include
#include
// mitk gui qt common plugin
#include
// qt
#include
#include
#include
const QString QmitkDataManagerView::VIEW_ID = "org.mitk.views.datamanager";
QmitkDataManagerView::QmitkDataManagerView()
: m_ItemDelegate(nullptr)
{
}
QmitkDataManagerView::~QmitkDataManagerView()
{
// nothing here
}
void QmitkDataManagerView::CreateQtPartControl(QWidget* parent)
{
m_CurrentRowCount = 0;
m_Parent = parent;
berry::IBerryPreferences::Pointer prefs = this->GetPreferences().Cast();
assert(prefs);
- //# GUI
m_NodeTreeModel = new QmitkDataStorageTreeModel(GetDataStorage(), prefs->GetBool("Place new nodes on top", true));
m_NodeTreeModel->setParent(parent);
m_NodeTreeModel->SetAllowHierarchyChange(prefs->GetBool("Allow changing of parent node", false));
- m_SurfaceDecimation = prefs->GetBool("Use surface decimation", false);
+
// Prepare filters
m_HelperObjectFilterPredicate = mitk::NodePredicateOr::New(
mitk::NodePredicateProperty::New("helper object", mitk::BoolProperty::New(true)),
mitk::NodePredicateProperty::New("hidden object", mitk::BoolProperty::New(true)));
m_NodeWithNoDataFilterPredicate = mitk::NodePredicateData::New(nullptr);
m_FilterModel = new QmitkDataStorageFilterProxyModel();
m_FilterModel->setSourceModel(m_NodeTreeModel);
m_FilterModel->AddFilterPredicate(m_HelperObjectFilterPredicate);
m_FilterModel->AddFilterPredicate(m_NodeWithNoDataFilterPredicate);
m_NodeTreeView = new QTreeView;
m_NodeTreeView->setHeaderHidden(true);
m_NodeTreeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_NodeTreeView->setSelectionBehavior(QAbstractItemView::SelectRows);
m_NodeTreeView->setAlternatingRowColors(true);
m_NodeTreeView->setDragEnabled(true);
m_NodeTreeView->setDropIndicatorShown(true);
m_NodeTreeView->setAcceptDrops(true);
m_NodeTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
m_NodeTreeView->setModel(m_FilterModel);
m_NodeTreeView->setTextElideMode(Qt::ElideMiddle);
m_NodeTreeView->installEventFilter(new QmitkNodeTableViewKeyFilter(this, GetDataStorage()));
m_ItemDelegate = new QmitkDataManagerItemDelegate(m_NodeTreeView);
m_NodeTreeView->setItemDelegate(m_ItemDelegate);
connect(m_NodeTreeModel, SIGNAL(rowsInserted(const QModelIndex&, int, int)), this, SLOT(NodeTreeViewRowsInserted(const QModelIndex&, int, int)));
connect(m_NodeTreeModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), this, SLOT(NodeTreeViewRowsRemoved(const QModelIndex&, int, int)));
connect(m_NodeTreeView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), this, SLOT(NodeSelectionChanged(const QItemSelection &, const QItemSelection &)));
connect(m_NodeTreeModel, &QmitkDataStorageTreeModel::nodeVisibilityChanged, this, &QmitkDataManagerView::OnNodeVisibilityChanged);
// data node context menu and menu actions
m_DataNodeContextMenu = new QmitkDataNodeContextMenu(GetSite(), m_NodeTreeView);
m_DataNodeContextMenu->SetDataStorage(GetDataStorage());
- m_DataNodeContextMenu->SetSurfaceDecimation(m_SurfaceDecimation);
connect(m_NodeTreeView, SIGNAL(customContextMenuRequested(const QPoint&)), m_DataNodeContextMenu, SLOT(OnContextMenuRequested(const QPoint&)));
QGridLayout* dndFrameWidgetLayout = new QGridLayout;
dndFrameWidgetLayout->addWidget(m_NodeTreeView, 0, 0);
dndFrameWidgetLayout->setContentsMargins(0, 0, 0, 0);
m_DnDFrameWidget = new QmitkDnDFrameWidget(m_Parent);
m_DnDFrameWidget->setLayout(dndFrameWidgetLayout);
QVBoxLayout* layout = new QVBoxLayout(parent);
layout->addWidget(m_DnDFrameWidget);
layout->setContentsMargins(0, 0, 0, 0);
m_Parent->setLayout(layout);
}
void QmitkDataManagerView::SetFocus()
{
}
//////////////////////////////////////////////////////////////////////////
// Node tree modification
//////////////////////////////////////////////////////////////////////////
void QmitkDataManagerView::NodeTreeViewRowsInserted(const QModelIndex& parent, int /*start*/, int /*end*/)
{
QModelIndex viewIndex = m_FilterModel->mapFromSource(parent);
m_NodeTreeView->setExpanded(viewIndex, true);
// a new row was inserted
if (m_CurrentRowCount == 0 && m_NodeTreeModel->rowCount() == 1)
{
mitk::WorkbenchUtil::OpenRenderWindowPart(GetSite()->GetPage());
m_CurrentRowCount = m_NodeTreeModel->rowCount();
}
}
void QmitkDataManagerView::NodeTreeViewRowsRemoved(const QModelIndex& /*parent*/, int /*start*/, int /*end*/)
{
m_CurrentRowCount = m_NodeTreeModel->rowCount();
}
void QmitkDataManagerView::NodeSelectionChanged(const QItemSelection& /*selected*/, const QItemSelection& /*deselected*/)
{
auto selectedNodes = GetCurrentSelection();
auto nodeSet = m_NodeTreeModel->GetNodeSet();
for (auto node : qAsConst(nodeSet))
{
if (node.IsNotNull())
{
node->SetSelected(selectedNodes.contains(node));
}
}
m_DataNodeContextMenu->SetSelectedNodes(selectedNodes);
}
void QmitkDataManagerView::OnNodeVisibilityChanged()
{
ToggleVisibilityAction::Run(GetSite(), GetDataStorage(), QList());
}
void QmitkDataManagerView::NodeChanged(const mitk::DataNode* /*node*/)
{
// m_FilterModel->invalidate();
// fix as proposed by R. Khlebnikov in the mitk-users mail from 02.09.2014
QMetaObject::invokeMethod(m_FilterModel, "invalidate", Qt::QueuedConnection);
}
void QmitkDataManagerView::OnPreferencesChanged(const berry::IBerryPreferences* prefs)
{
if (m_NodeTreeModel->GetPlaceNewNodesOnTopFlag() != prefs->GetBool("Place new nodes on top", true))
{
m_NodeTreeModel->SetPlaceNewNodesOnTop(!m_NodeTreeModel->GetPlaceNewNodesOnTopFlag());
}
bool hideHelperObjects = !prefs->GetBool("Show helper objects", false);
if (m_FilterModel->HasFilterPredicate(m_HelperObjectFilterPredicate) != hideHelperObjects)
{
if (hideHelperObjects)
{
m_FilterModel->AddFilterPredicate(m_HelperObjectFilterPredicate);
}
else
{
m_FilterModel->RemoveFilterPredicate(m_HelperObjectFilterPredicate);
}
}
bool hideNodesWithNoData = !prefs->GetBool("Show nodes containing no data", false);
if (m_FilterModel->HasFilterPredicate(m_NodeWithNoDataFilterPredicate) != hideNodesWithNoData)
{
if (hideNodesWithNoData)
{
m_FilterModel->AddFilterPredicate(m_NodeWithNoDataFilterPredicate);
}
else
{
m_FilterModel->RemoveFilterPredicate(m_NodeWithNoDataFilterPredicate);
}
}
m_NodeTreeView->expandAll();
- m_SurfaceDecimation = prefs->GetBool("Use surface decimation", false);
- m_DataNodeContextMenu->SetSurfaceDecimation(m_SurfaceDecimation);
-
m_NodeTreeModel->SetAllowHierarchyChange(prefs->GetBool("Allow changing of parent node", false));
GlobalReinitAction::Run(GetSite(), GetDataStorage());
}
QItemSelectionModel* QmitkDataManagerView::GetDataNodeSelectionModel() const
{
return m_NodeTreeView->selectionModel();
}
diff --git a/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerView.h b/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerView.h
index d788e63c56..4258ce4e39 100644
--- a/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerView.h
+++ b/Plugins/org.mitk.gui.qt.datamanager/src/QmitkDataManagerView.h
@@ -1,127 +1,123 @@
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#ifndef QMITKDATAMANAGERVIEW_H
#define QMITKDATAMANAGERVIEW_H
#include
// mitk core
#include
// berry plugin
#include
// mitk gui qt common plugin
#include
// mitk gui qt application
#include
// qt
#include
// forward declarations
class QModelIndex;
class QTreeView;
class QmitkDnDFrameWidget;
class QmitkDataStorageTreeModel;
class QmitkDataManagerItemDelegate;
class QmitkDataStorageFilterProxyModel;
/**
* @brief A view that shows all data nodes of the data storage in a qt tree view.
*
*/
class MITK_QT_DATAMANAGER QmitkDataManagerView : public QmitkAbstractView
{
Q_OBJECT
public:
static const QString VIEW_ID; // = "org.mitk.views.datamanager"
QmitkDataManagerView();
~QmitkDataManagerView() override;
public Q_SLOTS:
// invoked when the berry preferences were changed
void OnPreferencesChanged(const berry::IBerryPreferences* prefs) override;
//////////////////////////////////////////////////////////////////////////
// Slots for Qt node tree signals
//////////////////////////////////////////////////////////////////////////
/// When rows are inserted auto expand them
void NodeTreeViewRowsInserted(const QModelIndex& parent, int start, int end);
/// will setup m_CurrentRowCount
void NodeTreeViewRowsRemoved(const QModelIndex& parent, int start, int end);
/// Whenever the selection changes set the "selected" property respectively
void NodeSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
void OnNodeVisibilityChanged();
protected:
void CreateQtPartControl(QWidget* parent) override;
void SetFocus() override;
///
/// React to node changes. Overridden from QmitkAbstractView.
///
void NodeChanged(const mitk::DataNode* node) override;
protected:
QWidget* m_Parent;
QmitkDnDFrameWidget* m_DnDFrameWidget;
///
/// \brief A plain widget as the base pane.
///
QmitkDataStorageTreeModel* m_NodeTreeModel;
QmitkDataStorageFilterProxyModel* m_FilterModel;
mitk::NodePredicateBase::Pointer m_HelperObjectFilterPredicate;
mitk::NodePredicateBase::Pointer m_NodeWithNoDataFilterPredicate;
///
/// Holds the preferences for the data manager.
///
berry::IBerryPreferences::Pointer m_DataManagerPreferencesNode;
///
/// \brief The Table view to show the selected nodes.
///
QTreeView* m_NodeTreeView;
///
/// \brief The context menu that shows up when right clicking on a node.
///
QmitkDataNodeContextMenu* m_DataNodeContextMenu;
- ///
- /// \brief flag indicating whether a surface created from a selected decimation is decimated with vtkQuadricDecimation or not
- ///
- bool m_SurfaceDecimation;
/// saves the current amount of rows shown in the data manager
size_t m_CurrentRowCount;
QmitkDataManagerItemDelegate* m_ItemDelegate;
private:
QItemSelectionModel* GetDataNodeSelectionModel() const override;
};
#endif // QMITKDATAMANAGERVIEW_H
diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePage.cpp b/Plugins/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePage.cpp
index 0ea32131f3..803a62ff55 100644
--- a/Plugins/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePage.cpp
+++ b/Plugins/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePage.cpp
@@ -1,174 +1,146 @@
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#include "QmitkSegmentationPreferencePage.h"
#include
#include
#include
#include
#include
QmitkSegmentationPreferencePage::QmitkSegmentationPreferencePage()
: m_Ui(new Ui::QmitkSegmentationPreferencePageControls),
m_Control(nullptr),
m_Initializing(false)
{
}
QmitkSegmentationPreferencePage::~QmitkSegmentationPreferencePage()
{
}
void QmitkSegmentationPreferencePage::Init(berry::IWorkbench::Pointer)
{
}
void QmitkSegmentationPreferencePage::CreateQtControl(QWidget* parent)
{
m_Initializing = true;
berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
m_SegmentationPreferencesNode = prefService->GetSystemPreferences()->Node("/org.mitk.views.segmentation");
m_Control = new QWidget(parent);
m_Ui->setupUi(m_Control);
- connect(m_Ui->smoothingCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnSmoothingCheckboxChecked(int)));
connect(m_Ui->labelSetPresetToolButton, SIGNAL(clicked()), this, SLOT(OnLabelSetPresetButtonClicked()));
connect(m_Ui->suggestionsToolButton, SIGNAL(clicked()), this, SLOT(OnSuggestionsButtonClicked()));
this->Update();
m_Initializing = false;
}
QWidget* QmitkSegmentationPreferencePage::GetQtControl() const
{
return m_Control;
}
bool QmitkSegmentationPreferencePage::PerformOk()
{
m_SegmentationPreferencesNode->PutBool("slim view", m_Ui->slimViewCheckBox->isChecked());
m_SegmentationPreferencesNode->PutBool("draw outline", m_Ui->outlineRadioButton->isChecked());
m_SegmentationPreferencesNode->PutBool("selection mode", m_Ui->selectionModeCheckBox->isChecked());
- m_SegmentationPreferencesNode->PutBool("smoothing hint", m_Ui->smoothingCheckBox->isChecked());
- m_SegmentationPreferencesNode->PutDouble("smoothing value", m_Ui->smoothingSpinBox->value());
- m_SegmentationPreferencesNode->PutDouble("decimation rate", m_Ui->decimationSpinBox->value());
- m_SegmentationPreferencesNode->PutDouble("closing ratio", m_Ui->closingSpinBox->value());
m_SegmentationPreferencesNode->Put("label set preset", m_Ui->labelSetPresetLineEdit->text());
m_SegmentationPreferencesNode->PutBool("default label naming", m_Ui->defaultNameRadioButton->isChecked());
m_SegmentationPreferencesNode->Put("label suggestions", m_Ui->suggestionsLineEdit->text());
m_SegmentationPreferencesNode->PutBool("replace standard suggestions", m_Ui->replaceStandardSuggestionsCheckBox->isChecked());
m_SegmentationPreferencesNode->PutBool("suggest once", m_Ui->suggestOnceCheckBox->isChecked());
return true;
}
void QmitkSegmentationPreferencePage::PerformCancel()
{
}
void QmitkSegmentationPreferencePage::Update()
{
m_Ui->slimViewCheckBox->setChecked(m_SegmentationPreferencesNode->GetBool("slim view", false));
if (m_SegmentationPreferencesNode->GetBool("draw outline", true))
{
m_Ui->outlineRadioButton->setChecked(true);
}
else
{
m_Ui->overlayRadioButton->setChecked(true);
}
m_Ui->selectionModeCheckBox->setChecked(m_SegmentationPreferencesNode->GetBool("selection mode", false));
- if (m_SegmentationPreferencesNode->GetBool("smoothing hint", true))
- {
- m_Ui->smoothingCheckBox->setChecked(true);
- m_Ui->smoothingSpinBox->setDisabled(true);
- }
- else
- {
- m_Ui->smoothingCheckBox->setChecked(false);
- m_Ui->smoothingSpinBox->setEnabled(true);
- }
-
- m_Ui->smoothingSpinBox->setValue(m_SegmentationPreferencesNode->GetDouble("smoothing value", 1.0));
- m_Ui->decimationSpinBox->setValue(m_SegmentationPreferencesNode->GetDouble("decimation rate", 0.5));
- m_Ui->closingSpinBox->setValue(m_SegmentationPreferencesNode->GetDouble("closing ratio", 0.0));
-
auto labelSetPreset = mitk::BaseApplication::instance().config().getString(mitk::BaseApplication::ARG_SEGMENTATION_LABELSET_PRESET.toStdString(), "");
bool isOverriddenByCmdLineArg = !labelSetPreset.empty();
if (!isOverriddenByCmdLineArg)
labelSetPreset = m_SegmentationPreferencesNode->Get("label set preset", "").toStdString();
m_Ui->labelSetPresetLineEdit->setDisabled(isOverriddenByCmdLineArg);
m_Ui->labelSetPresetToolButton->setDisabled(isOverriddenByCmdLineArg);
m_Ui->labelSetPresetCmdLineArgLabel->setVisible(isOverriddenByCmdLineArg);
m_Ui->labelSetPresetLineEdit->setText(QString::fromStdString(labelSetPreset));
if (m_SegmentationPreferencesNode->GetBool("default label naming", true))
{
m_Ui->defaultNameRadioButton->setChecked(true);
}
else
{
m_Ui->askForNameRadioButton->setChecked(true);
}
auto labelSuggestions = mitk::BaseApplication::instance().config().getString(mitk::BaseApplication::ARG_SEGMENTATION_LABEL_SUGGESTIONS.toStdString(), "");
isOverriddenByCmdLineArg = !labelSuggestions.empty();
if (!isOverriddenByCmdLineArg)
labelSuggestions = m_SegmentationPreferencesNode->Get("label suggestions", "").toStdString();
m_Ui->defaultNameRadioButton->setDisabled(isOverriddenByCmdLineArg);
m_Ui->askForNameRadioButton->setDisabled(isOverriddenByCmdLineArg);
m_Ui->suggestionsLineEdit->setDisabled(isOverriddenByCmdLineArg);
m_Ui->suggestionsToolButton->setDisabled(isOverriddenByCmdLineArg);
m_Ui->suggestionsCmdLineArgLabel->setVisible(isOverriddenByCmdLineArg);
m_Ui->suggestionsLineEdit->setText(QString::fromStdString(labelSuggestions));
m_Ui->replaceStandardSuggestionsCheckBox->setChecked(m_SegmentationPreferencesNode->GetBool("replace standard suggestions", true));
m_Ui->suggestOnceCheckBox->setChecked(m_SegmentationPreferencesNode->GetBool("suggest once", true));
}
-void QmitkSegmentationPreferencePage::OnSmoothingCheckboxChecked(int state)
-{
- if (state != Qt::Unchecked)
- m_Ui->smoothingSpinBox->setDisabled(true);
- else
- m_Ui->smoothingSpinBox->setEnabled(true);
-}
-
void QmitkSegmentationPreferencePage::OnLabelSetPresetButtonClicked()
{
const auto filename = QFileDialog::getOpenFileName(m_Control, QStringLiteral("Load Label Set Preset"), QString(), QStringLiteral("Label set preset (*.lsetp)"));
if (!filename.isEmpty())
m_Ui->labelSetPresetLineEdit->setText(filename);
}
void QmitkSegmentationPreferencePage::OnSuggestionsButtonClicked()
{
const auto filename = QFileDialog::getOpenFileName(m_Control, QStringLiteral("Load Label Suggestions"), QString(), QStringLiteral("Label suggestions (*.json)"));
if (!filename.isEmpty())
m_Ui->suggestionsLineEdit->setText(filename);
}
diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePage.h b/Plugins/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePage.h
index 8c04073a86..cd54461ba2 100644
--- a/Plugins/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePage.h
+++ b/Plugins/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePage.h
@@ -1,66 +1,65 @@
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#ifndef QMITKSEGMENTATIONPREFERENCEPAGE_H
#define QMITKSEGMENTATIONPREFERENCEPAGE_H
#include "org_mitk_gui_qt_segmentation_Export.h"
#include
#include
class QWidget;
namespace Ui
{
class QmitkSegmentationPreferencePageControls;
}
class MITK_QT_SEGMENTATION QmitkSegmentationPreferencePage : public QObject, public berry::IQtPreferencePage
{
Q_OBJECT
Q_INTERFACES(berry::IPreferencePage)
public:
QmitkSegmentationPreferencePage();
~QmitkSegmentationPreferencePage() override;
void Init(berry::IWorkbench::Pointer workbench) override;
void CreateQtControl(QWidget* widget) override;
QWidget* GetQtControl() const override;
bool PerformOk() override;
void PerformCancel() override;
void Update() override;
protected Q_SLOTS:
- void OnSmoothingCheckboxChecked(int);
void OnLabelSetPresetButtonClicked();
void OnSuggestionsButtonClicked();
protected:
Ui::QmitkSegmentationPreferencePageControls* m_Ui;
QWidget* m_Control;
bool m_Initializing;
berry::IPreferences::Pointer m_SegmentationPreferencesNode;
};
#endif // QMITKSEGMENTATIONPREFERENCEPAGE_H
diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePageControls.ui b/Plugins/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePageControls.ui
index ee4674f966..d465bab8fd 100644
--- a/Plugins/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePageControls.ui
+++ b/Plugins/org.mitk.gui.qt.segmentation/src/QmitkSegmentationPreferencePageControls.ui
@@ -1,323 +1,233 @@
QmitkSegmentationPreferencePageControls
0
0
656
779
Form
-
Slim view
-
Hide tool button texts and increase icon size
-
2D display
-
-
Draw as outline
true
displayButtonGroup
-
Draw as transparent overlay
displayButtonGroup
-
Data node selection mode
-
If checked the segmentation plugin ensures that only the selected segmentation and the reference image are visible at one time.
Show only selected nodes
-
-
-
- Smoothed surface creation
-
-
-
- -
-
-
- 8
-
-
- 8
-
-
-
-
-
- Smoothing value (mm)
-
-
-
- -
-
-
- The Smoothing value is used as variance for a gaussian blur.
-
-
- 0.500000000000000
-
-
- 1.000000000000000
-
-
-
- -
-
-
- Decimation rate
-
-
-
- -
-
-
- Valid range is [0, 1). High values increase decimation, especially when very close to 1. A value of 0 disables decimation.
-
-
- 0.990000000000000
-
-
- 0.100000000000000
-
-
- 0.500000000000000
-
-
-
- -
-
-
- Closing Ratio
-
-
-
- -
-
-
- Valid range is [0, 1]. Higher values increase closing. A value of 0 disables closing.
-
-
- 1.000000000000000
-
-
- 0.100000000000000
-
-
-
- -
-
-
- If checked the segmentation plugin ensures that only the selected segmentation and the reference image are visible at one time.
-
-
- Use image spacing as smoothing value hint
-
-
-
-
-
- -
Default label set preset
- -
+
-
-
true
-
...
-
<html><head/><body><p><span style=" color:#ff0000;">The default label set preset is currently overriden by the </span><span style=" font-family:'Courier New'; color:#ff0000;">Segmentation.labelSetPreset</span><span style=" color:#ff0000;"> command-line argument.</span></p></body></html>
Qt::RichText
true
- -
+
-
Label creation
- -
+
-
-
Assign default name and color
true
labelCreationButtonGroup
-
Ask for name and color
labelCreationButtonGroup
- -
+
-
Label suggestions
- -
+
-
-
true
-
...
-
<html><head/><body><p><span style=" color:#ff0000;">Suggestions are currently enforced by the </span><span style=" font-family:'Courier New'; color:#ff0000;">Segmentation.labelSuggestions</span><span style=" color:#ff0000;"> command-line argument.</span></p></body></html>
Qt::RichText
true
- -
+
-
Replace standard organ suggestions
true
- -
+
-
Suggest once per segmentation
true
- -
+
-
Qt::Vertical
20
40
-
+
diff --git a/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkCreatePolygonModelAction.h b/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkCreatePolygonModelAction.h
index db2e07bc70..f5bf6fd4ee 100644
--- a/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkCreatePolygonModelAction.h
+++ b/Plugins/org.mitk.gui.qt.segmentation/src/internal/QmitkCreatePolygonModelAction.h
@@ -1,51 +1,51 @@
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#ifndef QMITKCREATEPOLYGONMODELACTION_H
#define QMITKCREATEPOLYGONMODELACTION_H
#include
// Parent classes
#include
#include
// Data members
#include
class MITK_QT_SEGMENTATION QmitkCreatePolygonModelAction : public QObject, public mitk::IContextMenuAction
{
Q_OBJECT
Q_INTERFACES(mitk::IContextMenuAction)
public:
QmitkCreatePolygonModelAction();
~QmitkCreatePolygonModelAction() override;
// IContextMenuAction
void Run(const QList &selectedNodes) override;
void SetDataStorage(mitk::DataStorage *dataStorage) override;
void SetSmoothed(bool smoothed) override;
void SetDecimated(bool decimated) override;
void SetFunctionality(berry::QtViewPart* view) override;
void OnSurfaceCalculationDone();
private:
QmitkCreatePolygonModelAction(const QmitkCreatePolygonModelAction &);
QmitkCreatePolygonModelAction & operator=(const QmitkCreatePolygonModelAction &);
mitk::DataStorage::Pointer m_DataStorage;
- bool m_IsSmoothed;
- bool m_IsDecimated;
+ bool m_IsSmoothed = false;
+ bool m_IsDecimated = true;
};
#endif