Someone in here editing DICOMs? I want to determine the lowest point of the mandibular ramus (gradient = 0) in a 3D-reconstruction DICOM file.
So I already seperarated the section of the ramus via python in a converted DICOM (512/512 pixel) file to make it a bit easier, because now there’s just one curve (the ramus) in there to analyze.
But I didn’t find out how to program an algorithm to automatically get the lowest point in the curve.
I know its a bit specific, but maybe someone here managed to detect a specific point in a (bone) structure already. It would help a lot.
Thanks in advance!
Yes, most of us here do.
Gradient would be 0 for all the local minima and would not be robust on a noisy, imperfect mesh or curve. A simpler way to get minimum point position by getting the minimum coordinate value along a selected axis.
You can get all coordinates of points of a model node using
slicer.util.arrayFromModelPoints(). You can then use standard numpy operations to get the position of the “lowest” point:
import numpy as np points = slicer.util.arrayFromModelPoints(modelNode) minZ = points[:,2].min() minIndex = np.where(points[:,2]==minZ) minPoint = points[minIndex] print(minPoint)
If you did not segment the image but just specified a curve then you can get its points by calling
First of all thanks for your quick response.
This is great!
But Im still not sure how to select one ramus out of the sector.
I added some images to show you my problem.
The sticking point is the red cross (3rd picture) on the ramus I posted in the first picture (I managed to seperate this ramus as you see in the second picture). Maybe this helps a bit.
If you are looking for the most distal point along an arbitrary measurement axis then probably the easiest solution is to transform the curve to a coordinate system where that arbitrarily oriented axis is the z axis (you can create the transform similarly as in this example, but instead of passing the plane normal and planeX direction to SetSliceToRASByNTP, you would put them in columns of a homogeneous transformation matrix). You can then get the minimum z value (as I described above) to get the lowest position along the measurement axis.
Can you write a bit more about your clinical application? What is your end goal? Do you segment the bone or just draw markups on the volume-rendered surface?
So the goal is to know the lowest point of the mandibular ramus in every DICOM I want to analyze to find out what type of fracture (AO-Classification-System) it is. Therefor you have to know 1. The lowest point of the ramus Id showed in the picture 2. The outermost point of the lower (bigger) ramus (it is the lowest cross in the picture) and a second point of the ramus to draw a tangent. I marked three Red Cross in the picture: top left (this is the one we need to find out with help of the program because its the most difficult one to find out with the naked eye and its the most important one), bottom right (the lower outermost point of the ramus to draw the tangent) and any 3rd point at the ramus (3rd cross top right) to finish the tangent.
Then we connect the 1st cross with the tangent (90°) and I can classify the fracture history and plan how to operate this type of fracture at the end.
So first step: The 3D Slicer need to detect the right ramus to calculate the lowest point of it. And that’s my problem, because I don’t know to mark this specific ramus in a DICOM with lots of curves, angles …
I hope its understandable for you, I do my really best.
You can display the volume in 3D using Volume Rendering (it will look similar to your screenshots above) and draw curves and lines on it. All quantifications (getting intersection points, extrém, etc) should be easily doable by a short Python script. Would this work for you?
Yeah this would be really great! So how do we want to do this?
I have a series of 50 original DICOMs and 49 (somehow I couldn’t convert the last picture) Python-converted DICOMs (the separated section of the ramus) (+Python and 3D-Slicer).
Perhaps the best thing would be to show you the DICOMs if it is possible. What is the easiest way to try out for you? I am pretty open.
Thank you very much in advance.
I am very grateful for your help.