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

fix nibabel get_data deprecation #28

Merged
merged 1 commit into from Mar 7, 2023
Merged

fix nibabel get_data deprecation #28

merged 1 commit into from Mar 7, 2023

Conversation

xgui3783
Copy link
Collaborator

@xgui3783 xgui3783 commented Mar 6, 2023

per https://nipy.org/nibabel/reference/nibabel.dataobj_images.html#nibabel.dataobj_images.DataobjImage.get_data nibabel.get_data will raise Exception as of >=5.0

Per suggestion, this PR now uses numpy.asanyarray(img.dataobj)

another option is img.get_fdata(img.header.get_data_dtype())

@codecov
Copy link

codecov bot commented Mar 6, 2023

Codecov Report

Merging #28 (4fd3f02) into master (b1baf42) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master      #28   +/-   ##
=======================================
  Coverage   92.45%   92.45%           
=======================================
  Files          25       25           
  Lines        1485     1485           
  Branches      219      219           
=======================================
  Hits         1373     1373           
  Misses         63       63           
  Partials       49       49           
Impacted Files Coverage Δ
src/neuroglancer_scripts/volume_reader.py 82.69% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@xgui3783
Copy link
Collaborator Author

xgui3783 commented Mar 6, 2023

probably supercedes #27

@xgui3783
Copy link
Collaborator Author

xgui3783 commented Mar 7, 2023

@ylep can you take a look at this PR, but also a number of other possible fixes (#27) or using img.get_fdata(img.header.get_data_dtype()) instead of numpy.asanyarray(img.dataobj) (this PR) ?

@ylep ylep self-requested a review March 7, 2023 09:25
Copy link
Collaborator

@ylep ylep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that this is actually the correct replacement. Using get_fdata here would be incorrect, because we are handling the scaling in neuroglancer-scripts instead of having it applied by nibabel.

@ylep ylep merged commit 466da5d into master Mar 7, 2023
@ylep ylep deleted the fix_nibabelDep branch March 7, 2023 09:43
@blowekamp
Copy link
Contributor

Thank you for a proper fix.

Any idea when the next published release will occur?

@xgui3783
Copy link
Collaborator Author

xgui3783 commented Mar 7, 2023

Thank you for a proper fix.

Any idea when the next published release will occur?

already happened, I think: https://pypi.org/project/neuroglancer-scripts/#history

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

Successfully merging this pull request may close these issues.

None yet

3 participants