import numpy as np
from nilearn.datasets import fetch_atlas_schaefer_2018
from neuromaps.parcellate import Parcellater
scale = 'scale100'
schaefer = fetch_atlas_schaefer_2018(n_rois=100)
path = "G:/IDP/37592024/supp/36303070hansen_receptors/hansen_receptors/data/PET_nifti_images/" (my PET path)
receptors_nii = [path+'5HT1a_way_hc36_savli.nii']
parcellated = {}
parcellater = Parcellater(schaefer['maps'], 'MNI152')
for receptor in receptors_nii:
parcellated= parcellater.fit_transform(receptor, 'MNI152', True)
...
However, the error was reported in parcellater.fit_transform step.
"TypeError: expected str, bytes or os.PathLike object, not Nifti1Image".
The "receptor" parameter is a os.PathLike.
Whta's happened? Chould you help me!
Thanks
I'm not sure why the function thinks the pathlike object is a nifti1image but try updating neuromaps to the latest version on github, hopefully that will fix the problem.
Hello, I followed this script.
import numpy as np from nilearn.datasets import fetch_atlas_schaefer_2018 from neuromaps.parcellate import Parcellater scale = 'scale100' schaefer = fetch_atlas_schaefer_2018(n_rois=100) path = "G:/IDP/37592024/supp/36303070hansen_receptors/hansen_receptors/data/PET_nifti_images/" (my PET path) receptors_nii = [path+'5HT1a_way_hc36_savli.nii'] parcellated = {} parcellater = Parcellater(schaefer['maps'], 'MNI152') for receptor in receptors_nii: parcellated= parcellater.fit_transform(receptor, 'MNI152', True) ...
However, the error was reported in parcellater.fit_transform step. "TypeError: expected str, bytes or os.PathLike object, not Nifti1Image". The "receptor" parameter is a os.PathLike. Whta's happened? Chould you help me! Thanks