Hi there,
I was wondering whether someone could help me with the following question.
I am trying to run the example for the “simple way” of generating individual parcellations.
I am running the code using the enclosed script on our computational linux system.
The error message that I am receiving (see below) seems to be related to lines 182 and 148 in script CBIG_ArealMSHBM_generate_gradient.m. I think this error is resulting from the “space” after sh in the piece code below:
cmd = ['sh ' CBIG_CODE_DIR '/utilities/matlab/speedup_gradients/CBIG_SPGrad_diffusion_embedding.sh '...
Error:
#########################
Construct graph ...
Elapsed time is 0.128935 seconds.
Compute pairwise shortest distance ...
Elapsed time is 7.734629 seconds.
Save as NPY format ...
########## Done!
sh: 0: cannot open /utilities/matlab/speedup_gradients/CBIG_SPGrad_diffusion_embedding.sh: No such file
Error using CBIG_SPGrad_upsample_embed_matrix (line 49)
Cannot find diffusion embedding matrix for left hemisphere
Error in CBIG_ArealMSHBM_generate_gradient (line 185)
CBIG_SPGrad_upsample_embed_matrix(mesh, medial_mask, 100, out_gradient_dir);
Error in CBIG_ArealMSHBM_parcellation_single_subject (line 384)
CBIG_ArealMSHBM_generate_gradient(target_mesh, project_dir, '1' , num2str(num_sess));
Error in test_cbig_cer (line 21)
[lh_labels, rh_labels] = CBIG_ArealMSHBM_parcellation_single_subject(params);
Error in run (line 112)
evalin('caller', strcat(scriptStem, ';'));
Yet, if I remove that space in those two location, I still get an error:
#########################
Construct graph ...
Elapsed time is 0.132370 seconds.
Compute pairwise shortest distance ...
Elapsed time is 7.674953 seconds.
Save as NPY format ...
########## Done!
sh: 0: cannot open /utilities/matlab/speedup_gradients/CBIG_SPGrad_diffusion_embedding.sh/home/lollopasquini/test_cbig2/gradients/sub1: No such file
Error using CBIG_SPGrad_upsample_embed_matrix (line 49)
Cannot find diffusion embedding matrix for left hemisphere
Error in CBIG_ArealMSHBM_generate_gradient (line 185)
CBIG_SPGrad_upsample_embed_matrix(mesh, medial_mask, 100, out_gradient_dir);
Error in CBIG_ArealMSHBM_parcellation_single_subject (line 384)
CBIG_ArealMSHBM_generate_gradient(target_mesh, project_dir, '1' , num2str(num_sess));
Error in test_cbig_cer (line 21)
[lh_labels, rh_labels] = CBIG_ArealMSHBM_parcellation_single_subject(params);
Error in run (line 112)
evalin('caller', strcat(scriptStem, ';'));
Have you ever encountered this? Any advice on how to solve it?
Any advice would be greatly appreciated.
Warmly
Lorenzo
--
You received this message because you are subscribed to the Google Groups "CBIG users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cbig_users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cbig_users/3e62bb40-d938-4ce7-a9b4-202624f70891n%40googlegroups.com.

% read in the fMRI data
tmp = ft_read_cifti('/mnt/isilon/CSC1/Yeolab/Data/HCP/S1200/individuals/100206/MNINonLinear/Results/rfMRI_REST1_LR/postprocessing/MSM_reg_wbsgrayordinatecortex/rfMRI_REST1_LR_Atlas_MSMAll_hp2000_clean_regress.dtseries.nii');
vol = tmp.dtseries;
vol(64985:end,:)=[];
% read in the censor file and exlude the outlier frames
censor_file = '/mnt/isilon/CSC1/Yeolab/Data/HCP/S1200/individuals/100206/MNINonLinear/Results/rfMRI_REST1_LR/postprocessing/MSM_reg_wbsgrayordinatecortex/scripts/rfMRI_REST1_LR_FD0.2_DV75_censoring.txt';
fid = fopen(censor_file, 'r');
mask_index = fscanf(fid,'%d');
vol(:,mask_index == 0) = [];
% find the medial mask, in HCP data, medial wall vertices will have NaN rows
medial_mask = find(isnan(mean(vol,2))==1);
% read in the parcellation
CBIG_CODE_DIR = getenv('CBIG_CODE_DIR');
parcel = ft_read_cifti([CBIG_CODE_DIR '/stable_projects/brain_parcellation/Schaefer2018_LocalGlobal/Parcellations/HCP/fslr32k/cifti/Schaefer2018_400Parcels_17Networks_order.dlabel.nii'],'mapname','array');
labels = parcel.dlabel;
for roi = 1:400
ROIs_series(roi,:) = CBIG_nanmean(vol(labels == roi, :));
end
corr_mat = CBIG_self_corr(ROIs_series');
1.2 Read .dlabel.nii file
The parcellation file is saved as .dlabel.nii file as cifti format. Here, I am using the Schaefer parcellation with 400 parcels as the example.
If you read the parcellation in the same way as the .dtseries.nii file:
CBIG_CODE_DIR = getenv('CBIG_CODE_DIR'); parcel = ft_read_cifti([CBIG_CODE_DIR '/stable_projects/brain_parcellation/Schaefer2018_LocalGlobal/Parcellations/HCP/fslr32k/cifti/Schaefer2018_400Parcels_Kong2022_17Networks_order.dlabel.nii']);
You can only obtain the parcellation labelling in parcel.parcels, which is a 64984 x 1 vector. The medial wall area is denoted as 0. There is no information about the labelnames for the 400 Schaefer parcels. Therefore, you need to pass in extra input arguments:
CBIG_CODE_DIR = getenv('CBIG_CODE_DIR'); parcel = ft_read_cifti([CBIG_CODE_DIR '/stable_projects/brain_parcellation/Schaefer2018_LocalGlobal/Parcellations/HCP/fslr32k/cifti/Schaefer2018_400Parcels_Kong2022_17Networks_order.dlabel.nii'],'mapname','array');
In this way, the parcellation labelling is saved in parcel.dlabel, the parcellation labelnames can be found in parcel.dlabellabel.
Important Note
The Schaefer parcellations in fs_LR_32k has a different medial wall mask as the original fs_LR_32k mesh. This is because the Schaefer parcellations were originally derived using GSP data in fsaverage6 space, and then we project the parellations from fsaverage6 to fs_LR_32k space. Therefore, the medial wall area for Schaefer parcellations in fs_LR_32k are actually the medial wall of fsaverage6 projected to fs_LR_32k.