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

Method AddBoxInteraction

Modules/PythonSegmentation/src/mitknnInteractiveTool.cpp:1529–1558  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1527}
1528
1529void mitk::nnInteractiveTool::Impl::AddBoxInteraction(const PlanarFigure* box, const Image* inputAtTimeStep) const
1530{
1531 const auto* geometry = inputAtTimeStep->GetGeometry();
1532
1533 std::array<itk::Index<3>, 2> indices;
1534 geometry->WorldToIndex(box->GetWorldControlPoint(0), indices[0]);
1535 geometry->WorldToIndex(box->GetWorldControlPoint(2), indices[1]);
1536
1537 std::ostringstream pyCommands; pyCommands
1538 << "session.add_bbox_interaction(\n"
1539 << " [\n";
1540
1541 for (int i = 2; i >= 0; --i)
1542 {
1543 // nnInteractive expects half-open bounding boxes [min, max).
1544 // Our indices are inclusive, so we add +1 to the upper bound.
1545 pyCommands
1546 << " ["
1547 << std::min(indices[0][i], indices[1][i]) << ", "
1548 << std::max(indices[0][i], indices[1][i]) + 1
1549 << "],\n";
1550 }
1551
1552 pyCommands
1553 << " ],\n"
1554 << " include_interaction=" << (this->PromptType == PromptType::Positive ? "True" : "False") << '\n'
1555 << ")\n";
1556
1557 this->ExecuteSession(pyCommands.str());
1558}
1559
1560void mitk::nnInteractiveTool::Impl::AddScribbleInteraction(const Image* mask, const InteractionBoundingBox* boundingBox) const
1561{

Callers 1

DoUpdatePreviewMethod · 0.80

Calls 4

GetGeometryMethod · 0.80
GetWorldControlPointMethod · 0.80
ExecuteSessionMethod · 0.80
WorldToIndexMethod · 0.45

Tested by

no test coverage detected