| 1527 | } |
| 1528 | |
| 1529 | void 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 | |
| 1560 | void mitk::nnInteractiveTool::Impl::AddScribbleInteraction(const Image* mask, const InteractionBoundingBox* boundingBox) const |
| 1561 | { |
no test coverage detected