visualization

Create Basic Views

This module contains functions for quickly visualizing 3D images in 2D views.

porespy.visualization.sem(im[, direction]) Simulates an SEM photograph looking into the porous material in the specified direction.
porespy.visualization.xray(im[, direction]) Simulates an X-ray radiograph looking through the porouls material in the specfied direction.
porespy.visualization.set_mpl_style()
porespy.visualization.show_mesh(mesh) Visualizes the mesh of a region as obtained by get_mesh function in the metrics submodule.
porespy.visualization.sem(im, direction='X')[source]

Simulates an SEM photograph looking into the porous material in the specified direction. Features are colored according to their depth into the image, so darker features are further away.

Parameters:
  • im (array_like) – ND-image of the porous material with the solid phase marked as 1 or True
  • direction (string) – Specify the axis along which the camera will point. Options are ‘X’, ‘Y’, and ‘Z’.
Returns:

image – A 2D greyscale image suitable for use in matplotlib’s `imshow` function.

Return type:

2D-array

porespy.visualization.xray(im, direction='X')[source]

Simulates an X-ray radiograph looking through the porouls material in the specfied direction. The resulting image is colored according to the amount of attenuation an X-ray would experience, so regions with more solid will appear darker.

Parameters:
  • im (array_like) – ND-image of the porous material with the solid phase marked as 1 or True
  • direction (string) – Specify the axis along which the camera will point. Options are ‘X’, ‘Y’, and ‘Z’.
Returns:

image – A 2D greyscale image suitable for use in matplotlib’s `imshow` function.

Return type:

2D-array

porespy.visualization.set_mpl_style()[source]
porespy.visualization.show_mesh(mesh)[source]

Visualizes the mesh of a region as obtained by get_mesh function in the metrics submodule.

Parameters:mesh (tuple) – A mesh returned by skimage.measure.marching_cubes
Returns:fig – A handle to a matplotlib 3D axis
Return type:Matplotlib figure