What is the best way to draw a triangle shape with Python

Hi everyone,

I’m new to 3D Slicer and I was wondering what would be the best way for me to draw a triangle on a 2D and 3D view using python. Considering I have a specific coordinates, I could process it into 3 points (to represent the triangle), at that point what would the best options to draw the triangle?

After some research I saw that I could use Segmentation, a bit like in this topic

Is this the way to go or is there some kind of extension that is already doing such thing?

Thank you in advance,

Minh.

The thread you linked makes sense if your goal is to make a filled triangle (segmentation). If you just want lines, you could make a closed curve markup and set the interpolation to linear.

https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#adding-control-points-programmatically

1 Like