6 from SegmentEditorEffects
import *
10 """ AutoCompleteEffect is an effect that can create a full segmentation 11 from a partial segmentation (not all slices are segmented or only 12 part of the target structures are painted). 16 AbstractScriptedSegmentEditorAutoCompleteEffect.__init__(self, scriptedEffect)
17 scriptedEffect.name =
'Fill between slices' 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/FillBetweenSlices.png')
27 if os.path.exists(iconPath):
28 return qt.QIcon(iconPath)
32 return """<html>Interpolate segmentation between slices<br>. Instructions: 34 <li>Create complete segmentation on selected slices using any editor effect. 35 Segmentation will only expanded if a slice is segmented but none of the direct neighbors are segmented, therefore 36 do not use sphere brush with Paint effect and always leave at least one empty slice between segmented slices.</li> 37 <li>All visible segments will be interpolated, not just the selected segment.</li> 38 <li>The complete segmentation will be created by interpolating segmentations in empty slices.</li> 40 Masking settings are ignored. If segments overlap, segment higher in the segments table will have priority. 41 The effect uses <a href="https://insight-journal.org/browse/publication/977">morphological contour interpolation method</a>. 46 interpolator = vtkITK.vtkITKMorphologicalContourInterpolator()
47 interpolator.SetInputData(mergedImage)
49 outputLabelmap.DeepCopy(interpolator.GetOutput())
50 imageToWorld = vtk.vtkMatrix4x4()
51 mergedImage.GetImageToWorldMatrix(imageToWorld)
52 outputLabelmap.SetImageToWorldMatrix(imageToWorld)
def computePreviewLabelmap(self, mergedImage, outputLabelmap)
def __init__(self, scriptedEffect)