Histogram of Grayscale Values for Material(s) Post Segmentation

· 5 · 96
*

jdrunner

  • *
  • Posts: 3
    • 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: 3
    • 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: 2
    • 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: 3
    • 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

 

SMF spam blocked by CleanTalk