MCPcopy Create free account
hub / github.com/MITK/MITK / HandleGET_stdmultiSelectedSlice

Method HandleGET_stdmultiSelectedSlice

Modules/RESTAPI/src/mitkRenderingController.cpp:1261–1302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1259}
1260
1261void RenderingController::HandleGET_stdmultiSelectedSlice(const httplib::Request& req, httplib::Response& res) const
1262{
1263 const auto id = ReadRequiredPathParam(req, "id");
1264
1265 if (!IsValidStdMultiWindowId(id))
1266 {
1267 const auto error = ErrorResponse::RenderWindowNotFound(id, req.path);
1268 this->SendErrorResponse(res, 404, error);
1269 return;
1270 }
1271
1272 if (IsStdMulti3dWindow(id))
1273 {
1274 const auto error = ErrorResponse::UnsupportedOperation(
1275 "selected-slice is not applicable to the 3D window.", req.path);
1276 this->SendErrorResponse(res, 404, error);
1277 return;
1278 }
1279
1280 if (m_RenderWindowBridge == nullptr || !m_RenderWindowBridge->HasStdMultiSelectedSliceGetter())
1281 {
1282 const auto error = ErrorResponse::RenderWindowNotAvailable(req.path);
1283 this->SendErrorResponse(res, 503, error);
1284 return;
1285 }
1286
1287 SliceState state;
1288 try
1289 {
1290 state = m_RenderWindowBridge->GetStdMultiSelectedSlice(id);
1291 }
1292 catch (const std::exception& e)
1293 {
1294 const auto [status, payload] = MapBridgeException(e, req.path);
1295 this->SendErrorResponse(res, status, payload);
1296 return;
1297 }
1298
1299 const auto j = SliceStateToJson(state);
1300 res.status = 200;
1301 res.set_content(j.dump(), "application/json");
1302}
1303
1304void RenderingController::HandlePUT_stdmultiSelectedSlice(const httplib::Request& req, httplib::Response& res) const
1305{

Calls 4

SendErrorResponseMethod · 0.95
SliceStateToJsonFunction · 0.85