Calculates the porosity of an image assuming 1’s are void space and 0’s are solid phase.
All other values are ignored, so this can also return the relative fraction of a phase of interest in trinary or multiphase images.
im (ND-array) – Image of the void space with 1’s indicating void phase (or True) and 0’s indicating the solid phase (or False).
porosity – Calculated as the sum of all 1’s divided by the sum of all 1’s and 0’s.
- Return type
This function assumes void is represented by 1 and solid by 0, and all other values are ignored. This is useful, for example, for images of cylindrical cores, where all voxels outside the core are labelled with 2.
Alternatively, images can be processed with
find_disconnected_voxelsto get an image of only blind pores. This can then be added to the orignal image such that blind pores have a value of 2, thus allowing the calculation of accessible porosity, rather than overall porosity.
Click here to view online example.