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

ENH: Fix nibabel image type checking errors #44

Merged

Conversation

jhlegarreta
Copy link
Contributor

@jhlegarreta jhlegarreta commented Dec 23, 2024

Fix nibabel image type checking errors: add a load_api utils function to provide the appropriate type when loading a NiBabel N-dimensional image.

Solution drawn from:
nipreps/nireports@44d0ff6

Fixes:

scripts/dwi_gp_estimation_signal_plot.py:113: error:
 "FileBasedImage" has no attribute "get_fdata"  [attr-defined]
scripts/dwi_gp_estimation_signal_plot.py:114: error:
 "FileBasedImage" has no attribute "get_fdata"  [attr-defined]

and

scripts/optimize_registration.py:173: error:
 Argument 1 to "displacements_within_mask" has incompatible type "FileBasedImage"; expected "SpatialImage"  [arg-type]

raised for example in:
https://github.com/nipreps/nifreeze/actions/runs/12437972140/job/34728973936#step:8:63 and
https://github.com/nipreps/nifreeze/actions/runs/12437972140/job/34728973936#step:8:142

Rename the previously existing utils.py file to iterators.py and move it to the newly created utils module to avoid package name clashes. Change the related import statements accordingly.

@jhlegarreta jhlegarreta force-pushed the FixNiBabelLoadTypeCheckingErrors branch 3 times, most recently from 9e4a6d9 to 29376ed Compare December 23, 2024 15:37
Copy link

codecov bot commented Dec 23, 2024

Codecov Report

Attention: Patch coverage is 63.63636% with 4 lines in your changes missing coverage. Please review.

Project coverage is 65.74%. Comparing base (6b6ba70) to head (e0a3350).

Files with missing lines Patch % Lines
src/nifreeze/utils/ndimage.py 55.55% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #44      +/-   ##
==========================================
- Coverage   65.84%   65.74%   -0.10%     
==========================================
  Files          18       19       +1     
  Lines         931      940       +9     
  Branches      119      120       +1     
==========================================
+ Hits          613      618       +5     
- Misses        274      278       +4     
  Partials       44       44              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jhlegarreta jhlegarreta force-pushed the FixNiBabelLoadTypeCheckingErrors branch 2 times, most recently from af97c26 to e0a3350 Compare December 23, 2024 18:29
Fix `nibabel` image type checking errors: add a `load_api` utils
function to provide the appropriate type when loading a `NiBabel`
N-dimensional image.

Solution drawn from:
nipreps/nireports@44d0ff6

Fixes:
```
scripts/dwi_gp_estimation_signal_plot.py:113: error:
 "FileBasedImage" has no attribute "get_fdata"  [attr-defined]
scripts/dwi_gp_estimation_signal_plot.py:114: error:
 "FileBasedImage" has no attribute "get_fdata"  [attr-defined]
```

and
```
scripts/optimize_registration.py:173: error:
 Argument 1 to "displacements_within_mask" has incompatible type "FileBasedImage"; expected "SpatialImage"  [arg-type]
```

raised for example in:
https://github.com/nipreps/nifreeze/actions/runs/12437972140/job/34728973936#step:8:63
and
https://github.com/nipreps/nifreeze/actions/runs/12437972140/job/34728973936#step:8:142

Rename the previously existing `utils.py` file to `iterators.py` and
move it to the newly created `utils` module to avoid package name
clashes. Change the related import statements accordingly.
@effigies effigies force-pushed the FixNiBabelLoadTypeCheckingErrors branch from e0a3350 to adb9329 Compare January 8, 2025 16:08
@effigies effigies merged commit 1ec3e8c into nipreps:main Jan 8, 2025
6 checks passed
@jhlegarreta jhlegarreta deleted the FixNiBabelLoadTypeCheckingErrors branch January 8, 2025 23:57
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.

2 participants