Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parcellater.fit_transform in parcellate.py #7

Open
Stonlee opened this issue Jan 29, 2024 · 2 comments
Open

parcellater.fit_transform in parcellate.py #7

Stonlee opened this issue Jan 29, 2024 · 2 comments

Comments

@Stonlee
Copy link

Stonlee commented Jan 29, 2024

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
Copy link
Contributor

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.

@gsteward-lab
Copy link

Hello,

I'm having a similar problem. For what it's worth, here's the traceback for the error I'm getting. It seems that the resample_images function does not like the 'data' variable. My guess is that the file was loaded as an image and passed somewhere it wasn't supposed to be or there is some conflicting environment configuration that is loading something incorrectly. However, I can't figure out where this would be.

I'm attaching both the traceback for my code when I try to run parcellator.fit_transform function as well as the environment files I'm using. One is the true environment and the other is the environment history for the packages I actually pulled to download. I'd be happy to hear if you had any suggestions.

parcellate_traceback.txt
environment.txt
environment_history.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants