Due to a change in nibabel 5.2.0 load function, the load_nifti function of neuromaps 0.0.4 no longer catches loading a NiftiImage. Instead the function only works with a filename.
While this is fixed in the package itself (seen on github), the pip version is outdated. Would it be possible to increment the pip version to include this change?
Detailed issue description
File "/dartfs/rc/lab/F/FinnLab/tommy/isc_asynchrony_behavior/code/encoding_models/regression/../../utils/plotting_utils.py", line 347, in vol_to_surf
data_lh, data_rh = mni152_to_fsaverage(ds)
File "/dartfs/rc/lab/F/FinnLab/tommy/conda/envs/asynchrony/lib/python3.9/site-packages/neuromaps/transforms.py", line 208, in mni152_to_fsaverage
return _vol_to_surf(img, 'fsaverage', fsavg_density, method)
File "/dartfs/rc/lab/F/FinnLab/tommy/conda/envs/asynchrony/lib/python3.9/site-packages/neuromaps/transforms.py", line 152, in _vol_to_surf
img = load_nifti(img)
File "/dartfs/rc/lab/F/FinnLab/tommy/conda/envs/asynchrony/lib/python3.9/site-packages/neuromaps/images.py", line 142, in load_nifti
raise err
File "/dartfs/rc/lab/F/FinnLab/tommy/conda/envs/asynchrony/lib/python3.9/site-packages/neuromaps/images.py", line 137, in load_nifti
img = nib.load(img)
File "/dartfs-hpc/rc/home/w/f003rjw/.local/lib/python3.9/site-packages/nibabel/loadsave.py", line 96, in load
filename = _stringify_path(filename)
File "/dartfs-hpc/rc/home/w/f003rjw/.local/lib/python3.9/site-packages/nibabel/filename_parser.py", line 41, in _stringify_path
return pathlib.Path(filepath_or_buffer).expanduser().as_posix()
File "/dartfs/rc/lab/F/FinnLab/tommy/conda/envs/asynchrony/lib/python3.9/pathlib.py", line 1082, in new
self = cls._from_parts(args, init=False)
File "/dartfs/rc/lab/F/FinnLab/tommy/conda/envs/asynchrony/lib/python3.9/pathlib.py", line 707, in _from_parts
drv, root, parts = self._parse_args(args)
File "/dartfs/rc/lab/F/FinnLab/tommy/conda/envs/asynchrony/lib/python3.9/pathlib.py", line 691, in _parse_args
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not Nifti1Image
Issue summary
Due to a change in nibabel 5.2.0 load function, the load_nifti function of neuromaps 0.0.4 no longer catches loading a NiftiImage. Instead the function only works with a filename.
While this is fixed in the package itself (seen on github), the pip version is outdated. Would it be possible to increment the pip version to include this change?
Detailed issue description
File "/dartfs/rc/lab/F/FinnLab/tommy/isc_asynchrony_behavior/code/encoding_models/regression/../../utils/plotting_utils.py", line 347, in vol_to_surf data_lh, data_rh = mni152_to_fsaverage(ds) File "/dartfs/rc/lab/F/FinnLab/tommy/conda/envs/asynchrony/lib/python3.9/site-packages/neuromaps/transforms.py", line 208, in mni152_to_fsaverage return _vol_to_surf(img, 'fsaverage', fsavg_density, method) File "/dartfs/rc/lab/F/FinnLab/tommy/conda/envs/asynchrony/lib/python3.9/site-packages/neuromaps/transforms.py", line 152, in _vol_to_surf img = load_nifti(img) File "/dartfs/rc/lab/F/FinnLab/tommy/conda/envs/asynchrony/lib/python3.9/site-packages/neuromaps/images.py", line 142, in load_nifti raise err File "/dartfs/rc/lab/F/FinnLab/tommy/conda/envs/asynchrony/lib/python3.9/site-packages/neuromaps/images.py", line 137, in load_nifti img = nib.load(img) File "/dartfs-hpc/rc/home/w/f003rjw/.local/lib/python3.9/site-packages/nibabel/loadsave.py", line 96, in load filename = _stringify_path(filename) File "/dartfs-hpc/rc/home/w/f003rjw/.local/lib/python3.9/site-packages/nibabel/filename_parser.py", line 41, in _stringify_path return pathlib.Path(filepath_or_buffer).expanduser().as_posix() File "/dartfs/rc/lab/F/FinnLab/tommy/conda/envs/asynchrony/lib/python3.9/pathlib.py", line 1082, in new self = cls._from_parts(args, init=False) File "/dartfs/rc/lab/F/FinnLab/tommy/conda/envs/asynchrony/lib/python3.9/pathlib.py", line 707, in _from_parts drv, root, parts = self._parse_args(args) File "/dartfs/rc/lab/F/FinnLab/tommy/conda/envs/asynchrony/lib/python3.9/pathlib.py", line 691, in _parse_args a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not Nifti1Image
Steps to reproduce issue
Software version
0.0.4
Code of Conduct
neuromaps
Code of Conduct