extract_cylinder(im, r=None, axis=0)[source]#

Returns a cylindrical section of the image of specified radius.

This is useful for making square images look like cylindrical cores such as those obtained from X-ray tomography.

  • im (ndarray) – The image of the porous material. Can be any data type.

  • r (scalr) – The radius of the cylinder to extract. If None is given then the default is the largest cylinder that can fit inside the specified plane.

  • axis (scalar) – The axis along with the cylinder will be oriented.


image – A copy of im with values outside the cylindrical area set to 0 or False.

Return type:



Click here to view online example.