Giter Club home page Giter Club logo

deepangle's Introduction

DeepAngle

Fast calculation of contact angles in tomography images using deep learning

Paper on arXive: Link. Paper on Science Direct: Link.

DeepAngle is a machine learning-based method to determine the contact angles of different phases in the tomography images of porous materials. Measurement of angles in 3-D needs to be done within the surface perpendicular to the angle planes, and it could become inaccurate when dealing with the discretized space of the image voxels. A computationally intensive solution is to correlate and vectorize all surfaces using an adaptable grid, and then measure the angles within the desired planes. On the contrary, the present study provides a rapid and low-cost technique powered by deep learning to estimate the interfacial angles directly from images. DeepAngle is tested on both synthetic and realistic images against direct measurement technique and found to improve the r-squared 5 to 16%, while lowering the computational cost 20 times. This rapid method is especially applicable for processing large tomography data and time-resolved images, which is computationally intensive. This is the summary of the data flow from tomography images to contact angle prediction.


Accuracy?

We have validated DeepAngle by comparing it with direct measurement tequnique to predict contact angles on convex and concave surfaces. Please refer to the linked Paper for more details. The raw volumetric images of this test are availible in this repository at "Data/Test/".


How to use?

Here, I have written some demos to calculate a few contact angles.

Demo #1 : Calculating the contact angle distribution from real data

In this example, the input data is recorded in an hdf file with the format of 16-bit signed integer and filed name of "/Map". Three phases are availible in the image, solid, fluid #1 and fluid #2. Solid is denoted by voxel values of 1, fluid #1 which is assumed to be the wetting phase or water is coded as voxel values of 0, and fluid #2 is coded with voxel values of 2. If you are dealing with clyndrical images instead of a full cube, use -1 for pixels out side of the region of interest. In this example, the raw tomography data is sub-sampled from the data of this paper: [From connected pathway flow to ganglion dynamics by Rucker et al.].

import deepangle as da
# Name of the hdf5 file containing the volumetric image (h5 field name: /Map)
Data='Data/Data1.h5';
# Extracting contact angles and corresponding points 
Angles,Coordinates=da.getangle(Data,Para=0)
# Plotting the angle distribution
da.hist(Angles)
# Exporting the results as a text file
da.saveresults(Angles,Coordinates,'Output1')

# Example for reading from Matlab file
Data='Data/Data2.mat';
Angles,Coordinates=da.getangle(Data,Para=0)
# Plotting the angle distribution
da.hist(Angles)
# Exporting the results as a text file
da.saveresults(Angles,Coordinates,'Output2')

and this the plotted distribution:


and this an example of the saved output file as txt:

Demo #2 : Explicitly getting a 3D array as input

import deepangle as da
import scipy.io as sio
# Reading a Matlab saved variable from the data directory that contains a variable called "A"
Data=sio.loadmat('Data/Data2.mat')  
Data=Data['A']
# Visulizing 3 mid-slices of the volumetric image
da.sliceshow(Data)
# Extracting contact angles and corresponding points by explicitly giving the numpy array as input
Angles,Coordinates=da.getangle(Data)
# Plotting the angle distribution
da.hist(Angles)
# Exporting the results as a text file
da.saveresults(Angles,Coordinates,'Output1')

and the sliceshow output would be:


How to install?

Simply download/clone the github repository and start importing the deepangle.py functions as in Demo#1. Make sure to have these python packages installed:

  • tensorflow
  • joblib
  • tqdm
  • edt
  • h5py
  • sklearn
  • scipy
  • numpy
  • matplotlib

Citation

Please consider citing this paper if you are using DeepAngle in your research: [Rabbani, A., Sun, C., Babaei, M., Niasar, V. J., Armstrong, R. T., & Mostaghimi, P. (2023). DeepAngle: Fast calculation of contact angles in tomography images using deep learning. Geoenergy Science and Engineering, 227, 211807.]

deepangle's People

Contributors

arashrabbani avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.