In-situ-Contact-Angle-Extraction
In-situ-Contact-Angle-Extraction
Automatic extraction of in situ contact angles from 2D and 3D pore space images
Summary
This document presents MATLAB scripts and the accompanying instructions for running automatic extractions of in situ contact angles from segmented pore-space images of immiscible fluid pairs in porous media and 2D slices of them. The code performs the identification of contact points between the fluid/fluid/solid phases, an initial Coarse – and a final (Fine) estimate of contact angle distribution.
Installation
You should have at least MATLAB 2015a installed on your computer.
Usage
Input file format
-
Input data are segmented pore space images. A stack of slices forms the 3D data set.
-
The segmented: non-wetting (oil or gas), wetting (brine), and solid (rock) phases should have pixel values of 0, 1, and 2, or 1, 2, and 3, respectively.
-
Example files comprising a stack of 2D images (basins000.tif to basins014.tif) are shown in the folders: 2DCoarseAndFineEstimate, 3DCoarseEstimate, and 3DFineEstimate. Air, Water, and Solid phases are respectively shown as grey, pink, and blue.
Running the 2D algorithm for both Coarse and Fine estimates
-
You can choose to run the code for only a single 2D slice - in which case you will need to run the Compute2D.m file, or for a stack of 2D slices – in which case you will need to run the Run2DStack.m file from the folder: 2DCoarseAndFineEstimate.
-
If you wish to run a stack of 2D slices, then you must specify the number of slices “n” under the Run2DStack.m file. In addition, you will have to specify the orientation of the images by uncommenting the appropriate line of code under the fun_Run2DStack.m file. In some cases, you may also wish to reduce the size of each 2D image by specifying the x and y pixel ranges of the variable “b” under the fun_Run2DStack.m file.
-
To run either a single 2D slice, or a stack of slices, you will need to specify values for the variables: compType (0 = coarse estimate, 1 = Fine estimate), maxErr, dg (in microns), and Res (in microns). maxErr is the maximum allowable fitting error (for the Fine estimate only). The default value = 2; the user can choose to increase this value. However, the lower the value, the lesser the fitting error, hence the better the confidence in the result. dg is the mean diameter of the grains, while Res is the spatial resolution of the image.
Running the 3D algorithm for Coarse estimate
-
Specify the mean grain diameter dg (in microns), and the image resolution, Res (in microns). Then run the Compute3DCoarse.m file from the folder: 3DCoarseEstimate
-
The code runs the entire 3D volume of the input image. However, in some cases you may wish to run a subvolume of the 3D image by specifying the x, y and z minimum and maximum voxel values of the variable “I” under the fun_Read2DStack.m file. In cases where you choose to for instance reduce the x and y voxel value, but not the z value, then the minimum and maximum z values should be specified as “NaN”. Please remember, as appropriate, to comment or uncomment the line of code with volume reduction under the fun_Read2DStack.m file.
Running the 3D algorithm for the Fine estimate
-
Specify the maxErr (as described under the 2D algorithm), the mean grain diameter dg (in microns), and the image resolution, Res (in microns). Then run the Compute3DFine.m file from the folder: 3DFineEstimate
-
The code runs the entire 3D volume of the input image. However, in some cases you may wish to run a subvolume of the 3D image by specifying the x, y and z minimum and maximum voxel values of the variable “I” under the fun_Read2DStack.m file. In cases where you choose to for instance reduce the x and y voxel value, but not the z value, then the minimum and maximum z values should be specified as “NaN”. Please remember, as appropriate, to comment or uncomment the line of code with volume reduction under the fun_Read2DStack.m file.
Citation
If you use our code for your research, please cite the following relevant literature: The developed algorithm for in-situ contact angle extraction
@article{https://doi.org/10.1016/j.cageo.2020.104425,
author = {Ibekwe, A., Pokrajac, D., and Tanino, Y.},
title = {Automated extraction of in situ contact angles from micro-computed tomography images of porous media},
journal = {Computers & Geosciences},
volume = {137},
number = {104425},
pages = {1--12},
keywords = {Contact angle, Wettability, Micro-CT, Tomography, multiphase flow, Pore scale imaging},
Cite As
Ibekwe, A., Pokrajac, D., and Tanino, Y., 2020. Automated extraction of in situ contact angles from micro-computed tomography images of porous media. Comp. Geosci. 137, 104425.
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
2DCoarseAndFineEstimate
3DCoarseEstimate
3DFineEstimate
Version | Published | Release Notes | |
---|---|---|---|
1.0.0 |