netneurolab / neuromaps

A toolbox for comparing brain maps
https://netneurolab.github.io/neuromaps
Other
246 stars 55 forks source link

corr = stats.compare_images(nsynth, genepc) # expected str, bytes or os.PathLike object, not GiftiImage #145

Closed psyzxy closed 8 months ago

psyzxy commented 9 months ago

Description of issue

Hi, I am a new learner in neuromaps.When I conduct the codes in the examples(https://netneurolab.github.io/neuromaps/auto_examples/index.html), everything goes well until the line corr = stats.compare_images(nsynth, genepc) . I got a error, but I don't know where goes wrong. Here is the code.(same as the code in the examples)

%% Fetching atlases and annotations

from neuromaps import datasets

fslr = datasets.fetch_atlas(atlas='fslr', density='32k') print(fslr.keys())

import nibabel as nib lsphere, rsphere = fslr['sphere'] lvert, ltri = nib.load(lsphere).agg_data() print(lvert.shape, ltri.shape)

annotations = datasets.available_annotations() print(f'Available annotations: {len(annotations)}')

volume_annotations = datasets.available_annotations(format='volume') print(f'Available volumetric annotations: {len(volume_annotations)}')

annot = datasets.available_annotations(source='abagen', desc='genepc1', space='fsaverage', den='10k') print(annot)

tags = datasets.available_tags() print(tags)

fmri_annotations = datasets.available_annotations(tags='fMRI') print(fmri_annotations)

abagen = datasets.fetch_annotation(source='abagen', desc='genepc1') print(abagen)

abagen = datasets.fetch_annotation(source='abagen', desc='genepc1', return_single=True) print(abagen)

%% Using spatial null models

from neuromaps import datasets nsynth = datasets.fetch_annotation(source='neurosynth', return_single=True) genepc = datasets.fetch_annotation(desc='genepc1', return_single=True) print('Neurosynth: ', nsynth) print('Gene PC1: ', genepc)

from neuromaps import resampling nsynth, genepc = resampling.resample_images(src=nsynth, trg=genepc, src_space='MNI152', trg_space='fsaverage', resampling='transform_to_alt', alt_spec=('fsaverage', '10k')) print(nsynth, genepc)

from neuromaps import stats corr = stats.compare_images(nsynth, genepc) print(f'Correlation: r = {corr:.02f}')

image image

Code of Conduct

liuzhenqi77 commented 9 months ago

Hi, this should have been fixed in the github main branch. We recommend installing from github to get the latest features and bug fixes. We have also just released a new PyPI version. Could you please update the package and let us know if it works for you? Thanks!

liuzhenqi77 commented 8 months ago

Close due to inactivity. Please feel free to reopen if issue persists.

psyzxy commented 7 months ago

I use "pip install neuromaps" to install neuromaps. When I input "from neuromaps import datasets fslr = datasets.fetch_atlas(atlas='fslr', density='32k') print(fslr.keys())" in Spyder. I got an error AttributeError: module 'neuromaps.datasets' has no attribute 'fetch_atlas'