run_array

Import in python using from mcutils.scripts.parcel.discretise import run_array

mcutils.scripts.parcel.discretise.run_array(arr, nbins, bins=None, weight=None, include_zeros=False)[source]

Returns a discretised version of the input array

Parameters
  • arr – nibabel input image

  • nbins – number of bins to extract

  • bins

    one of the following

    • None: use weight to set the bins

    • ’number’: each parcel will have the same number of elements

    • ’regular’: split the range from min to max in the input into equal bins

    • 1D array: explicit boundaries

  • weight – selects the bins so each parcel has the same sum in this image (only used if bins is None)

  • include_zeros – if True include zeros in the analysis

Returns

tuple with:

  • array with the parcels (zero where the original array was zero)

  • (nbins + 1, …) array with the applied boundaries