How to get HU values at each fiducial points

Operating system: windows 10
Slicer version: 4.11.20200930

How can I get the HU (CT) value at each fiducial placed on a model surface?
I could convert vertices of an STL model to a group of fiducials as shown in the attached image.
Then I would like to add another column next to the RAS coordinate table of the fiducial group.

Thank you for your assistance.

Expected behavior:

Actual behavior:

I would like to know how I can get HU values at multiple fiducial points in the same group.
Ultimately, I’d like to get the HU values of the pixels corresponding to the vertices of the STL model placed in the CT volume data in a tabular format.

I was able to convert each vertex of the STL model to fiducial, as shown in the attached figure.

For these fiducial, is it possible to get the HU value and coordinate values of the pixels in which each of them is located in a table format?

I appriciate all supports from comunity members.

example|690x388

You can sample a CT volume with at each point of a mesh using “Probe volume with model” module, and get the point coordinates and density values as numpy arrays by typing these into the Python console:

modelNode = getNode('Output Model')
coords = slicer.util.arrayFromModelPoints(modelNode)
densities = slicer.util.arrayFromModelPointData(modelNode, 'NRRDImage')

If you need the CT density values for FEM analysis then an STL file will not be sufficient, as it is a surface mesh, so it will not contain density information in the bone. You can generate a volumetric mesh from a segmentation using SegmentMesher extension.

Dear Andras Lasso.

Thank you for your kind reply. In addition, I would like to thank you for teaching me how to obtain the data for finite element analysis.

And I could get the list of coordinates of the model vertices. (I confirmed that by typing “print (coords)” in console window.)
However, I only could get the error in your code line3.

It says

modelNode = getNode(‘Dishreg3’)
coords = slicer.util.arrayFromModelPoints(modelNode)
densities = slicer.util.arrayFromModelPointData(modelNode, ‘ikeimage’)
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\MasatoshiOba\AppData\Local\NA-MIC\Slicer 4.11.20200930\bin\Python\slicer\util.py”, line 1293, in arrayFromModelPointData
narray = vtk.util.numpy_support.vtk_to_numpy(arrayVtk)
File “C:\Users\MasatoshiOba\AppData\Local\NA-MIC\Slicer 4.11.20200930\bin\Lib\site-packages\vtkmodules\util\numpy_support.py”, line 216, in vtk_to_numpy
typ = vtk_array.GetDataType()
AttributeError: ‘NoneType’ object has no attribute ‘GetDataType’

Is there something wrong with the way I installed Slicer? Or am I specifying the files in my NRRDimage the wrong way?

Can you try to use the code that I wrote above (‘NRRDImage’ instead of ‘ikeimage’)?

Thank you again.
I tried that

densities = slicer.util.arrayFromModelPointData(modelNode, ‘NRRDImage’)
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\MasatoshiOba\AppData\Local\NA-MIC\Slicer 4.11.20200930\bin\Python\slicer\util.py”, line 1293, in arrayFromModelPointData
narray = vtk.util.numpy_support.vtk_to_numpy(arrayVtk)
File “C:\Users\MasatoshiOba\AppData\Local\NA-MIC\Slicer 4.11.20200930\bin\Lib\site-packages\vtkmodules\util\numpy_support.py”, line 216, in vtk_to_numpy
typ = vtk_array.GetDataType()
AttributeError: ‘NoneType’ object has no attribute ‘GetDataType’

If I type
print(modelNode) and print(coords) after I typed line 2, they return what I want.
So something wrong with executing line3.

Do you run this on the output of “Probe volume with model”?
Do you see the ‘NRRDImage’ array in Models module Scalars section?

Do you run this on the output of “Probe volume with model”?

Thank you so much, it resolved!
I didn’t run “Probe volume with model” module first, and that was the reason of failure.

modelNode = getNode(‘Output Model’)
coords = slicer.util.arrayFromModelPoints(modelNode)
densities = slicer.util.arrayFromModelPointData(modelNode, ‘NRRDImage’)
print(densities)
[ 376 320 83 541 523 420 488 537 364 508 532 260 168 244
171 651 948 203 166 438 422 135 32 136 145 216 263 79
471 252 42 15 493 620 492 537 428 537 573 117 287 35 …

1 Like