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

Method UpdatePreview

Modules/Segmentation/src/Interactions/mitkSegWithPreviewTool.cpp:634–730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

632}
633
634void mitk::SegWithPreviewTool::UpdatePreview(bool ignoreLazyPreviewSetting)
635{
636 const auto inputImage = this->GetSegmentationInput();
637 auto previewImage = this->GetPreviewSegmentation();
638 int progress_steps = 200;
639 this->EnsureUpToDateUserDefinedActiveLabel();
640
641 const auto workingSegmentation = this->GetTargetSegmentation();
642 const auto workingImage = workingSegmentation->GetGroupImage(workingSegmentation->GetActiveLayer());
643
644 this->CurrentlyBusy.Send(true);
645 m_IsUpdating = true;
646 m_IsPreviewGenerated = false;
647 this->UpdatePrepare();
648
649 const TimePointType timePoint = RenderingManager::GetInstance()->GetTimeNavigationController()->GetSelectedTimePoint();
650
651 try
652 {
653 if (nullptr != inputImage && nullptr != previewImage)
654 {
655 m_ProgressCommand->AddStepsToDo(progress_steps);
656
657 if (previewImage->GetTimeSteps() > 1 && (ignoreLazyPreviewSetting || !m_LazyDynamicPreviews))
658 {
659 for (unsigned int timeStep = 0; timeStep < previewImage->GetTimeSteps(); ++timeStep)
660 {
661 Image::ConstPointer feedBackImage;
662 Image::ConstPointer currentSegImage;
663
664 auto previewTimePoint = previewImage->GetTimeGeometry()->TimeStepToTimePoint(timeStep);
665 auto inputTimeStep = inputImage->GetTimeGeometry()->TimePointToTimeStep(previewTimePoint);
666
667 if (nullptr != this->GetWorkingPlaneGeometry())
668 { //only extract a specific slice defined by the working plane as feedback referenceImage.
669 feedBackImage = SegTool2D::GetAffectedImageSliceAs2DImage(this->GetWorkingPlaneGeometry(), inputImage, inputTimeStep);
670 currentSegImage = SegTool2D::GetAffectedImageSliceAs2DImageByTimePoint(this->GetWorkingPlaneGeometry(), workingImage, previewTimePoint);
671 }
672 else
673 { //work on the whole feedback referenceImage
674 feedBackImage = this->GetImageByTimeStep(inputImage, inputTimeStep);
675 currentSegImage = this->GetImageByTimePoint(workingImage, previewTimePoint);
676 }
677
678 this->DoUpdatePreview(feedBackImage, currentSegImage, previewImage, timeStep);
679 }
680 }
681 else
682 {
683 Image::ConstPointer feedBackImage;
684 Image::ConstPointer currentSegImage;
685
686 if (nullptr != this->GetWorkingPlaneGeometry())
687 {
688 feedBackImage = SegTool2D::GetAffectedImageSliceAs2DImageByTimePoint(this->GetWorkingPlaneGeometry(), inputImage, timePoint);
689 currentSegImage = SegTool2D::GetAffectedImageSliceAs2DImageByTimePoint(this->GetWorkingPlaneGeometry(), workingImage, timePoint);
690 }
691 else

Callers 15

ConfirmSegmentationMethod · 0.95
OnRoiDataChangedMethod · 0.95
OnTimePointChangedMethod · 0.95
OnPreviewBtnClickedMethod · 0.80
OnPreviewBtnClickedMethod · 0.80
OnPreviewBtnClickedMethod · 0.80
ResetInteractionsMethod · 0.80
UndoLastInteractionMethod · 0.80
OnAddPointMethod · 0.80
OnDeleteMethod · 0.80
ClearPicksMethod · 0.80

Calls 15

GetSegmentationInputMethod · 0.95
GetTargetSegmentationMethod · 0.95
UpdatePrepareMethod · 0.95
GetImageByTimeStepMethod · 0.95
GetImageByTimePointMethod · 0.95
UpdateCleanUpMethod · 0.95
GetActiveLayerMethod · 0.80
GetTimeStepsMethod · 0.80
GetAllLabelValuesMethod · 0.80
SetProgressMethod · 0.80

Tested by

no test coverage detected