Is it possible to create a CIFTI pscalar file directly from a vector of parcelwise FC values (Schaefer 1000) for Workbench visualization?

11 views
Skip to first unread message

Sofia Charef

unread,
Oct 23, 2025, 9:25:35 AM (4 days ago) Oct 23
to HCP-Users
Hi all,

I have a group-level functional connectivity (FC) analysis where I computed the correlation between an anatomical seed and the Schaefer 1000-parcel atlas. My pipeline (Python/nilearn) outputs a NIfTI file where each parcel has a single FC value (i.e., the map is already parcellated, not voxelwise).

I want to visualize these results in Connectome Workbench as a CIFTI pscalar file, using the Schaefer2018_1000Parcels_17Networks_order.dlabel.nii as the parcellation. However, I’m running into several issues:

Workbench’s -cifti-parcellate expects a CIFTI input, not NIfTI.
If I create a dense scalar (dscalar) from my NIfTI and then parcellate, Workbench averages across all voxels in each parcel, which is not what I want (since my map is already parcelwise).
I tried creating a pscalar directly in Python using nibabel and the dlabel header, but get shape mismatch errors (e.g., 1000 vs. 64984).
Mask/affine mismatches between my FC map and brain mask also caused errors in Workbench.
Is it possible to create a CIFTI pscalar file directly from a vector of parcelwise FC values (one value per Schaefer 1000 parcel, already computed in Python), without going through a voxelwise NIfTI or dscalar intermediate? If so, what is the recommended workflow or code to do this, ensuring the output pscalar file has the correct mapping and can be visualized in Workbench?

Any code snippets or step-by-step instructions would be greatly appreciated! Thank you!

Tim Coalson

unread,
Oct 23, 2025, 7:22:37 PM (4 days ago) Oct 23
to hcp-...@humanconnectome.org
You can make a parcellated file containing junk values, and then replace its data with values you have already calculated, look at -cifti-convert , specifically the -from-text option.  You could also load a parcellated cifti file into python with nibabel and do the replacement there, without writing an intermediate text file.

If you have a file where all the vertices or voxels in a parcel have the same value already, then averaging across the parcel should give you the same value, so it isn't clear to me what the issue is there.  dlabel files are dense on their spatial dimension, not parcellated (so you can change the label boundaries with standard data-modification commands, rather than parcellated-specific commands).

The Schaefer dlabel file, judging by its dimensions, is likely vertex-based, not voxel based.  To convert it to a parcel map in python, you'd need to loop through the indices, translate them to vertex and structure, grab their values from the dlabel's data, and create the parcel definitions from those keys - I would recommend running -cifti-parcellate with the dlabel (on itself, if nothing else is handy) to skip the need to write that custom code.

Tim


--
You received this message because you are subscribed to the Google Groups "HCP-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hcp-users+...@humanconnectome.org.
To view this discussion visit https://groups.google.com/a/humanconnectome.org/d/msgid/hcp-users/295bbfbe-b300-4f6b-80f9-5696836a1f11n%40humanconnectome.org.
Reply all
Reply to author
Forward
0 new messages