hello, i have a dataset in bids format after fmriprep, i wan’t to get individual parcellated time-series according to schaefer 400.
my questions are:
- after i finished, what’s the easiest approach to verify the correctness of the process (making sure the node activity corresponds to the average of the voxels in the nodes region)
- i’m not getting any named labels. only an array of shape (400,TRs). i found on shaefer’s github page some named labels, so i guess the numbers there correspond to the order of the array?
- how do i verify the mm size? in my own data and in the schaefer parcellation map that i download?
my script currently:
from nilearn.input_data import NiftiLabelsMasker
from nibabel import processing
from nilearn.masking import unmask,_apply_mask_fmri
from nilearn import datasets
import matplotlib.pyplot as plt
import os
import nibabel as nib
dataset = datasets.fetch_atlas_schaefer_2018(data_dir=r'D:\users\alex')
atlas_filename = dataset.maps
masker = NiftiLabelsMasker(labels_img=atlas_filename, resampling_target='data', standardize=True)
files_path = r'D:\users\alex\pain\june\original_version_example.nii.gz'
destination = r'D:\users\alex\pain\june\MNI_to_TRs'
b = nib.load(r'D:\users\alex\HCP-1200\one_patient_original_version\rfMRI_REST1_LR.nii.gz')
shape = b.shape
vmap = vox_map(shape=shape, affine=b.affine)
file = 'sub-0005_ses-1_task-fcmri_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz'
img_orig = nib.load(file)
mask = nib.load(file.replace('preproc_bold','brain_mask'))
img_orig = _apply_mask_fmri(img_orig,mask)
img_orig = unmask(img_orig,mask)
time_series = masker.fit_transform(img_orig)
np.save(os.path.join(parcel_path, 'parcellation.npy'), time_series)