Skip to content

Fix and test code against newer versions of nibabel #470

@mvdoc

Description

@mvdoc

The newer version of nibabel (4.0) introduced some deprecation errors. We need to test our code against this newer version and fix the code that fails.


----> 1 cortex.freesurfer.import_subj("subj01")

File ~/.local/lib/python3.8/site-packages/cortex/freesurfer.py:206, in import_subj(fs_subject, cx_subject, freesurfer_subject_dir, whitematter_surf)
    204         pts, polys, _ = get_surf(fs_subject, hemi, fsname, freesurfer_subject_dir=freesurfer_subject_dir)
    205         fname = str(surfs.format(subj=cx_subject, name=name, hemi=hemi))
--> 206         formats.write_gii(fname, pts=pts + surfmove, polys=polys)
    208 for curv, info in dict(sulc="sulcaldepth", thickness="thickness", curv="curvature").items():
    209     lh, rh = [parse_curv(curvs.format(hemi=hemi, name=curv)) for hemi in ['lh', 'rh']]

File ~/.local/lib/python3.8/site-packages/cortex/formats.pyx:193, in cortex.formats.write_gii()

File ~/.local/lib/python3.8/site-packages/nibabel/deprecator.py:181, in Deprecator.__call__.<locals>.deprecator.<locals>.deprecated_func(*args, **kwargs)
    178 @functools.wraps(func)
    179 def deprecated_func(*args, **kwargs):
    180     if until and self.is_bad_version(until):
--> 181         raise error_class(message)
    182     warnings.warn(message, warn_class, stacklevel=2)
    183     return func(*args, **kwargs)

ExpiredDeprecationError: from_array method is deprecated. Please use GiftiDataArray constructor instead.

* deprecated from version: 2.1
* Raises <class 'nibabel.deprecator.ExpiredDeprecationError'> as of version: 4.0

Originally posted by @mingxue1204 in #469 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions