How to expand a segment size via Python

Hi Andras,

I tried to use the Margin effect’s implementation to increase the segment margins, but the argument of the SetDilateValue function must be a real number and not a list.

erodeDilate = vtk.vtkImageDilateErode3D()

erodeDilate.SetInputData(contour.GetSegmentation().GetSegmentRepresentation(target, 'Binary labelmap'))

marginX = patient.ptvMargins[0]
marginY = patient.ptvMargins[1]
marginZ = patient.ptvMargins[2]

margins = [marginX, marginY, marginZ]
erodeDilate.SetDilateValue(margins)

What I really needed is something like the ContourMorphology module of SlicerRT extension. But this module is no longer available in the latest nightly version.

How can I get the same output? I would really appreciate your help.