Fmriprep cifti2 volume,surface combining

Hello all,

I am planning on performing some extra custom cleaning steps on the fmriprep volume outputs and I want to get the final results in cifti-2 format. In order to do that I believe I need to replicate the final cifti making stage of fmriprep at some point after that custom processing is done, so I am trying to wrap my head around it. Now, I might be very mistaken about how this mapping is performed in the pipeline in which case please correct me, but I believe after the FSLR gifti mapping step, fmriprep separates this gifti surface into left and right hemispheres using the left/right “atlasroi_fs_LR” templates and saves the output as cifti surfaces. It also extracts the subcortical voxel time series from the preprocessed bold volumes using the “Atlas_ROIs.2.nii” template. However, I am a little confused about how it combines these two images to create cifti-2 files at the end. I cannot seem to find the workbench tool that does this or any templates showing how these voxels are represented on 91k matrices. I was wondering if anyone could help me grasp this or point me to the fmriprep script where this conversion is performed.

Thanks for all your help