Closed rob-mccutcheon closed 4 years ago
pls pull for latest docker image
Thank you, that works! Could I also please ask a question about the connectivity matrices generate by FCON - for e.g. Desikan-Killany are these calculated in surface space or is it from a version of the atlas that has been sampled into volumetric space?
all in volume space
Thank you again.
One more freesurfer related question: I now have 'sub-XXXresidual{r/l}h.func.gii' in the 'regress' folder. These images are in fsaverage space.
Thanks
Rob
Yes you are right, the current fmriprep do not write out fsaverage5 surfaces, you can check freesurfer directory of one the fmriprep output. if you want to change cifti files to fsaverage5 or 6, you can use mri_surf2surf
Edited comment as issue was secondary to my bug, not xcp
thanks again!
Dear @a3sha2
Sorry, the issues does in fact seem to still be here
In the regress folder are 'subid-residual_{l/r}h.func.gii' the surface equivalents of 'subid-residualised.nii.gz'?
I ask because I have extracted the time series from the surface files and the connectivity matrixes generated from these look as though they may not have been denoised, as almost no negatively weighted connections (in contract to the matrices in the fcon folder which I believe have been generated from subid-residualised.nii.gz)
Thank you again!
how man nodes or vertices do you have? you might have flip the matrix of time series
I'm using the gordon atlas so 333 nodes (and I have 165 timepoints), I thought it was that initially but the connectivity matrix I get using the below approach is 333*333 so I don't think it is
def gordon_surface_conn(sub_id, denoised_path):
''' Returns a Gordon connectivity matrix from a
XCP denoised file in surface space '''
atlas_l_path = f'/home/k1201869/glu_rs/data/atlas_data/gordon/Parcels_L_164.func.gii'
atlas_r_path = f'/home/k1201869/glu_rs/data/atlas_data/gordon/Parcels_R_164.func.gii'
surf_image_l_path = f'{denoised_path}/sub-{sub_id}/regress/sub-{sub_id}_residual_lh.func.gii'
surf_image_r_path = f'{denoised_path}/sub-{sub_id}/regress/sub-{sub_id}_residual_rh.func.gii'
surf_image_l = surface.load_surf_data(surf_image_l_path)
atlas_image_l = surface.load_surf_data(atlas_l_path)
surf_image_r = surface.load_surf_data(surf_image_r_path)
atlas_image_r = surface.load_surf_data(atlas_r_path)
l_roi_timecourses = []
# We don't include the first roi as this is background
for i in np.unique(atlas_image_l)[1:]:
roi_idxs = np.where(atlas_image_l==i)
l_roi_timecourses.append(np.mean(surf_image_l[roi_idxs], axis=0))
r_roi_timecourses = []
# We don't include the first roi as this is background
for i in np.unique(atlas_image_r)[1:]:
roi_idxs = np.where(atlas_image_r==i)
r_roi_timecourses.append(np.mean(surf_image_r[roi_idxs], axis=0))
bilat_timecourses = np.array(l_roi_timecourses + r_roi_timecourses)
correlation_measure = ConnectivityMeasure(kind='correlation')
connectivity_matrix = correlation_measure.fit_transform([bilat_timecourses.T])[0]
return connectivity_matrix
@robmcc10 I expect the connectivity matrix to be the same as volume. what is space of the gordon parcel you are using? remember _residual_rh.func.gii is in fsaverage ( not fsaverage5).
The gordon parcellation is in the same space as _residual_rh.func.gii (163842 vertices), but the connectivity matrices are very different between surface and volume (the surface based one has almost no negative edges)
pls can you share your Parcels_L_164.func.gii
and Parcels_R_164.func.gii
They are the parcels available at https://sites.wustl.edu/petersenschlaggarlab/resources/
Thanks for looking into this
sorry for late response. The issue is in your python code, the last line.
remove the transform here connectivity_matrix = correlation_measure.fit_transform([bilat_timecourses.T])[0]
by change it to connectivity_matrix = correlation_measure.fit_transform([bilat_timecourses])[0]
.
after that you can compare your result with just simple connectivity_matrix =np.corrcoef(bilat_timecourses)
I'm not sure this is ii as the timecourses matrix needs to be transposed otherwise one gets a matrix that is number_time_points number_timepoints as opposed number_nodes number_nodes.
np.corrcoef(bilat_timecourses)
gives an almost identical result to correlation_measure.fit_transform([bilat_timecourses.T])[0]
Both still have this same issue of having way fewer negative edges (and a generally very different network structure) to the connectivity matrices calculated from the volumes
Edit: It seems the issue is that when loading the parcellation the rois are getting broken up and assigned to the wrong vertices, i.e. not an xcp engine issue. Will post here once I've fixed it in case anyone comes across same problem
The issue was not xcp related but a lack of correspondence between freesurfer and hcp vertices, sorry for any confusion! To map the gordon atlas from hcp to freesurfer space do the following (instructions below for right hemisphere):
R.sphere.32k_fs_LR.surf.gii
fromand R-to-fs_LR_fsaverage.R_LR.spherical_std.164k_fs_R.surf.gii
from
Run:
wb_command -label-resample Parcels_R.func.gii R.sphere.32k_fs_LR.surf.gii fs_R-to-fs_LR_fsaverage.R_LR.spherical_std.164k_fs_R.surf.gii BARYCENTRIC right.fsaverage164.label.gii
Describe the bug I have ran the singularity of xcp engine 1.0 successfully. I wanted to get CIFTI outputs so have reran using version 1.2.1. However, I do not get any CIFTI outputs, and furthermore the files in my fcon folder all have zero bytes.
I have been using fmriprep version 20.0.5, and the cifti filename is sub-A00008965_task-rest_space-fsLR_den-91k_bold.dtseries.nii. Should I put the cifti path in my cohort file?
Many thanks,
Rob
Cohort file Paste cohort file between the triple backticks
Design File Paste your entire design (
.dsn
) file between the triple backticksError message Paste your error message between the backticks
Runtime Information Singularity
$ -m n
$ -N xcp
$ -o /home/k1201869/glu_rs/src/logs/xcp_o$TASK_ID
$ -e /home/k1201869/glu_rs/src/logs/xcp_e$TASK_ID
module load singularity
set SIMG='/home/k1201869/singularity_images/xcpEngine122.simg' set TEMP_COHORT='/home/k1201869/glu_rs/src/brain_gluschi/preprocessing/temp/tempcohort$SGE_TASK_ID.csv'
singularity run -B /home/k1201869/glu_rs:${HOME}/data_bind\ ${HOME}/singularity_images/xcpEngine122.simg\ -c ${TEMP_COHORT} \ -d ${HOME}/data_bind/src/brain_glu_schi/preprocessing/fc-36p_despike.dsn \ -r ${HOME}/data_bind/data/braingluschi/BIDS_data/ \ -o ${HOME}/data_bind/data/braingluschi/denoised/36pdespike122/ \
Additional context