This instruction describes a set of MATLAB codes that should be used step by step to calculate and visualize the three types of porosity for a Region of Interest (ROI):
- Envelope porosity
- Local porosity
- Directional porosity
If you use our MATLAB codes, please cite the following article that contains details of the methodology:
Quan Sun, Yidong Xia, Jordan Klinger, Robert Seifert, Joshua Kane, Vicki Thompson, Qiushi Chen, "X-ray computer tomography-based porosity analysis: Algorithms and application for porous woody biomass." Powder Technology, 2021. https://doi.org/10.1016/j.powtec.2021.05.006
Step 1: Process 3D CT scan images using FIJI and export binary black/white (BW) slices. Refer to https://github.com/idaholab/LIGGGHTS-INL/tree/inl/tools/FIJI for step-by-step instructions.
Step 2: Import BW slices of the ROI and export in MATLAB data format: run Step2_import_bw_slices.m
to import the BW slices as a matrix and export in a *.mat file.
Step 3: Run Step3_local_porosity.m
to calculate the local porosity.
Step 4: Run Step4_directional_porosity.m
to calculate directional porosity and envelope porosity.
Step 5: Run Step5_plot_local_porosity.m
to plot local porosity.
Step 6: Run Step6_plot_directional_porosity.m
to plot directional porosity.
Step 7: Run Step7_export_voxel_list.m
to export the central coordinates of each voxel.
Note: Each file contains some user-specified inputs (e.g., kernel size n = *
and the type = '**'
)
Two step-by-step user tutorials are provided.
Copy all the MATLAB files (*.m) to a new working directory.
Step 1:
For this example, B/W images are provided. Therefore, FIJI is not needed for this example. Skip this step.
Step 2:
Run Step2_import_bw_slices.m
to import image slices from the folder Example_1/BW_images
.
A MAT data file is exported. Reference: Example_1/Benchmark_Results/Loose_packing.mat
.
Step 3:
Run Step3_local_porosity.m
to calculate the local porosity using kernel size L_e = 5 voxels (set n = 5
, type = 'Loose'
).
A MAT data file is exported. Reference: Example_1/Benchmark_Results/Loose_porosity_5.mat
.
Step 4:
Run Step4_directional_porosity.m
to calculate the directional porosity based on the local porosity results in step 3 (set n = 5
, type = 'Loose'
).
The envelope porosities (both bounding box porosity and convex hull porosity) are also calculated.
A MAT data file is exported. Reference: Example_1/Benchmark_Results/Loose_5_Dimensional_porosity.mat
.
Step 5:
Run Step5_plot_local_porosity.m
to plot the local porosity (set n = 5
, type = 'Loose'
). Reference resultant figures are shown below.
Step 6:
Run Step6_plot_directional_porosity.m
to plot directional porosity (set n = 5
, type = 'Loose'
). Reference resultant figures are shown below.
Step 7:
Run Step7_export_voxel_list.m
to export the central coordinates of each voxel of ROI. A "*.lmp" data file is exported. Reference: Example_1/Benchmark_Results/vox_list.lmp
.
Copy all the MATLAB files (*.m) to a new working directory.
Step 1:
For this example, Raw CT images are provided. One can choose to use FIJI to process raw images and obtain black-white (BW) images. In Example_2/Benchmark_Results/BW_Images, the set of processed BW images are included.
Step 2:
Run Step2_import_bw_slices.m
to import image slices from the folder Example_2/BW_images
.
A MAT data file is exported. Reference: Example_2/Benchmark_Results/Steel_packing.mat
.
Step 3: Run Step3_local_porosity.m
to calculate the local porosity using kernel size L_e = 5 voxels (set n = 5
, type = 'Steel'
).
A MAT data file is exported. Reference: Example_2/Benchmark_Results/Steel_porosity_5.mat
.
Step 4:
Run Step4_directional_porosity.m
to calculate the directional porosity based on the local porosity results in step 3 (set n = 5
, type = 'Steel'
).
The envelop porosities (both bounding box porosity and convex hull porosity) are also calculated.
A MAT data file is exported. Reference: Example_2/Benchmark_Results/Steel_5_Dimensional_porosity.mat
.
Step 5:
Run Step5_plot_local_porosity.m
to plot the local porosity (set n = 5
, type = 'Steel'
). Reference resultant figures are shown below.
Step 6:
Run Step6_plot_directional_porosity.m
to plot directional porosity (set n = 5
, type = 'Steel'
). Reference resultant figures are shown below.
Step 7:
Run Step7_export_voxel_list.m
to export the central coordinates of each voxel of ROI. A "*.lmp" data file is exported. Reference: Example_2/Benchmark_Results/vox_list.lmp
.