nispace.utils.utils.parc_vect_to_vol

nispace.utils.utils.parc_vect_to_vol(vect, parc)[source]

Convert a per-parcel value vector into a full volumetric NIfTI image.

Thin nilearn/nibabel wrapper around vect_to_vol_arr(): loads parc, determines its (nonzero, sorted) parcel labels, broadcasts vect back onto the voxel grid, and returns a proper Nifti1Image. Unlike most functions in this module, this one is a real end-user-facing utility (used directly in docs/nb_examples/drug_challenge.ipynb), not just an internal helper.

Parameters:
  • vect (array-like) – 1D per-parcel values, length must match the number of nonzero labels in parc.

  • parc (image-like) – Parcellation image, loaded via nilearn.image.load_img.

Returns:

Volume with each parcel’s voxels set to its value from vect.

Return type:

nibabel.Nifti1Image

Raises:

ValueError – If vect is not 1D or list-like.