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

Method DoUpdatePreview

Modules/Segmentation/src/Interactions/mitkGrowCutTool.cpp:92–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92void mitk::GrowCutTool::DoUpdatePreview(const Image *inputAtTimeStep,
93 const Image * oldSegAtTimeStep,
94 MultiLabelSegmentation *previewImage,
95 TimeStepType timeStep)
96{
97 if (nullptr != inputAtTimeStep &&
98 nullptr != previewImage)
99 {
100 mitk::GrowCutSegmentationFilter::Pointer growCutFilter = mitk::GrowCutSegmentationFilter::New();
101
102 if (nullptr == this->GetToolManager()->GetWorkingData(0))
103 {
104 return;
105 }
106
107 SeedImageType::Pointer seedImage = SeedImageType::New();
108 CastToItkImage(oldSegAtTimeStep, seedImage);
109
110 growCutFilter->SetSeedImage(seedImage);
111 growCutFilter->SetDistancePenalty(m_DistancePenalty);
112 growCutFilter->SetInput(inputAtTimeStep);
113 growCutFilter->AddObserver(itk::ProgressEvent(), m_ProgressCommand);
114
115 try
116 {
117 growCutFilter->Update();
118 }
119 catch (...)
120 {
121 mitkThrow() << "itkGrowCutFilter error";
122 }
123
124 auto growCutResultImage = growCutFilter->GetOutput();
125
126 previewImage->UpdateGroupImage(previewImage->GetActiveLayer(), growCutResultImage, timeStep);
127 }
128}

Callers

nothing calls this directly

Calls 9

AddObserverMethod · 0.80
UpdateGroupImageMethod · 0.80
GetActiveLayerMethod · 0.80
NewFunction · 0.50
GetWorkingDataMethod · 0.45
GetToolManagerMethod · 0.45
SetInputMethod · 0.45
UpdateMethod · 0.45
GetOutputMethod · 0.45

Tested by

no test coverage detected