Hi,
I am working on HCP resting state data, trying to build brain correlation maps with certain parts of the brain. I have been using nilearn’s NiftiSphereMasker following this guide
and while it takes a long time, it would do the job. Now I was trying to make my procedure more structured, so instead of defining ROI coordinates and radius, I pre-built them, saved as Nifti images and loaded into similar script. Instead of NiftiSphereMasker, I tried using NiftiMasker, providing it with my mask
sgACC_masks = {}
for file_name in os.listdir(path):
if file_name.endswith(‘.nii.gz’):
base_name = os.path.splitext(file_name)[0]if base_name.endswith('.nii'): base_name = os.path.splitext(base_name)[0] file_path = os.path.join(path, file_name) nii_img = nib.load(file_path) sgACC_masks[base_name] = nii_img
fig_dir = os.path.join(image_dir,‘seedmaps’)
os.makedirs(fig_dir, exist_ok=True)for name, nii_img in sgACC_masks.items():
seed_masker = NiftiMasker( mask_img=nii_img, standardize='zscore_sample', memory="nilearn_cache", memory_level=4 ) seed_time_series = seed_masker.fit_transform(image)
Image is the functional scan of a subject. nilearn does not raise an issue, however it takes a very long time to fit_transform(), eventually killing the script on the first mask.
Is this not the intended use for NiftiMasker? I tried different memory levels, but the end results is always a crash. ROI itself is of 10 mm radius. Alternatively I could roll back to NiftiSphereMasker…
Thanks!