| 306 | } |
| 307 | |
| 308 | void mitk::EditableContourTool::OnFinish(StateMachineAction *, InteractionEvent *interactionEvent) |
| 309 | { |
| 310 | auto positionEvent = dynamic_cast<mitk::InteractionPositionEvent *>(interactionEvent); |
| 311 | |
| 312 | if (nullptr == positionEvent) |
| 313 | return; |
| 314 | |
| 315 | if (m_PlaneGeometry.IsNotNull()) |
| 316 | { |
| 317 | // Check if the point is in the correct slice |
| 318 | if (m_PlaneGeometry->DistanceFromPlane(positionEvent->GetPositionInWorld()) > mitk::sqrteps) |
| 319 | return; |
| 320 | } |
| 321 | |
| 322 | this->FinalizePreviewContour(positionEvent->GetPositionInWorld()); |
| 323 | |
| 324 | this->FinishTool(); |
| 325 | |
| 326 | // Merge contours |
| 327 | auto contour = this->GetContour(); |
| 328 | contour->Concatenate(m_PreviewContour); |
| 329 | |
| 330 | auto numberOfTimesteps = static_cast<int>(contour->GetTimeSteps()); |
| 331 | |
| 332 | for (int i = 0; i <= numberOfTimesteps; ++i) |
| 333 | contour->Close(i); |
| 334 | |
| 335 | this->ReleaseHelperObjects(false); |
| 336 | |
| 337 | if (m_AutoConfirm) |
| 338 | { |
| 339 | this->ConfirmSegmentation(); |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | bool mitk::EditableContourTool::OnCheckPlane(const InteractionEvent* interactionEvent) |
| 344 | { |
nothing calls this directly
no test coverage detected