I want to get each centroid of the pedicle sections in green slice(as shown below) by code.
You can get the current slice image from the slice logic of the slice widget at shown in this example.
However, probably you can get the ideal pedicle screw axis position and orientation directly in 3D by segmenting a pedicle. It can be as simple as Paint a sphere with “Editable intensity range” set to bone. You could further improve result by applying Island effect → Extract largest island. To fill the internal holes in the segment you can use Wrap Solidify effect. You can get the axis position and direction of this bone segment using Segment Statistics module. You can get the centerline curve of the pedicle using VMTK extension’s Extract centerline module.
I didn’t understand this example.
Due to some special cases such as osteoporosis, segmenting a pedicle with script is not always ideal.
I’ve been exploring the ideal pedicle axis in the imaging sense, using Slicer and plugins like VMTK. . . However, for the reasons mentioned above, it was unsuccessful.
Teacher, do you mean that the `np.average()’ of the coordinates of each vertex of the polygon is the centroid of the polygon?
Well, the current question now becomes how to extract the vertex coordinates of a polygon of the current section. . .
Yes, I know that segmentation of the pedicle is often not trivial, but there are many Segment Editor tools that can help with this. You could also train a neural network using MONAILabel extension to segment the pedicles fully automatically.
I want to weight the centroid obtained above by the reciprocal of voxel (CT value), how to do it?