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

DeprecationWarning: get_data() is deprecated in favor of get_fdata() #85

Open
tashrifbillah opened this issue Jan 7, 2025 · 1 comment

Comments

@tashrifbillah
Copy link
Contributor

/software/rocky9/tract_querier/scripts/tract_querier:138: DeprecationWarning: get_data() is deprecated in favor of get_fdata(), which has a more predictable return type. To obtain get_data() behavior going forward, use numpy.asanyarray(img.dataobj).

* deprecated from version: 3.0
* Will raise <class 'nibabel.deprecator.ExpiredDeprecationError'> as of version: 5.0
  img = labels_nii.get_data()
Calculating labels and crossings
/software/rocky9/tract_querier/scripts/tract_querier:173: DeprecationWarning: get_affine method is deprecated.
Please use the ``img.affine`` property instead.

* deprecated from version: 2.1
* Will raise <class 'nibabel.deprecator.ExpiredDeprecationError'> as of version: 4.0
  affine_ijk_2_ras = labels_nii.get_affine()

@demianw , I can do some work on nibabel upgrade if you want. But the primary bottleneck is going to be your use of trackvis. Nibabel 5 no longer supports it: MIC-DKFZ/TractSeg#248 (comment). Do you have any idea to overcome this bottleneck?

Here are where you use trackvis:

tract_querier/tractography/__init__.py:from .trackvis import tractography_from_trackvis_file, tractography_to_trackvis_file
tract_querier/tractography/__init__.py:    'tractography_from_trackvis_file', 'tractography_to_trackvis_file',
tract_querier/tractography/__init__.py:        return tractography_from_trackvis_file(filename)
tract_querier/tractography/__init__.py:        return tractography_to_trackvis_file(filename, tractography, **kwargs)
tract_querier/tractography/tests/test_tractography.py:    tractography_from_trackvis_file, tractography_to_trackvis_file,
tract_querier/tractography/tests/test_tractography.py:    tractography_to_trackvis_file(
tract_querier/tractography/tests/test_tractography.py:    new_tractography = tractography_from_trackvis_file(fname)
tract_querier/tractography/trackvis.py:from nibabel import trackvis
tract_querier/tractography/trackvis.py:def tractography_to_trackvis_file(filename, tractography, affine=None, image_dimensions=None):
tract_querier/tractography/trackvis.py:    trk_header = trackvis.empty_header()
tract_querier/tractography/trackvis.py:    trackvis.aff_to_hdr(affine, trk_header, True, True)
tract_querier/tractography/trackvis.py:        raise ValueError("Image dimensions needed to save a trackvis file")
tract_querier/tractography/trackvis.py:                "Scalar data %s ignored as trackvis "
tract_querier/tractography/trackvis.py:    trackvis.write(filename, trk_tracts, trk_header, points_space='rasmm')
tract_querier/tractography/trackvis.py:def tractography_from_trackvis_file(filename):
tract_querier/tractography/trackvis.py:    tracts_and_data, header = trackvis.read(filename, points_space='rasmm')
@tashrifbillah
Copy link
Contributor Author

I pushed up my deprecation avoiding changes here:
https://github.com/pnlbwh/tract_querier/commits/patch-1/

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

1 participant