OHBA-analysis / MEG-ROI-nets

Stationary network analysis for MEG
12 stars 10 forks source link

Resampling the AAL atlas #3

Closed delshadv closed 5 years ago

delshadv commented 5 years ago

@jhadida Thanks for your solution according to "Resampling the AAL atlas" but there are two problems:

The AAL atlas is NOT available within the OSL package (Parcellation Folder) or OSL github: AAL = nii.load(fullfile( osldir, 'parcellations', 'ft_AAL.nii.gz' ));

and when I try other AAL.nii.gz on net, with the spatialBasisSet option like below

Settings.spatialBasisSet = rois; %rois is output of your solution in Various Questions #2 ...

I get this error: Error using ROInets.run_individual_network_analysis (line 367) Number of voxels in data and ROI basis set do not match. I was wondering if you could help me on completing this issue.

PS- I just used "ROI_MNI_V4.nii" and "AAL.nii" in http://www.gin.cnrs.fr/en/tools/aal-aal2/ used by Fieldtrip and SPM wikis.

Thanks, Delshad

jhadida commented 5 years ago

@delshadv Apologies about the confusion with the AAL atlas; I must have put it in that folder myself, or perhaps it was removed from the newest version of OSL (@woolrich ?).

For future reference, the code I suggested for resampling the AAL atlas to the same resolution as the MEG source-reconstructed data is:

% load MNI mask at desired resolution (use 6mm if needed)
mask = nii.load(fullfile( osldir, 'std_masks', 'MNI152_T1_8mm_brain.nii.gz' ));
mask = logical(mask);

% resample the AAL atlas, using option 'nearest' to ensure integer values
AAL_sub = imresize3( AAL, size(mask), 'nearest' );

% make sure we didn't lose any label
assert( numel(unique(AAL_sub)) == numel(unique(AAL)), 'Labels were lost during resampling :(' );

% extract atlas voxels within the target brain mask
atlas = AAL_sub(mask);

% convert label volume to a matrix of logical ROIs
label = nonzeros(unique(atlas));
nvox = nnz(mask);
nroi = numel(label);
rois = false(nvox, nroi);

for i = 1:nroi
    rois(:,i) = atlas == label(i);
end

With regards to the issue you mentioned above, could you please confirm that your MEG data has been source-reconstructed into MNI 8mm space? If so, your MEEG object should have 3559 rows, and this should also correspond to the number of rows in the roi matrix. Let me know how this goes.

delshadv commented 5 years ago

@jhadida Yes, my MEG data have 3559 channels. I found my mistake, thanks to your above comment, I just found that I used 6 mm mask during creation rois matrix. now it is fixed but the problem is still remained by this error:

Error using ROInets.symmetric_orthogonalise (line 99) The ROI time-course matrix is not full rank. This prevents you from using an all-to-all orthogonalisation method. Your data have rank 114, and you are looking at 115 ROIs. You could try reducing the number of ROIs, or using an alternative orthogonalisation method.

What's your solution?

Best Regards, Delshad

jhadida commented 5 years ago

@delshadv Great that you were able to fix the issue with the MNI mask 👍

The issue you are now facing relates to earlier warnings from @GilesColclough; the atlas has too many regions given the linear rank of the underlying data. The reason that the data has "low" rank in the first place (keeping in mind that 100+ dimensions is not actually that low!) is due to the ill-posedness of source-reconstruction in MEG. Basically: we are trying to estimate 3k+ signals (one for each voxel) from the correlated measurements of only ~250 sensors, and as the error message says, this gives us only 114 linearly independent signals to work with --- but the AAL parcellation assumes the existence of 115 independent regions. :man_facepalming:

There are essentially two ways forwards:

delshadv commented 5 years ago

@jhadida Thanks Jonathan for your interesting solution, yes I have to use AAL for some comparisons. It works well!

Best Regards, Delshad