Nibabel to convert a freesurfer .label file into NIFTI

Hello all - very new to nibabel!

I am trying to convert .label files (created in freesurfer) over to NIFTIs so that we can use them as masks for functional NIFTIs (created in nibabel).

Right now, the dimensions do not match. When I load the .label file into python with nibabel.freesurfer, I see a shape of (1990,). Meanwhile, the functional NIFTIs I want to mask have a shape of (163842,).

I’ve attempted to correct this with mri_label2vol — which takes the .label file and outputs a .nii.gz. Unfortunately the resultant NIFTI has dimensions 100x the size of my functional data.

Is there a way to load a .label file into nibabel and convert it to NIFTI so that it will match the dimensions of my functional data?

Or another means of matching the dimensions of my .label to my functional data?

Thanks so much! Let me know if I can clarify!