I want to obtain x,y,z,HU from DICOM(bone regions)

I want to obtain bone regions of each coordinate(x,y,z,HU) from DICOM.
You can see my source at here.
I use input volume from DICOM loaded, and input segment from segment of DICOM.
so I obtain x,y,z,HU and display each x,y,z , but result like photo is not I want .
image

Did I do anything wrong to obtain coordinate(x,y,z,HU) from DICOM?

(x,y,z,HU) would be an incredibly inefficient representation of segmented structures. Segmentations are stored in a much better, memory-efficient and processing-friendly 3D array representation. You can compute anything you need from this array. What is your end goal?

@lassoan
Thanks for reply!
I want to obtain every coordinate(x,y,z,hu) of a full-bodied bone from DICOM.
If I want to obtain full-bodied bone’s ever coordinate , Am I doing it right?

image
Using the DICOM file and the segmented area, I want to get all the coordinates (x, y, z) of the green area shown in the picture and the corresponding HU value

It sounds like you are looking for this script:

https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html?highlight=numpy.where#get-the-values-of-all-voxels-for-a-label-value

Thanks for reply.
I checked the script you mentioned, but I didn’t get all the x,y,z,hu of the segment I wanted.
You can check my code at here.

I’m not sure where in your code to look. The numpy.where command and related lines in the link I sent should give you what I understand you are looking for.

Thanks for reply!
You can check my code at here from 360 line.
and result .csv of coordinate you can check here (ex : Extraction_IJK_of_HU(DCM).csv, volumes.csv).

We can only guess here but maybe what you really need is the Segment Statistics module.

Thanks for reply.
I used Segment Statics Module for obtain x,y,z,hu but this module does not provide.

What you keep describing (x,y,z,HU) cannot possibly be your end goal. It would help us a lot if you explained what it is actually that you want to achieve.

My goal is to obtain the coordinates of all the voxels in the bone, including the HU value (ex: x,y,z,HU), as shown in the picture in the text. When taking the currently extracted coordinates (Point Cloud), the scale does not seem to fit better than it does on the Slicer. It is difficult for me to understand that the number of voxels in the Segment Statistics module is the same.

Getting a list of (x,y,z,HU) values is the first step of your data processing workflow. We would like to know what you plan to use these values for and ultimately what is the end goal, what would you like to compute from these values, what is that you want to display to your end users.

The reason is that most relevant clinical problems are not new and there are plenty of known, reasonably good solutions to common problems that you can use as a starting point. We would rather help you finding relevant prior work to build on, instead of assisting with reimplementing a new, potentially suboptimal method.

Thanks for reply @lassoan .
I want to get Femur’s x,y,z,hu values from DICOM for finite element analysis.
Currently, the labelMapNode was constructed using VolumeNode and SegmentNode, and the value thought to be x, y, z was obtained, which I think is a different coordinate system as shown in the picture. So I thought I should convert this into RAS coordinates, so I tried looking Script repository — 3D Slicer documentation and edit my code at HounsFieldUnit.py from 360 line , but it’s not working.
image

Thank you, this is very important information. This confirms that, as expected, you should not try to create this (x, y, z, hu) point list. It takes you farther from achieving your goal.

You can create a volumetric mesh suitable for finite element analysis using SegmentMesher extension. You can then use Probe volume with model module to get HU values at each mesh point. The result is a FEM-ready mesh. If your finite element analysis software cannot use a mesh in vtu or vtk format then you can consider using a different engine (such as FEBio) or use meshio Python package or write custom code to convert to a different volumetric mesh format.

thanks kookoo9999s und your reply about the quetions and information.

I have the same problem like kookoo9999 , the end goal is to calculate the density of each coordinate point (x, y, z), that why kookoo9999 wants to get the point list (x, y, z, hu), because there is a formula between HU and density.

now there is a new way you provided to use segmentmesher. my steps are:

  1. install segmentmesher 2. use segmentmesher clever function 3. use volume with model
    but there is an error as attachment shown. Is there something wrong with my operation?

looking forward to your reply and many thanks :grinning:
12345

@leeyrics , I’m glad my issue looks helpful for you.
I don’t know segmentmesher module and it’s usage in 3d slicer. Is it python script module for command line??

Probe model with volume module does exactly this: it saves the HU value to each model point.

The error message indicates that the model node that you retrieved by the Output model name is empty. Double-check that the Probe Volume with Model input Model is valid, then click Apply, wait for the processing to complete, check that the resulting Output Model looks good, and then run your script.