I have been trying to concatenate two dtseries cifti files, but I can not seem to be able to modify their header so I can save it in another new cifti file. I tried modifying the header manually, but it is not subscriptable.
Here is the code:
img1 = nib.load(“rfMRI_REST1_LR_Atlas_hp2000_clean.dtseries.nii”)
img2 = nib.load(“rfMRI_REST1_RL_Atlas_hp2000_clean.dtseries.nii”)
voxel_data1 = img1.get_fdata()
voxel_data2 = img2.get_fdata()
voxel_data = da.concatenate([voxel_data1, voxel_data2], axis=0)
concat_img = nib.Cifti2Image(voxel_data, header=img1.header)
nib.save(concat_img, “concatenated.dtseries.nii”)