Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - hilden

Pages: [1]
1
Automation / Re: Grayvalues for Material ID's using Python
« on: June 13, 2025, 12:35:28 PM »
Hi,

I assume, your gray value image does not have index 1. If only one image is loaded it has always index 0. If more images are loaded, have a look at the Color By combo-box in the Volume Field tab. Counting starts with 0. The fields have the order in which they are loaded to GeoDict.
[attachimg=1]

Another thing I noted in your code example, is that the indentation does not seem to make sense within the loop. In the example in the User Guide it was meant like the following. I marked the significant differences to your code with "!!!".

Code: [Select]
VolumeInfo  = gd.getVolumeFieldsInfo() # get list of dictionaries of loaded Volume Fields and assign it to variable VolumeInfo
nx, ny, nz  = gd.getVolDimensions()    # get the number of voxels in X-, Y- and Z-direction and assign the numbers to variables
Structure   = gd.getStructure()        # assign 3D numpy array describing the loaded structure to the variable Structure

# !!! In the following command ensure to have the right index for your gray value field !!!
Name        = VolumeInfo[0]['name']    # assign the name of the volume field to the variable Name.
VolumeField = gd.getVolumeField(Name)  # assign the numpy array describing the volume field to the variable VolumeField
Statistic   = []                       # Create empty list to store the statistical values

for k in range(nz): # loop over all Z-layers
 value_sum   = 0    # creating variable value_sum to sum up the result values
 value_count = 0    # creating variable value_count to count the summands

 for j in range(ny):  # loop over all Y-layers

  for i in range(nx): # loop over all X-layers

    if Structure[i][j][k] == 0:                       # condition: if the kth Z-value in the jth Y-column of the ith X-layeris pore space (ID 0), the following indented section is executed
       value_sum   = value_sum + VolumeField[i][j][k] # add all pore space result values of the kth Z-layer to the sum value_sum
       value_count = value_count + 1                  # count the summands of value_sum

 # !!! The following section should have the right indentation according to what should be plotted. Since we want to have one value for each Z-layer it belongs to the outer loop (for k in range nz) and thus needs to have the same indentation level as the head of the second loop, here 1 space. !!!
 meanVal = value_sum / value_count # compute mean value of all pore space result values in the kth Z-layer and assign it to the variable meanVal
 Statistic.append(meanVal)         # append the mean value of the Z-layer to the Statistic list

# !!! The following section needs to be outside of the loop to plot all data in one plot !!!
gDlg  = gd.makeGraphDialog()                  # create a graph dialog object
graph = gDlg.addGraph(Name, "Z layers", Name) # add a graph object with the name of the volume field as title and Y-axis legend and Z-layers as X-axis legend 
Z_layers = list(range(1, nz + 1))             # writes the Z-layer numbers 1, 2, …, nz-1, nz into a list named Z-layers
graph.addData(Z_layers, Statistic, Name)      # add a single dataset with the Z-layers as X-values, the mean result values as Y-values and the name of the volume field as legend to this graph
gDlg.run()                                    # show graph dialog

This will output something like this:
[attachimg=2]



2
Hello Caroline,

you can reduce the number of data points in the Electrolyte Model Parameters. Then, less computations are done for the meso parameters.

We have a tutorial for creating the txt files. This tutorial also has txt files for many of the database materials including NMC622. You can download it here: https://www.gddownload.de/Tutorials/Create-txt-file-for-concentration-dependent-parameters-in-active-material-expert-settings.zip
The password can be requested here: https://www.math2market.com/service-support/technical-support.html
But I will just send you the password via e-mail.

Best regards,
Janine

3
Hello Caroline,

do you run a homogenized simulation? For the homogenized simulation currently the meso parameters are computed for each data point from the concentration dependent parameter tables, which takes much time. With the upcoming Service Pack 3 for GeoDict 2025 it is possible to reduce this time. For this, set the Separator and  Binder & Carbon Black model parameters to porous and the input mode of the effective values to Tortuosity Factors. Then, the meso parameter can be computed from the tortuosity, which is much faster.

For the active material you can use concentration dependent parameters by using an expert setting as described in this YouTube tutorial: https://www.youtube.com/watch?v=wEhk8YZtQSI

Best regards,
Janine

4
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

5
Hi Mark,

reassigning only a part of a material should be possible with GeoPy, but not directly from the GUI. But did you try to crop each material and embed it again, after having them split by the app or an own GeoPy script? Then adding them together with LayerGeo Add, as suggested before? You could even use a table variable to set the cropping values as needed. I think, this is the easiest way for the task at the moment. So maybe step after step:

1. split the structure in it's materials, e.g. for a structure with 2 solid materials, split the structure in two structures, one only containing material 1 and one only containing material 2. This can be done by reassigning the other materials to the pore material and saving the structure afterwards.
2. If for example only material 1 should be clipped, crop the structure only containing material 1 and embed it afterwards with pore material to obtain the same domain size as before.
3. Use the module LayerGeo Add to add the differently cropped materials together.
[attachimg=1]

You can script all these steps in a GeoPy script and set a variable of type table, as explained in the GeoPy scripting User Guide on page 46. Then, you can define the cropping values for each material.

Best regards,
Janine

6
Hi Mark,

right away from the GUI it is currently not possible. But there could be other possibilities.

The Easy Image GeoApp can do a similar thing. There is an option called Split Structure by Materials. This splits the materials into different structures and adds them together again but shifted. This app can be found under GeoApp -> General -> Report & Image ->Easy Image. The parameter options open after clicking Run. For Image Presets select Split Structure by Material. There is also a YouTube tutorial for this feature https://www.youtube.com/watch?v=dVCApDddQPo. The tutorial is done with GeoDict 2020. Thus, the app is located in another place, but the functionality did not change much.

You could use the resulting structure parts and crop them as needed and add them again afterwards with LayerGeo - Add. If you need this often, you can write a GeoPy script for this task.

Best regards,
Janine

7
Automation / Re: Extract saturated structures with Python
« on: May 23, 2024, 04:03:11 PM »
Hi,

yes, there is. The values can be found in the Resultmap. Thus, you can access them from Python via the stringmap package. Find a detailed description for the stringmap options in the GeoPy Scripting User Guide on page 81 (https://www.math2market.com/fileadmin/UserGuide/GeoDict2024/Automation2024.pdf). Below find an example how the file with the saturation closest to 0.5 can be found.

Code: [Select]
import stringmap

gdr = stringmap.parseGDR("CapillaryPressureResult.gdr")
gdr.push("ResultMap")
saturationlist = gdr.getList("SaturationInvading")
print(saturationlist)

def getSaturationIndex(saturationvalue):
  saturationdifference = 1
  for saturation in saturationlist:
    diff = abs(saturationvalue-float(saturation))
    print(diff)
    if diff < saturationdifference:
      saturationdifference=diff
    else:
      saturationindex = saturationlist.index(saturation)
      break
  return saturationindex
 
file = f"CapillaryPressureResult/Step_{getSaturationIndex(0.5):06}.gdt"

8
Automation / Re: Add Description to Resultfile with python macro
« on: May 15, 2024, 12:46:12 PM »
Hello Mark,

you can change the result file from Python after the generation using the stringmap package. This package is described in the GeoPy scripting User Guide in the chapter "Access to GeoDict result files (*.gdr)" on page 81.
 https://www.math2market.com/fileadmin/UserGuide/GeoDict2024/Automation2024.pdf

I give you a short example code to change the description in the metadata tab of a FlowDict result viewer:

Code: [Select]
import stringmap
gdr=stringmap.parseGDR('StokesResult.gdr')
GDR_Description=gdr['Description']
gdr['Description']='some text\n'+GDR_Description
gdr.toFile('new.gdr')

Find the needed keys for the result part to change by printing the gdr in the console
Code: [Select]
print(gdr)
Best regards,
Janine

9
CT, µCT and FIB-SEM / Re: Labeling for AI segmentation
« on: November 29, 2023, 03:29:05 PM »
Hi Erik,

  • It is possible by using a GeoPy script. Attached find a script that labels the given gray value ranges with the according IDs. To run the script, the gray value image should be loaded in the Image Processing dialog. From the main GeoDict window select Macro - Execute Macro/Script and browse for the script. Click on Parameters to assign material IDs to value ranges in a table. Afterwards click Run to generate an AI-label file (*.gld). Load this file in the Image Processing dialog by clicking Load Labels and browsing for the file. To learn more about automation by scripting in GeoDict, refer to the GeoPy scripting User Guide: https://www.geodict.com/fileadmin/UserGuide/GeoDict2023/Automation2023.pdf.
  • Good news for you: With the new GeoDict 2024 release coming soon, a new feature is available. The "Magic Brush" analyzes the scan on clusters recognizing edges. Then, labels can be created by simply selecting these clusters.


Best regards,
Janine

10
Hello Erik,

Yes, there is. In the 3D Image Processing dialog under the Image Processing tab unfold Image Alignment and then Rotation. Select Automatic Rotation and choose Plane from the Automation Mode pull-down menu. When clicking apply the image is automatically aligned with two major axes. If you want to see a preview of the automatic rotation first, you can just click Suggest - Plane and observe the rotation overlay in the 2D visualization of your scan on the right.

Best regards,
Janine

11
Image Analysis / Re: Number of overlap points and angles
« on: August 31, 2023, 09:42:19 AM »
Hi Elise,

the number of overlap points you can obtain with MatDict -> GAD Objects Analysis -> Analyze Objects. The Results-Report tab in the Result Viewer shows the Number of Overlap Objects.

To analyze only one overlap object, you could for example right-click in the structure in an overlap region. The context menu offers the possibility to Select GAD objects. Use the first option to select all GAD-objects in this point. Then on the right open the GAD Object Selection tab from the side bar. Click Edit Objects and obtain the direction (orientation) from all of the fibers.

Finding all angles could be automated in a Python script. How exactly should the result look like? Something like a table with the overlap indices in one column and the angles for each of these overlap objects in the right column? If there are more than two fibers crossing, should each angle between every combination of the fibers be given? Or do you need only the orientations of all the fibers in the different points?

Best regards,
Janine

12
Image Analysis / Re: GeoDict-AI
« on: January 23, 2023, 12:28:14 PM »
Dear Ziho,

Yes, this is possible. You only need to create the same folder structure as Create Training Data would generate.

  • Create an empty folder with a meaningful name.
  • Inside create the folder Train. If needed also a folder Test can be created for the Validate Performance feature.
  • Inside the Train folder create as many folders as you have training data, named as desired for example in counting numbers starting with 0 as is done by the Create Training Data feature.
  • Inside each of these subfolders place an input.gdt and an output.gdt file. The input.gdt must have only two IDs (ID00 Pore and ID01 Solid) and output.gdt three ( ID00 Pore, ID01 Grains and ID02 Binder)
I hope, my answer helped you.
Best regards, Janine

13
Image Analysis / Re: GeoDict-AI the number of structures for training
« on: January 23, 2023, 12:19:03 PM »
Dear Ziho,
  • The number of needed training structures depends on how difficult it is to identify the target material in the structures. For very simple cases or for testing purposes 10 training structures are good. For more difficult parameter combinations 100 or more training structures can be needed.
  • The parameter range depends on the structures that should be analyzed by the network later.

    I hope, my answer helped you.
Best regards, Janine

Pages: [1]