Exporting the thickness bone table from Bone Thickness Mapping extension

Hi,
I’ve been using Bone Thickness Mapping extension. It’s an amazing tool and the heatmap it creates is super useful. However, I need to have access to thickness values to do more statistical analyses. I assume for each pixel or coordinate, there is a thickness value. I’m new in scripting and still learning Python. From Line 921 to 924 of the provided script (BoneThicknessMapping.py), it says:

thickness table

    ix = [int(i) for i in [minmax_thickness[0]*gradient_scale_factor, (minmax_thickness[1])*gradient_scale_factor + 1]]
    thicknessTableNode = BoneThicknessMappingLogic.build_color_table_node('ThicknessColorMap', ix[-1])
    for i in range(ix[0], ix[-1]): calculate_and_set_colour(thicknessTableNode, i, hue=p(i, ix[-1], ix[0]) * 0.278, sat=0.9, val=0.9)

Does this mean that the data I’m after is called “thicknessTableNode”? If so, would you let me know how I can save the data in a table, text file or other formats?

Thanks,
Mo

I haven’t used the module myself, but the thickness data is stored as a scalar field on a model node, so you can use arrayFromModelPointData to get a numpy array. You can also arrayFromModelPoints to get the corresponding vertex coordinates in RAS space.

You could file an issue on the extension repository to explain what you are trying to do and get more clues.

Thanks for your reply.
Would you also make an example of how to export the thickness data and vortex coordinates in RAS space in a text or csv file? I need to export this file out of 3D Slicer.

Thanks a lot.

You get all these values in numpy arrays, so you can easily save them in any format you need. There is nothing Slicer-specific in this, you can just use basic Python functions from packages like numpy, pandas, etc.