Calculate volume of largest and minimum ellipse around a segmentation

Thanks for sharing your implementation of computing the optimal ellipsoid.

I believe you are asking to get the points from a contour in SimpleITK.

The above linked PR was merged and you can download the latest binaries to use it.

Here is sample usage:


In [4]: labels = sitk.ReadImage("/scratch/blowekamp/SimpleITK/SimpleITK-build/ExternalData/Testing/Data/Input/2th_cthead1.png")                                                                                                                             

In [5]: sitk.LabelContour(labels, fullyConnected=False)                                                                                                                                                                                                     
Out[5]: <SimpleITK.SimpleITK.Image; proxy of <Swig Object of type 'std::vector< itk::simple::Image >::value_type *' at 0x7f8052bdbc00> >

In [6]: contours = sitk.LabelContour(labels, fullyConnected=False)                                                                                                                                                                                          

In [7]: shape = sitk.LabelShapeStatisticsImageFilter()                                                                                                                                                                                                      

In [8]: shape.Execute(contours)                                                                                                                                                                                                                             

In [9]: shape.GetLabels()                                                                                                                                                                                                                                   
Out[9]: (100, 200)

In [10]: idx = shape.GetIndexes(100)