0

A python novice here, so I am sorry if the question seems stupid. I am trying to create a 3D binary mask using a list of contour points. Basically, I want to take an empty 3-dimensional numpy array of a fixed shape and fill the region (all the pixels) enclosed by some points in a list (list of cartesian coordinates) as 1 and everything outside as 0. I will then write this array out into a volume file to use for some other things.

I haven't been able to find a package that can do this for a 3D array; I could only either find fill inside polygons for 2D arrays (using OpenCV). I would appreciate if you could point me to a package/approach that I can use for this.

  • Does [this](https://stackoverflow.com/questions/37117878/generating-a-filled-polygon-inside-a-numpy-array) answer your question? – Tom Wagg Dec 21 '22 at 02:44

0 Answers0