Integrate an existing script to 3D slicer


I developed a Python script to segment the ventricle on a semi automated way and I wanted to make it as an extension to 3D Slicer. I’m new to the software and don’t know much of it.

The idea of the original code is, based on labels of the heart objects and user interaction, it recognizes the left ventricle and makes contour around it, then it allows the user to edit the contour by dragging its points. What I wanted to know is if there’s a similar example to take a look (examples on labeling objects or editable polygons) or if I can somehow pass the coordinates of the contour (polygon) to the Markup Closed Curve so it can plot it.


I would recommend to complete the PerkLab bootcamp’s Slicer Programming tutorial to get started with Slicer module development.

Since you are developing an interactive segmentation tool, I would recommend to implement it as a Segment Editor effect. There are several examples in SegmentEditorExtraEffects extension (they are all Python-scripted modules). Try all of them to see which one is the most similar to what you want to achieve.

Great I’ll try that, thank you @lassoan!