porosimetry(im, sizes=25, inlets=None, access_limited=True, mode='hybrid', divs=1)[source]

Performs a porosimetry simulution on an image.

  • im (ND-array) – An ND image of the porous material containing True values in the pore space.

  • sizes (array_like or scalar) – The sizes to invade. If a list of values of provided they are used directly. If a scalar is provided then that number of points spanning the min and max of the distance transform are used.

  • inlets (ND-array, boolean) – A boolean mask with True values indicating where the invasion enters the image. By default all faces are considered inlets, akin to a mercury porosimetry experiment. Users can also apply solid boundaries to their image externally before passing it in, allowing for complex inlets like circular openings, etc. This argument is only used if access_limited is True.

  • access_limited (bool) – This flag indicates if the intrusion should only occur from the surfaces (access_limited is True, which is the default), or if the invading phase should be allowed to appear in the core of the image. The former simulates experimental tools like mercury intrusion porosimetry, while the latter is useful for comparison to gauge the extent of shielding effects in the sample.

  • mode (str) –

    Controls with method is used to compute the result. Options are:


    (default) Performs a distance tranform of the void space, thresholds to find voxels larger than sizes[i], trims the resulting mask if access_limitations is True, then dilates it using the efficient fft-method to obtain the non-wetting fluid configuration.


    Same as ‘hybrid’, except uses a second distance transform, relative to the thresholded mask, to find the invading fluid configuration. The choice of ‘dt’ or ‘hybrid’ depends on speed, which is system and installation specific.


    Uses bindary erosion followed by dilation to obtain the invading fluid confirguration directly. If access_limitations is True then disconnected blobs are trimmmed before the dilation. This is the only method that can be parallelized by chunking (see divs and cores).

  • divs (int or array_like) – The number of times to divide the image for parallel processing. If 1 then parallel processing does not occur. 2 is equivalent to [2, 2, 2] for a 3D image. The number of cores used is specified in porespy.settings.ncores and defaults to all cores.


image – A copy of im with voxel values indicating the sphere radius at which it becomes accessible from the inlets. This image can be used to find invading fluid configurations as a function of applied capillary pressure by applying a boolean comparison: inv_phase = im > r where r is the radius (in voxels) of the invading sphere. Of course, r can be converted to capillary pressure using a preferred model.

Return type



There are many ways to perform this filter, and PoreSpy offers 3, which users can choose between via the mode argument. These methods all work in a similar way by finding which foreground voxels can accomodate a sphere of a given radius, then repeating for smaller radii.

See also



Click here to view online example.