| 1457 | } |
| 1458 | |
| 1459 | void mitk::nnInteractiveTool::OnTimePointChanged() |
| 1460 | { |
| 1461 | // The Python session is bound to a single 3D slice extracted at the time |
| 1462 | // step that was active when StartSession() ran. Without a session there is |
| 1463 | // nothing to reconcile, and DoUpdatePreview() short-circuits when no |
| 1464 | // Python context exists, so we deliberately do not call the base class |
| 1465 | // handler (which would invoke UpdatePreview against a stale binding). |
| 1466 | if (!this->IsSessionRunning()) |
| 1467 | return; |
| 1468 | |
| 1469 | const auto timePoint = this->GetToolManager()->GetCurrentTimePoint(); |
| 1470 | |
| 1471 | const auto* referenceNode = this->GetToolManager()->GetReferenceData(0); |
| 1472 | const auto* referenceImage = referenceNode != nullptr |
| 1473 | ? referenceNode->GetDataAs<Image>() |
| 1474 | : nullptr; |
| 1475 | if (referenceImage == nullptr) |
| 1476 | return; |
| 1477 | |
| 1478 | const auto currentImageTimeStep = referenceImage->GetTimeGeometry()->TimePointToTimeStep(timePoint); |
| 1479 | |
| 1480 | const auto* workingSeg = this->GetTargetSegmentation(); |
| 1481 | const auto currentWorkingTimeStep = workingSeg != nullptr |
| 1482 | ? workingSeg->GetTimeGeometry()->TimePointToTimeStep(timePoint) |
| 1483 | : 0; |
| 1484 | |
| 1485 | if (currentImageTimeStep == m_Impl->SessionReferenceDataTimeStep && |
| 1486 | currentWorkingTimeStep == m_Impl->SessionWorkingDataTimeStep) |
| 1487 | { |
| 1488 | return; |
| 1489 | } |
| 1490 | |
| 1491 | this->DisableInteractor(); |
| 1492 | this->ResetInteractions(); |
| 1493 | this->ResetPreviewContent(); |
| 1494 | this->EndSession(); |
| 1495 | } |
| 1496 | |
| 1497 | bool mitk::nnInteractiveTool::IsSessionRunning() const |
| 1498 | { |
nothing calls this directly
no test coverage detected