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

Method OnTimePointChanged

Modules/PythonSegmentation/src/mitknnInteractiveTool.cpp:1459–1495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1457}
1458
1459void 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
1497bool mitk::nnInteractiveTool::IsSessionRunning() const
1498{

Callers

nothing calls this directly

Calls 10

IsSessionRunningMethod · 0.95
DisableInteractorMethod · 0.95
ResetInteractionsMethod · 0.95
EndSessionMethod · 0.95
GetCurrentTimePointMethod · 0.80
GetTargetSegmentationMethod · 0.80
ResetPreviewContentMethod · 0.80
GetToolManagerMethod · 0.45
GetReferenceDataMethod · 0.45
TimePointToTimeStepMethod · 0.45

Tested by

no test coverage detected