Hi everyone,
I´ve segmented the screws of an intraoperative CBCT of one of my spinal surgeries.
This is the result:
I´ve used Segment Statistics to get each segment center and I want to iterate all of them.
My problem is that they are messed up in space. Is there any way to organize them in colums and rows to iterate them in logical order from upper left to botton right?
Hi Steve,
This is the main problem. I get all screws in a single segment and then I split it with Islands tool. They have no order at all and I want to rename them in an automated way by position in the space.
Thanks for your help!
Glad to help, but unfortunately I don’t think there’s any existing/reliable way to do this automatically. It would be possible to come up with a heuristic that would usually give you a reasonable answer but may not be correct if there is a lot of variability in the input. In the Segment Statistics advanced options you can enable calculation of centroids (in patient RAS space). You could break those into R, A, and S and probably sorting by R and S would be what you want.
@lassoan .
I´ve found a problem with my code if “second” i the same point as “first” because I loose a screw.
I´ve tryied to fix it with:
second = pointsMini[np.argmax(s)]
if np.array_equal(first, second): continue
Slicer crash with this with no error in Python Interactor. I just have to close Slicer because it´s continuosly processing something (while loop… of couse).
I´ve also tried: (first==second).all() and np…array_equiv(first, second) but all of them block Slicer app.
Do you know what i´m doing worng?
Thanks in advance.