Histogram of Grayscale Values for Material(s) Post Segmentation

· 8 · 183
*

jdrunner

  • *
  • Posts: 4
    • View Profile
  • Position: Undergraduate Research Assistant
Hello,

I am trying to create/find a histogram showing the grayscale values of a multi-material sample post segmentation. The sample was segmented using Geodict AI. The segmentation contains 2 material ID's of interest. I was curious if there was a way to obtain a histogram of each material's grayscale values (desired to look at the mean and mode of grayscale values for each material). Thank you.

Respectfully,
Jack Davis

*

hilden

  • *****
  • Posts: 10
    • View Profile
Re: Histogram of Grayscale Values for Material(s) Post Segmentation
« Reply #1 on: April 04, 2025, 12:34:51 PM »
Hello Jack,

there are many options to analyze volume fields with the Compute Metrics command, as described here: https://geodict-userguide.math2market.de/2025/geodict_computemetrics.html

For example, you can compute the mean value and standard deviation for a specific material with it. However, the option to compute the histogram for only one material is not included yet.

But if needed, you can use Python to create your own custom histogram GeoApp.

For example, you get a 3D numpy array of your structure using the command gd.getStructure() as described here:
https://geodict-userguide.math2market.de/2025/automation_api_structure.html?anchor=getstructure

and for your volume field using gd.getVolumefield(volume field index), as described here:
https://geodict-userguide.math2market.de/2025/automation_api-results.html?anchor=getvolumefield

Then, you can for example use numpy methods to get a histogram for only one material ID.
https://numpy.org/doc/stable/index.html

Best regards,
Janine

*

jdrunner

  • *
  • Posts: 4
    • View Profile
  • Position: Undergraduate Research Assistant
Re: Histogram of Grayscale Values for Material(s) Post Segmentation
« Reply #2 on: April 23, 2025, 04:29:42 PM »
Hi Janine,

Thank you for your response it was helpful. I did have a question, however. I was able to create a volume field and Compute Metrics.

Whenever I ran the compute metrics, the data given showed a value of 0 for all grayscale values. My question in regard to this data is, what exactly is the Compute Metrics measuring? I think I might be inputting something wrong, which is leading to the module calculating a different metric. Thank you.

Respectfully,
Jack Davis

*

Jonas Schabernack

  • Math2Market Employee
  • *****
  • Posts: 4
    • View Profile
  • Position: Application Engineer Support Team
Re: Histogram of Grayscale Values for Material(s) Post Segmentation
« Reply #3 on: April 25, 2025, 01:38:24 PM »
Hi Jack,

Thanks for your message - great to hear the previous response was helpful!

Regarding the issue you're seeing, could you specify your workflow and settings for using Compute Metrics on your gray-value dataset?

As an example, I applied Compute Metrics to one of the gray-value datasets that we deliver with GeoDict (Long Fiber Composite):

First, I loaded the dataset and segmented it into solid fibers and pore space using Global Thresholding with the Otsu method.


Now with both the segmented structure and Gray Values volume field loaded, I selected Compute Metrics on this volume field.


In the Compute Metrics dialog I chose to compute the Minimum, Maximum, Mean Value, Standard Deviation and Variance. I computed three cases:
  • For All Materials
  • For Chosen Material IDs -> 0 to get the metrics only for the pore space gray values
  • For Chosen Material IDs -> 1 to get the metrics only for the fiber gray values
This gave me the following results:


You can see the difference, e.g. between the mean gray values for pore space (16.776), fibers (82.6702), and the complete dataset (27.5684).

Please let me know if this explanation helped you or if you have any questions.

Best regards,
Jonas



*

jdrunner

  • *
  • Posts: 4
    • View Profile
  • Position: Undergraduate Research Assistant
Re: Histogram of Grayscale Values for Material(s) Post Segmentation
« Reply #4 on: April 25, 2025, 04:23:16 PM »
Hello Jonas,

In terms of my workflow, I have uploaded our dataset into GeoDict and segmented using AI segmentation, boosted Tree model.

After segmentation, I created a Gray Values volume field. I then selected Compute Metrics on the Gray values volume field.

I also chose to compute the minimum, maximum, mean value, Standard Dev, and variance. I computed the values for one material ID for a test run. The results were as follows

*

Jonas Schabernack

  • Math2Market Employee
  • *****
  • Posts: 4
    • View Profile
  • Position: Application Engineer Support Team
Re: Histogram of Grayscale Values for Material(s) Post Segmentation
« Reply #5 on: April 28, 2025, 10:33:14 AM »
Hello Jack,

thank you for the clarification. Could you please specify how exactly you created the Gray Values volume field?
From what you describe, it seems that your volume field might be empty and does not actually contain any values.

The easiest way to obtain the Gray Values volume field is by importing your dataset using ImportGeo-Vol.
This automatically loads the dataset into the import dialog and, at the same time, into the main GeoDict GUI as a volume field containing the gray values for each voxel.

Let me know if this helps or if you run into any issues!

Best regards,
Jonas

*

jdrunner

  • *
  • Posts: 4
    • View Profile
  • Position: Undergraduate Research Assistant
Re: Histogram of Grayscale Values for Material(s) Post Segmentation
« Reply #6 on: April 30, 2025, 04:09:30 PM »
Thank you for the information, and I was able to import and obtain a populated Volume field.

My dataset is a 3-phase material. With that, the analysis assigned only 3 grayscale values: 0 for one material ID, 1 for the second, and 2 for the third.

I was hoping to get the range of grayscale values attributed to the materials, rather than a strict assignment of gray value (such as 0 for material 1, 1 for material 2, and 2 for material 3). Is this possible?

Thank you.

*

Jonas Schabernack

  • Math2Market Employee
  • *****
  • Posts: 4
    • View Profile
  • Position: Application Engineer Support Team
Re: Histogram of Grayscale Values for Material(s) Post Segmentation
« Reply #7 on: May 06, 2025, 04:21:12 PM »
Hello Jack,

from your description, it sounds like you're currently viewing the segmented structure with three materials, rather than the original gray value volume field.

Let me walk you through the full workflow I use, which might help clarify things:

1. Import the dataset via ImportGeo-Vol. Enter all necessary parameters (like voxel size), then click on Image Processing.

2. This opens the 3D Image Processing dialog, where you can process the images (e.g., crop, rotate, or filter), and then segment them into different materials. At this point, the gray value data is also loaded into the main GeoDict window as a Volume Field.


3. Segment the structure using tools like Global Thresholding or AI Segmentation. After clicking Create Segmentation, the segmented structure is loaded into GeoDict and visible alongside the gray value volume field.


4. With both the segmented structure and gray value data loaded, you can now compute gray value statistics for each material using Compute Metrics. To do this, right-click the Gray Value volume field in the Project Status section and select Compute Metrics.


5. In the dialog, ensure the Gray Value field is selected. Choose which metrics to compute (e.g., Minimum, Maximum, Mean Value, Standard Deviation and Variance), then under Values for, select Chosen Material IDs and specify the material of interest. Click Run to generate the statistics for the gray values of belonging to this material only.

 
Let me know if anything remains unclear or if you need help with a specific step.

Best regards,
Jonas

 

SMF spam blocked by CleanTalk