2 import vtk, qt, ctk, slicer
4 from SegmentEditorEffects
import *
7 """ AutoCompleteEffect is an effect that can create a full segmentation 8 from a partial segmentation (not all slices are segmented or only 9 part of the target structures are painted). 13 AbstractScriptedSegmentEditorAutoCompleteEffect.__init__(self, scriptedEffect)
14 scriptedEffect.name =
'Grow from seeds' 20 import qSlicerSegmentationsEditorEffectsPythonQt
as effects
21 clonedEffect = effects.qSlicerSegmentEditorScriptedEffect(
None)
22 clonedEffect.setPythonSource(__file__.replace(
'\\',
'/'))
26 iconPath = os.path.join(os.path.dirname(__file__),
'Resources/Icons/GrowFromSeeds.png')
27 if os.path.exists(iconPath):
28 return qt.QIcon(iconPath)
32 return """<html>Growing segments to create complete segmentation<br>. 33 Location, size, and shape of initial segments and content of master volume are taken into account. 34 Final segment boundaries will be placed where master volume brightness changes abruptly. Instructions:<p> 35 <ul style="margin: 0"> 36 <li>Use Paint or other offects to draw seeds in each region that should belong to a separate segment. 37 Paint each seed with a different segment. Minimum two segments are required.</li> 38 <li>Click <dfn>Initialize</dfn> to compute preview of full segmentation.</li> 39 <li>Browse through image slices. If previewed segmentation result is not correct then switch to 40 Paint or other effects and add more seeds in the misclassified region. Full segmentation will be 41 updated automatically within a few seconds</li> 42 <li>Click <dfn>Apply</dfn> to update segmentation with the previewed result.</li> 44 Masking settings are bypassed. If segments overlap, segment higher in the segments table will have priority. 45 The effect uses <a href="https://www.spl.harvard.edu/publications/item/view/2761">fast grow-cut method</a>. 51 AbstractScriptedSegmentEditorAutoCompleteEffect.reset(self)
52 self.updateGUIFromMRML()
55 import vtkSlicerSegmentationsModuleLogicPython
as vtkSlicerSegmentationsModuleLogic
58 self.
growCutFilter = vtkSlicerSegmentationsModuleLogic.vtkImageGrowCutSegment()
59 self.
growCutFilter.SetIntensityVolume(self.clippedMasterImageData)
clippedMasterImageDataRequired
def __init__(self, scriptedEffect)
def computePreviewLabelmap(self, mergedImage, outputLabelmap)