netneurolab / hansen_receptors

Data and code supporting Hansen et al., 2022 "Mapping neurotransmitter systems to the structural and functional organization of the human neocortex"
Other
78 stars 25 forks source link

parcellater.fit_transform in parcellate.py #7

Open Stonlee opened 9 months ago

Stonlee commented 9 months ago

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

justinehansen commented 9 months ago

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.