|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
The 'QmitkMxNMultiWidget' is a 'QmitkAbstractMultiWidget' that is used to display multiple render windows at once. Render windows can dynamically be added and removed to change the layout of the multi widget. This is done by using the 'SetLayout'-function to define a layout. This will automatically add or remove the appropriate number of render window widgets. More...
#include <QmitkMxNMultiWidget.h>


Classes | |
| struct | WindowDescriptor |
| Plain-data summary of one cell leaf in the layout tree. More... | |
Public Types | |
| using | GroupSyncIndexType = int |
Public Types inherited from QmitkAbstractMultiWidget | |
| using | RenderWindowWidgetPointer = std::shared_ptr< QmitkRenderWindowWidget > |
| Convenience type alias for a shared pointer to a render window widget. More... | |
| using | RenderWindowWidgetMap = std::map< QString, std::shared_ptr< QmitkRenderWindowWidget > > |
| Convenience type alias for a map of render window widgets keyed by name. More... | |
| using | RenderWindowHash = QHash< QString, QmitkRenderWindow * > |
| Convenience type alias for a hash of render windows keyed by name. More... | |
Public Slots | |
| void | wheelEvent (QWheelEvent *e) override |
| void | mousePressEvent (QMouseEvent *e) override |
| void | moveEvent (QMoveEvent *e) override |
| void | LoadLayout (const nlohmann::json *jsonData) |
| Slot wrapper around 'ApplyLayout'. Loads a v2.0 layout document (replaces the current cell tree). More... | |
| void | SaveLayout (std::ostream *outStream) |
| Slot wrapper around 'SerializeLayout'. Writes the current layout as a v2.0 JSON document (pretty-printed) to 'outStream'. More... | |
| void | SetDataBasedLayout (const QmitkAbstractNodeSelectionWidget::NodeList &nodes) |
| void | OnCreateNewSyncGroupRequested (QmitkSynchronizedNodeSelectionWidget *synchronizedWidget) |
| Slot connected to 'QmitkRenderWindowUtilityWidget::CreateNewSyncGroupRequested'. Allocates the next free group index via 'NextFreeSyncGroupIndex', creates the group, and assigns the requesting widget to it. More... | |
Signals | |
| void | WheelMoved (QWheelEvent *) |
| void | Moved () |
| void | UpdateUtilityWidgetViewPlanes () |
| void | LayoutChanged () |
| void | SyncGroupAdded (const GroupSyncIndexType index) |
Signals inherited from QmitkAbstractMultiWidget | |
| void | ActiveRenderWindowChanged () |
Public Member Functions | |
| QmitkMxNMultiWidget (QWidget *parent=nullptr, Qt::WindowFlags f={}, const QString &multiWidgetName="mxn") | |
| ~QmitkMxNMultiWidget () | |
| void | InitializeMultiWidget () override |
| Initialize the multi widget. Must be implemented by subclasses. More... | |
| void | Synchronize (bool synchronized) override |
| Enable or disable synchronization of display action events. More... | |
| QmitkRenderWindow * | GetRenderWindow (const QString &widgetName) const override |
| Returns the render window with the given widget name. More... | |
| QmitkRenderWindow * | GetRenderWindow (const mitk::AnatomicalPlane &orientation) const override |
| Returns the render window that shows the given anatomical orientation. More... | |
| void | SetActiveRenderWindowWidget (RenderWindowWidgetPointer activeRenderWindowWidget) override |
| Sets the active render window widget. More... | |
| void | InitializeViews (const mitk::TimeGeometry *geometry, bool resetCamera) override |
| Initialize the active render windows of the MxNMultiWidget to the given geometry. More... | |
| void | SetInteractionReferenceGeometry (const mitk::TimeGeometry *referenceGeometry) override |
| Forward the given time geometry to all base renderers, so that they can store it as their interaction reference geometry. This will update the alignment status of the reference geometry for each base renderer. For more details, see 'BaseRenderer::SetInteractionReferenceGeometry'. Overridem from 'QmitkAbstractMultiWidget'. More... | |
| bool | HasCoupledRenderWindows () const override |
| Returns true if the render windows are coupled; false if not. More... | |
| void | SetSelectedPosition (const mitk::Point3D &newPosition, const QString &widgetName) override |
| Sets the selected position in the specified render window. More... | |
| const mitk::Point3D | GetSelectedPosition (const QString &widgetName) const override |
| Returns the selected position in the specified render window. More... | |
| void | SetCrosshairVisibility (bool visible) override |
| Sets the crosshair visibility. More... | |
| bool | GetCrosshairVisibility () const override |
| Returns whether the crosshair is currently visible. More... | |
| void | SetCrosshairGap (unsigned int gapSize) override |
| Sets the gap size of the crosshair. More... | |
| void | ResetCrosshair () override |
| Resets the crosshair to the default position. More... | |
| void | SetWidgetPlaneMode (int userMode) override |
| Sets the widget plane mode (e.g., rotation, swivel). More... | |
| mitk::SliceNavigationController * | GetTimeNavigationController () |
| void | EnableCrosshair () |
| void | DisableCrosshair () |
| void | AddSynchronizationGroup (const GroupSyncIndexType index, const std::string &name=std::string()) |
| Create a new selection synchronization group with the given index. More... | |
| void | SetSynchronizationGroup (QmitkSynchronizedNodeSelectionWidget *synchronizedWidget, const GroupSyncIndexType index) |
| Move a synchronized node selection widget to the group with the given index. More... | |
| GroupSyncIndexType | NextFreeSyncGroupIndex () const |
| Returns the smallest positive index not already used by an existing synchronization group. More... | |
| RenderWindowWidgetPointer | CreateRenderWindowWidget (const QString &id) |
| Construct a render-window widget with a caller-supplied id. More... | |
| nlohmann::json | SerializeLayout () const |
| Serialize the current layout tree to a v2.0 JSON document (always strict mode). More... | |
| std::vector< WindowDescriptor > | ListWindowDescriptors () const |
| List all cell leaves in the current layout tree, in pre-order traversal order. More... | |
| void | ApplyLayout (const nlohmann::json &doc) |
| Apply a v2.0 JSON document. More... | |
Public Member Functions inherited from QmitkAbstractMultiWidget | |
| QmitkAbstractMultiWidget (QWidget *parent=0, Qt::WindowFlags f={}, const QString &multiWidgetName="multiwidget") | |
| virtual | ~QmitkAbstractMultiWidget () |
| virtual void | MultiWidgetOpened () |
| Called when the multi widget is opened. Default implementation does nothing. More... | |
| virtual void | MultiWidgetClosed () |
| Called when the multi widget is closed. Default implementation does nothing. More... | |
| virtual void | SetDataStorage (mitk::DataStorage *dataStorage) |
| Sets the data storage for all render window widgets. More... | |
| mitk::DataStorage * | GetDataStorage () const |
| Returns the current data storage. More... | |
| int | GetRowCount () const |
Returns the row count of the last SetLayout(r, c) call, or 0 if a non-grid layout has been loaded since (e.g. via ApplyLayout or SetDataBasedLayout). More... | |
| int | GetColumnCount () const |
Returns the column count of the last SetLayout(r, c) call, or 0 if a non-grid layout has been loaded since. More... | |
| virtual void | SetLayout (int row, int column) |
| Sets the layout to the given number of rows and columns. More... | |
| virtual void | SetInteractionScheme (mitk::InteractionSchemeSwitcher::InteractionScheme scheme) |
| Sets the interaction scheme for the multi widget. More... | |
| mitk::InteractionEventHandler * | GetInteractionEventHandler () |
| Returns the interaction event handler. More... | |
| void | SetDisplayActionEventHandler (std::unique_ptr< mitk::DisplayActionEventHandler > displayActionEventHandler) |
| Sets the display action event handler. More... | |
| mitk::DisplayActionEventHandler * | GetDisplayActionEventHandler () |
| Returns the display action event handler. More... | |
| RenderWindowWidgetMap | GetRenderWindowWidgets () const |
| Returns all render window widgets. More... | |
| RenderWindowWidgetMap | Get2DRenderWindowWidgets () const |
| Returns all 2D render window widgets. More... | |
| RenderWindowWidgetMap | Get3DRenderWindowWidgets () const |
| Returns all 3D render window widgets. More... | |
| RenderWindowWidgetPointer | GetRenderWindowWidget (int row, int column) const |
| Returns the render window widget at the given row and column. More... | |
| RenderWindowWidgetPointer | GetRenderWindowWidget (const QString &widgetName) const |
| Returns the render window widget with the given name. More... | |
| RenderWindowWidgetPointer | GetRenderWindowWidget (const QmitkRenderWindow *renderWindow) const |
| Returns the render window widget that owns the given render window. More... | |
| RenderWindowHash | GetRenderWindows () const |
| Returns a hash of all render windows keyed by name. More... | |
| QmitkRenderWindow * | GetRenderWindow (int row, int column) const |
| Returns the render window at the given row and column. More... | |
| RenderWindowWidgetPointer | GetActiveRenderWindowWidget () const |
| Returns the currently active render window widget. More... | |
| RenderWindowWidgetPointer | GetFirstRenderWindowWidget () const |
| Returns the first render window widget. More... | |
| RenderWindowWidgetPointer | GetLastRenderWindowWidget () const |
| Returns the last render window widget. More... | |
| QString | GetMultiWidgetName () const |
| Returns the name of this multi widget. More... | |
| virtual QString | GetNameFromIndex (int row, int column) const |
| Returns the widget name for the given row and column. More... | |
| virtual QString | GetNameFromIndex (size_t index) const |
| Returns the qualified widget name for the given linear index. More... | |
| unsigned int | GetNumberOfRenderWindowWidgets () const |
| Returns the number of render window widgets. More... | |
| void | RequestUpdate (const QString &widgetName) |
| Requests an update of the render window with the given name. More... | |
| void | RequestUpdateAll () |
| Requests an update of all render windows. More... | |
| void | ForceImmediateUpdate (const QString &widgetName) |
| Forces an immediate update of the render window with the given name. More... | |
| void | ForceImmediateUpdateAll () |
| Forces an immediate update of all render windows. More... | |
| virtual void | ActivateMenuWidget (bool state) |
| Activates or deactivates the render window menu widget. More... | |
| virtual bool | IsMenuWidgetEnabled () const |
| Returns whether the render window menu widget is enabled. More... | |
| QmitkMultiWidgetLayoutManager * | GetMultiWidgetLayoutManager () const |
| Returns the layout manager for this multi widget. More... | |
Protected Member Functions | |
| QmitkSynchronizedWidgetConnector * | GetSyncGroupConnector (const GroupSyncIndexType index) const |
| Look up the connector backing the synchronization group with the given index. Returns nullptr if no group with that index exists. More... | |
| std::size_t | GetSyncGroupCount () const |
| Number of currently registered synchronization groups. More... | |
Protected Member Functions inherited from QmitkAbstractMultiWidget | |
| virtual void | AddRenderWindowWidget (const QString &widgetName, RenderWindowWidgetPointer renderWindowWidget) |
| Adds a render window widget with the given name. More... | |
| virtual void | RemoveRenderWindowWidget () |
| Removes the last render window widget by reverse map order. More... | |
| virtual void | RemoveRenderWindowWidget (const QString &widgetName) |
| Removes the render window widget registered under the given qualified name. No-op if no such widget is registered. More... | |
| void | ResetGridState () |
| Reset the grid-layout sentinel: row/column counts to 0 and the active render-window pointer to nullptr. More... | |
The 'QmitkMxNMultiWidget' is a 'QmitkAbstractMultiWidget' that is used to display multiple render windows at once. Render windows can dynamically be added and removed to change the layout of the multi widget. This is done by using the 'SetLayout'-function to define a layout. This will automatically add or remove the appropriate number of render window widgets.
In addition to layout management, the widget owns the lifecycle of selection synchronization groups: see 'AddSynchronizationGroup', 'SetSynchronizationGroup', and the 'SyncGroupAdded' signal. Layout configurations can be persisted and restored via 'SaveLayout' / 'LoadLayout'.
Definition at line 44 of file QmitkMxNMultiWidget.h.
| using QmitkMxNMultiWidget::GroupSyncIndexType = int |
Definition at line 108 of file QmitkMxNMultiWidget.h.
| QmitkMxNMultiWidget::QmitkMxNMultiWidget | ( | QWidget * | parent = nullptr, |
| Qt::WindowFlags | f = {}, |
||
| const QString & | multiWidgetName = "mxn" |
||
| ) |
| QmitkMxNMultiWidget::~QmitkMxNMultiWidget | ( | ) |
| void QmitkMxNMultiWidget::AddSynchronizationGroup | ( | const GroupSyncIndexType | index, |
| const std::string & | name = std::string() |
||
| ) |
Create a new selection synchronization group with the given index.
Idempotent: calling twice with the same index is a no-op (the existing connector is preserved, no signal is re-emitted). On creation the connector's selection is seeded from the data storage's non-helper, non-hidden nodes and 'SyncGroupAdded(index)' is emitted once.
This is the canonical creation API; callers should go through it rather than mutating 'm_SynchronizedWidgetConnectors' directly.
| index | The 1-based group index. Must be >= 1. |
| name | Optional bare group label to record in the engine's group- name registry. When empty (the default), the registry receives the conventional auto-generated label: 'main' for index 1, otherwise 'g_<index>'. Idempotent calls (the group already exists) leave the previously recorded name in place. |
| mitk::Exception | on precondition violation. |
| void QmitkMxNMultiWidget::ApplyLayout | ( | const nlohmann::json & | doc | ) |
Apply a v2.0 JSON document.
Tears down all existing render windows and rebuilds from scratch (no positional reuse). On failure during construction, rolls back to a single default cell and rethrows.
See 'mxn-layout-v2.schema.json' for the accepted document shape.
Id contract: every window's id MUST already be in the canonical fully-qualified form <multiWidgetName>__<bareSegment> matching this editor's multiWidgetName. The loader does NOT prepend or strip a prefix; what the document holds is what the engine uses. Documents written for a different editor instance are rejected up-front with a message naming the offending id.
Group seeding: after the new cell tree is built, each group's runtime synchronized state (per-renderer 'visible' / 'layer') is seeded from the cell that appears first in document order whose links.selection names that group; remaining members are normalised to the seed. See the canonical rule on the schema's groups description.
| doc | A parsed v2.0 layout document. |
| mitk::Exception | on: version != "2.0"; structural shape violation; id not starting with <multiWidgetName>__; duplicate window ids; unknown view_direction; missing group reference in strict mode; nlohmann parse / type errors (rewrapped from 'nlohmann::json::exception' subtypes). |
| RenderWindowWidgetPointer QmitkMxNMultiWidget::CreateRenderWindowWidget | ( | const QString & | id | ) |
Construct a render-window widget with a caller-supplied id.
The id is the canonical, fully-qualified window name in the form <multiWidgetName>__<bareSegment>. It is registered with RenderingManager verbatim and is the same string that appears in the v2 layout document's per-window 'id' field, in REST URLs, and in per-renderer DataNode property context keys. The editor neither prepends nor strips a prefix.
This is the canonical creation API; callers that need a deterministic id (e.g. the layout applier) should go through it. Internal positional creation (used by 'SetLayout(r, c)') uses a private nullary overload that delegates here with a collision-free <multiWidgetName>__widget<i> id.
| id | The fully-qualified window id (e.g. "mxn__widget0", "mxn__alpha"). Must be non-empty, must start with <multiWidgetName>__, and must not collide with an existing render-window in this editor. |
<multiWidgetName>__ (otherwise mitk::Exception) | mitk::Exception | on precondition violation. |
| void QmitkMxNMultiWidget::DisableCrosshair | ( | ) |
| void QmitkMxNMultiWidget::EnableCrosshair | ( | ) |
|
overridevirtual |
Returns whether the crosshair is currently visible.
Implements QmitkAbstractMultiWidget.
|
overridevirtual |
Returns the render window that shows the given anatomical orientation.
| [in] | orientation | The anatomical plane orientation. |
Implements QmitkAbstractMultiWidget.
|
overridevirtual |
Returns the render window with the given widget name.
| [in] | widgetName | The widget name. |
Reimplemented from QmitkAbstractMultiWidget.
|
overridevirtual |
Returns the selected position in the specified render window.
| [in] | widgetName | The name of the render window widget. |
Implements QmitkAbstractMultiWidget.
|
protected |
Look up the connector backing the synchronization group with the given index. Returns nullptr if no group with that index exists.
Internal accessor that all in-class code goes through (rather than reaching into 'm_SynchronizedWidgetConnectors' directly), keeping the map encapsulated. Exposed as 'protected' so a test-only subclass can surface it for white-box assertions on connector identity / state preservation; production code outside the class hierarchy must not depend on this.
|
protected |
Number of currently registered synchronization groups.
| mitk::SliceNavigationController* QmitkMxNMultiWidget::GetTimeNavigationController | ( | ) |
|
overridevirtual |
Returns true if the render windows are coupled; false if not.
For the MxNMultiWidget the render windows are typically decoupled.
Implements QmitkAbstractMultiWidget.
|
overridevirtual |
Initialize the multi widget. Must be implemented by subclasses.
Implements QmitkAbstractMultiWidget.
|
overridevirtual |
Initialize the active render windows of the MxNMultiWidget to the given geometry.
| geometry | The geometry to be used to initialize / update the active render window's time and slice navigation controller. |
| resetCamera | If true, the camera and crosshair will be reset to the default view (centered, no zoom). If false, the current crosshair position and the camera zoom will be stored and reset after the reference geometry has been updated. |
Implements QmitkAbstractMultiWidget.
|
signal |
| std::vector<WindowDescriptor> QmitkMxNMultiWidget::ListWindowDescriptors | ( | ) | const |
List all cell leaves in the current layout tree, in pre-order traversal order.
This is the engine query that the REST bridge layer (and any other consumer that needs to know which windows the editor currently has) should use. Returns plain structs - no JSON, no Qt widget pointers. The returned descriptors carry the canonical fully-qualified window id (<multiWidgetName>__<bareSegment>), the same string the bridge layer receives from REST URLs.
SerializeLayout shares the per-cell descriptor logic via MakeWindowDescriptor but performs its own splitter-tree walk to emit topology + sizes; both walks therefore agree on per-cell field values by construction.
| mitk::Exception | if the layout-tree invariant is violated, or if a cell references a sync-group index with no entry in the engine's group-name registry. |
|
slot |
Slot wrapper around 'ApplyLayout'. Loads a v2.0 layout document (replaces the current cell tree).
| jsonData | Pointer to a parsed layout document. Must not be null and must not represent a JSON null value. |
| mitk::Exception | (rethrown from 'ApplyLayout') on null pointer, JSON null value, version != "2.0", structural shape violation, id not starting with <multiWidgetName>__, duplicate window ids, unknown view_direction, missing group reference in strict mode, or wrapped 'nlohmann::json::exception' subtypes. |
|
overrideslot |
|
signal |
|
overrideslot |
| GroupSyncIndexType QmitkMxNMultiWidget::NextFreeSyncGroupIndex | ( | ) | const |
Returns the smallest positive index not already used by an existing synchronization group.
Useful for callers that want to allocate a fresh group without colliding with the set of existing groups (e.g. the "+" button in the per-cell utility widget, or external automation).
|
slot |
Slot connected to 'QmitkRenderWindowUtilityWidget::CreateNewSyncGroupRequested'. Allocates the next free group index via 'NextFreeSyncGroupIndex', creates the group, and assigns the requesting widget to it.
|
overridevirtual |
Resets the crosshair to the default position.
Implements QmitkAbstractMultiWidget.
|
slot |
Slot wrapper around 'SerializeLayout'. Writes the current layout as a v2.0 JSON document (pretty-printed) to 'outStream'.
No-op if 'outStream' is null. Otherwise emits the JSON returned by 'SerializeLayout' followed by a newline.
| outStream | Output stream. May be null (no-op). |
| mitk::Exception | (rethrown from 'SerializeLayout') if the layout tree is in an invariant-violating state (e.g. no top-level splitter). |
| nlohmann::json QmitkMxNMultiWidget::SerializeLayout | ( | ) | const |
Serialize the current layout tree to a v2.0 JSON document (always strict mode).
Group naming convention: engine-internal sync-group index 1 maps to the bare label "main"; other indices map to g_<i> where <i> is a counter assigned by pre-order encounter order over the cell list. Same engine state in produces the same group names out (round-trip stable).
See 'mxn-layout-v2.schema.json' for the document shape this method emits.
| mitk::Exception | if the layout-tree invariant is violated. |
|
overridevirtual |
Sets the active render window widget.
| [in] | activeRenderWindowWidget | The widget to set as active. |
Reimplemented from QmitkAbstractMultiWidget.
|
overridevirtual |
Sets the gap size of the crosshair.
| [in] | gapSize | The gap size in pixels. |
Implements QmitkAbstractMultiWidget.
|
overridevirtual |
Sets the crosshair visibility.
| [in] | visible | True to show the crosshair, false to hide it. |
Implements QmitkAbstractMultiWidget.
|
slot |
|
overridevirtual |
Forward the given time geometry to all base renderers, so that they can store it as their interaction reference geometry. This will update the alignment status of the reference geometry for each base renderer. For more details, see 'BaseRenderer::SetInteractionReferenceGeometry'. Overridem from 'QmitkAbstractMultiWidget'.
Implements QmitkAbstractMultiWidget.
|
overridevirtual |
Sets the selected position in the specified render window.
| [in] | newPosition | The new 3D position. |
| [in] | widgetName | The name of the target render window widget. |
Implements QmitkAbstractMultiWidget.
| void QmitkMxNMultiWidget::SetSynchronizationGroup | ( | QmitkSynchronizedNodeSelectionWidget * | synchronizedWidget, |
| const GroupSyncIndexType | index | ||
| ) |
Move a synchronized node selection widget to the group with the given index.
The group is auto-created via 'AddSynchronizationGroup' if it does not yet exist. After the call, 'synchronizedWidget' is connected to (and only to) the connector for 'index'. Calling with the widget's current group does not double-Connect; it only re-runs 'SynchronizeWidget' so cached state propagates to the widget.
This is the canonical move API; callers should not bypass it.
| synchronizedWidget | The widget to move. Must not be null. |
| index | The 1-based target group index. Must be >= 1. |
| mitk::Exception | on precondition violation. |
|
overridevirtual |
Sets the widget plane mode (e.g., rotation, swivel).
| [in] | mode | The plane mode identifier. |
Implements QmitkAbstractMultiWidget.
|
signal |
|
overridevirtual |
Enable or disable synchronization of display action events.
Reimplemented from QmitkAbstractMultiWidget.
|
signal |
|
overrideslot |
|
signal |