apply_chords(im, spacing=1, axis=0, trim_edges=True, label=False)[source]#

Adds chords to the void space in the specified direction.

  • im (ndarray) – An image of the porous material with void marked as True.

  • spacing (int) – Separation between chords. The default is 1 voxel. This can be decreased to 0, meaning that the chords all touch each other, which automatically sets to the label argument to True.

  • axis (int (default = 0)) – The axis along which the chords are drawn.

  • trim_edges (bool (default = True)) – Whether or not to remove chords that touch the edges of the image. These chords are artifically shortened, so skew the chord length distribution.

  • label (bool (default is False)) – If True the chords in the returned image are each given a unique label, such that all voxels lying on the same chord have the same value. This is automatically set to True if spacing is 0, but is False otherwise.


image – A copy of im with non-zero values indicating the chords.

Return type:


See also



Click here to view online example.