|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
Handles all /api/v1/rendering endpoints. More...
#include <mitkRenderingController.h>
Public Member Functions | |
| RenderingController (DataStorageBridge &bridge) | |
| Construct a RenderingController. More... | |
| void | SetDispatcher (StorageThreadDispatcherBase *dispatcher) |
| Set the thread dispatcher for RenderingManager operations. More... | |
| void | SetRenderWindowBridge (RenderWindowBridge *bridge) |
| Set or clear the RenderWindowBridge for interactions with the rendering stack of the application. More... | |
| void | HandlePOST_update (const httplib::Request &req, httplib::Response &res) const |
| Handle POST /rendering/update request. More... | |
| void | HandlePOST_reinit (const httplib::Request &req, httplib::Response &res) const |
| Handle POST /rendering/reinit request. More... | |
| void | HandleGET_selectedPosition (const httplib::Request &req, httplib::Response &res) const |
| Handle GET /rendering/selected-position request. More... | |
| void | HandlePUT_selectedPosition (const httplib::Request &req, httplib::Response &res) const |
| Handle PUT /rendering/selected-position request. More... | |
| void | HandleGET_selectedTime (const httplib::Request &req, httplib::Response &res) const |
| Handle GET /rendering/selected-time request. More... | |
| void | HandlePUT_selectedTime (const httplib::Request &req, httplib::Response &res) const |
| Handle PUT /rendering/selected-time request. More... | |
| void | HandleGET_editors (const httplib::Request &req, httplib::Response &res) const |
| Handle GET /rendering/editors request. More... | |
| void | HandleGET_stdmultiInfo (const httplib::Request &req, httplib::Response &res) const |
| Handle GET /rendering/editors/stdmulti request. More... | |
| void | HandleGET_stdmultiWindows (const httplib::Request &req, httplib::Response &res) const |
| Handle GET /rendering/editors/stdmulti/windows request. More... | |
| void | HandleGET_stdmultiWindow (const httplib::Request &req, httplib::Response &res) const |
| Handle GET /rendering/editors/stdmulti/windows/{id} request. More... | |
| void | HandleGET_stdmultiCamera (const httplib::Request &req, httplib::Response &res) const |
| Handle GET /rendering/editors/stdmulti/windows/{id}/camera. More... | |
| void | HandlePUT_stdmultiCamera (const httplib::Request &req, httplib::Response &res) const |
| Handle PUT /rendering/editors/stdmulti/windows/{id}/camera. More... | |
| void | HandleGET_stdmultiSelectedSlice (const httplib::Request &req, httplib::Response &res) const |
| Handle GET /rendering/editors/stdmulti/windows/{id}/selected-slice. More... | |
| void | HandlePUT_stdmultiSelectedSlice (const httplib::Request &req, httplib::Response &res) const |
| Handle PUT /rendering/editors/stdmulti/windows/{id}/selected-slice. More... | |
| void | HandleGET_stdmultiScreenshot (const httplib::Request &req, httplib::Response &res) const |
| Handle GET /rendering/editors/stdmulti/screenshot. More... | |
| void | HandleGET_stdmultiWindowScreenshot (const httplib::Request &req, httplib::Response &res) const |
| Handle GET /rendering/editors/stdmulti/windows/{id}/screenshot. More... | |
| void | HandleGET_mxnInfo (const httplib::Request &req, httplib::Response &res) const |
| void | HandleGET_mxnWindows (const httplib::Request &req, httplib::Response &res) const |
| void | HandleGET_mxnWindow (const httplib::Request &req, httplib::Response &res) const |
| void | HandleGET_mxnLayout (const httplib::Request &req, httplib::Response &res) const |
| void | HandlePUT_mxnLayout (const httplib::Request &req, httplib::Response &res) const |
| Handle PUT /rendering/editors/mxn/layout. More... | |
| void | HandleGET_mxnCamera (const httplib::Request &req, httplib::Response &res) const |
| void | HandlePUT_mxnCamera (const httplib::Request &req, httplib::Response &res) const |
| Handle PUT /rendering/editors/mxn/windows/{id}/camera. More... | |
| void | HandleGET_mxnSelectedSlice (const httplib::Request &req, httplib::Response &res) const |
| void | HandlePUT_mxnSelectedSlice (const httplib::Request &req, httplib::Response &res) const |
| Handle PUT /rendering/editors/mxn/windows/{id}/selected-slice. More... | |
| void | HandleGET_mxnSelectedPosition (const httplib::Request &req, httplib::Response &res) const |
| Handle GET /rendering/editors/mxn/windows/{id}/selected-position. More... | |
| void | HandlePUT_mxnSelectedPosition (const httplib::Request &req, httplib::Response &res) const |
| Handle PUT /rendering/editors/mxn/windows/{id}/selected-position. More... | |
| void | HandleGET_mxnScreenshot (const httplib::Request &req, httplib::Response &res) const |
| Handle GET /rendering/editors/mxn/screenshot. More... | |
| void | HandleGET_mxnWindowScreenshot (const httplib::Request &req, httplib::Response &res) const |
| Handle GET /rendering/editors/mxn/windows/{id}/screenshot. More... | |
| void | HandleGET_screenshot (const httplib::Request &req, httplib::Response &res) const |
| Handle GET /rendering/screenshot request. More... | |
Handles all /api/v1/rendering endpoints.
All RenderingManager calls are dispatched to the main/UI thread via the StorageThreadDispatcherBase. In headless/test mode (no dispatcher), tasks execute directly on the calling thread.
Definition at line 38 of file mitkRenderingController.h.
|
explicit |
Construct a RenderingController.
| bridge | Reference to the DataStorageBridge for data access. |
| void mitk::RenderingController::HandleGET_editors | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors request.
Returns the full list of known editor aliases with their current activity state.
Response 200: [{"alias":..., "plugin_id":..., "active":...}, ...]
| void mitk::RenderingController::HandleGET_mxnCamera | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/mxn/windows/{id}/camera.
| void mitk::RenderingController::HandleGET_mxnInfo | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/mxn.
| void mitk::RenderingController::HandleGET_mxnLayout | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/mxn/layout.
| void mitk::RenderingController::HandleGET_mxnScreenshot | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/mxn/screenshot.
Captures the MxN multi-widget editor canvas (multi-widget area only - no toolbars, no side panels). Query and response contract identical to GET /rendering/screenshot.
| void mitk::RenderingController::HandleGET_mxnSelectedPosition | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/mxn/windows/{id}/selected-position.
Returns the per-cell 3D world anchor + scene bounds. Distinct from the global /rendering/selected-position, which targets the StdMulti anchor. Per-cell anchors may legitimately diverge from the global one.
| void mitk::RenderingController::HandleGET_mxnSelectedSlice | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/mxn/windows/{id}/selected-slice.
| void mitk::RenderingController::HandleGET_mxnWindow | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/mxn/windows/{id}.
| void mitk::RenderingController::HandleGET_mxnWindows | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/mxn/windows.
| void mitk::RenderingController::HandleGET_mxnWindowScreenshot | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/mxn/windows/{id}/screenshot.
Single MxN cell viewport capture without resizing the live render surface. Query and response contract identical to GET /rendering/screenshot.
| void mitk::RenderingController::HandleGET_screenshot | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/screenshot request.
Captures a screenshot of the active application window.
Query parameters:
Response 200 with binary image body (Content-Type: image/png or image/jpeg).
| req | The HTTP request. |
| res | The HTTP response to populate. |
| void mitk::RenderingController::HandleGET_selectedPosition | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/selected-position request.
Returns the current crosshair position and the world-space AABB (i.e. the reinit geometry). If no input geometry is available, bounds.min_position and bounds.max_position are null.
Returns 503 if no render window bridge or position getter is connected.
Response 200: {"position": [x, y, z], "bounds": {"min_position": [...], "max_position": [...]}}
| req | The HTTP request. |
| res | The HTTP response to populate. |
| void mitk::RenderingController::HandleGET_selectedTime | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/selected-time request.
Returns the current time step and time point from the global TimeNavigationController, together with the time geometry bounds.
Response 200: {"timepoint_ms": ..., "timestep": ..., "bounds": {...}}
| req | The HTTP request. |
| res | The HTTP response to populate. |
| void mitk::RenderingController::HandleGET_stdmultiCamera | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/stdmulti/windows/{id}/camera.
2D windows return parallel_scale, the 3D window returns perspective_angle.
| void mitk::RenderingController::HandleGET_stdmultiInfo | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/stdmulti request.
Returns metadata about the StdMultiWidgetEditor.
| void mitk::RenderingController::HandleGET_stdmultiScreenshot | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/stdmulti/screenshot.
Editor-canvas grab. Query contract identical to /rendering/screenshot.
| void mitk::RenderingController::HandleGET_stdmultiSelectedSlice | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/stdmulti/windows/{id}/selected-slice.
Returns {step, position, bounds}. Returns 404 UNSUPPORTED_OPERATION for the 3D window.
| void mitk::RenderingController::HandleGET_stdmultiWindow | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/stdmulti/windows/{id} request.
Per-window summary. Controller-side validates {id} before bridge dispatch.
| void mitk::RenderingController::HandleGET_stdmultiWindows | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/stdmulti/windows request.
Returns the list of render windows of the StdMultiWidget editor.
| void mitk::RenderingController::HandleGET_stdmultiWindowScreenshot | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle GET /rendering/editors/stdmulti/windows/{id}/screenshot.
Single-window offscreen grab. Query contract identical to /rendering/screenshot.
| void mitk::RenderingController::HandlePOST_reinit | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle POST /rendering/reinit request.
Three operating modes:
| req | The HTTP request. |
| res | The HTTP response to populate. |
| void mitk::RenderingController::HandlePOST_update | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle POST /rendering/update request.
Triggers RenderingManager::RequestUpdateAll() with optional type filter. Optional body: {"type": "all" | "2d" | "3d"} (default: "all").
| req | The HTTP request. |
| res | The HTTP response to populate. |
| void mitk::RenderingController::HandlePUT_mxnCamera | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle PUT /rendering/editors/mxn/windows/{id}/camera.
Partial update; reuses the StdMulti ParseCameraPatch validation. Under v2 the MxN cell is3d is hard-coded to false: the schema's view_direction enum has no 3d value. When v3 introduces a 3D MxN cell type, derive is3d from the cell's MxNWindowInfo::kind.
| void mitk::RenderingController::HandlePUT_mxnLayout | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle PUT /rendering/editors/mxn/layout.
Applies a v2.0 layout document. Response 200 echoes the freshly serialized layout (so callers don't need a follow-up GET to refresh cached cell ids after a tear-down).
Maps mitk::Exception thrown by the engine's ApplyLayout to 400 INVALID_REQUEST. This is the one site under the MxN handlers where mitk::Exception does not fall through to 422 RENDERING_ERROR; the assumption is that every mitk::Exception out of ApplyLayout is a document-shape failure (version, schema, duplicate id, unknown view direction, missing group reference, type error). If the engine ever broadens ApplyLayout's failure model to runtime issues, narrow the catch.
| void mitk::RenderingController::HandlePUT_mxnSelectedPosition | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle PUT /rendering/editors/mxn/windows/{id}/selected-position.
Sets the per-cell 3D anchor via QmitkAbstractMultiWidget::SetSelectedPosition(point, widgetName). Whether the change propagates to other cells / the global anchor depends on the workbench's interactive coupling toggle, which is not exposed via REST. No range checking; out-of-range values are clamped/snapped by MITK.
| void mitk::RenderingController::HandlePUT_mxnSelectedSlice | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle PUT /rendering/editors/mxn/windows/{id}/selected-slice.
Step-only. Body containing position returns 400 with a hint pointing at the per-cell selected-position resource for cell-local world anchor moves and at /rendering/selected-position for global moves.
| void mitk::RenderingController::HandlePUT_selectedPosition | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle PUT /rendering/selected-position request.
Moves the global application crosshair to the given 3D world position. No bounds checking is performed; out-of-range values are clamped/snapped by MITK.
Required body: {"position": [x, y, z]} – exactly 3 numbers.
Response 204 on success. Returns 503 if no render window bridge or position setter is connected.
| req | The HTTP request (must contain a JSON body with "position"). |
| res | The HTTP response to populate. |
| void mitk::RenderingController::HandlePUT_selectedTime | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle PUT /rendering/selected-time request.
Sets the active time step or time point in the global TimeNavigationController. Exactly one of "timepoint_ms" (number) or "timestep" (non-negative integer) must be present in the body. No bounds checking is performed; out-of-range values may be clamped by the time navigation controller.
Response 204 on success.
| req | The HTTP request (must contain a JSON body with exactly one of the fields). |
| res | The HTTP response to populate. |
| void mitk::RenderingController::HandlePUT_stdmultiCamera | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle PUT /rendering/editors/stdmulti/windows/{id}/camera.
Partial update. Rejects: unknown fields, 2D-only field on 3D and vice versa, unknown standard_view values, non-positive parallel_scale, out-of-range perspective_angle, invalid JSON, empty body.
| void mitk::RenderingController::HandlePUT_stdmultiSelectedSlice | ( | const httplib::Request & | req, |
| httplib::Response & | res | ||
| ) | const |
Handle PUT /rendering/editors/stdmulti/windows/{id}/selected-slice.
Body accepts only {"step": N}. A position field triggers 400 with a hint pointing at /rendering/selected-position (StdMulti slices are coupled). The 3D window returns 404 UNSUPPORTED_OPERATION.
| void mitk::RenderingController::SetDispatcher | ( | StorageThreadDispatcherBase * | dispatcher | ) |
Set the thread dispatcher for RenderingManager operations.
If set, all RenderingManager calls are dispatched to the storage-owning (main/UI) thread. If nullptr, calls execute directly (headless/test mode).
Thread-safety: serialised against Dispatch() via an internal mutex, so the dispatcher may be set or replaced while requests are in flight.
| dispatcher | The dispatcher, or nullptr to clear. |
| void mitk::RenderingController::SetRenderWindowBridge | ( | RenderWindowBridge * | bridge | ) |
Set or clear the RenderWindowBridge for interactions with the rendering stack of the application.
RestServer::Start(), before the server thread starts accepting connections. The bridge pointer is not re-bound at runtime once request handlers are reachable. Because of this set-once-at-startup contract, the read sites in HandleGET_* / HandlePUT_* deliberately access m_RenderWindowBridge without holding m_DispatcherMutex – which would otherwise add a lock to every request without protecting against a race that does not exist in normal operation. Do not relax this contract without also serialising the read sites.| bridge | The bridge, or nullptr to clear (screenshot endpoint returns 503). |