apply_chords_3D(im, spacing=0, trim_edges=True)[source]

Adds chords to the void space in all three principle directions. The chords are seprated by 1 voxel plus the provided spacing. Chords in the X, Y and Z directions are labelled 1, 2 and 3 resepctively.

  • im (ND-array) – A 3D image of the porous material with void space marked as True.

  • spacing (int (default = 0)) – Chords are automatically separed by 1 voxel on all sides, and this argument increases the separation.

  • trim_edges (bool (default is 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


image – A copy of im with values of 1 indicating x-direction chords, 2 indicating y-direction chords, and 3 indicating z-direction chords.

Return type



The chords are separated by a spacing of at least 1 voxel so that tools that search for connected components, such as scipy.ndimage.label can detect individual chords.

See also



Click here to view online example.