Hi Everyone,
If I just want to get the functional connectivity matrix of a patient (fMRI) (according to Pearson correlation coefficient), how should I use ConnectivityMeasure?

atlas = datasets.fetch_atlas_aal(version='SPM12')
atlas_filename = atlas.maps
# Loading atlas data stored in 'labels'
labels = atlas.labels

data = image.load_img("./Filtered_4DVolume.nii")
masker = NiftiLabelsMasker(labels_img=atlas_filename, standardize=True,
                         memory='nilearn_cache', verbose=5)

time_series = masker.fit_transform(data)
correlation_measure = ConnectivityMeasure(kind='correlation')
correlation_matrix = correlation_measure.fit_transform([time_series])[0]

Thank you for your time and any help is greatly appreciated!

What you do here LGTM. What do you need beyond the above script ?

Note: You may want to preprocess the signal (detredning, band-pass filtering when calling the NiftiLabelsMasker).



1 Like