-
Notifications
You must be signed in to change notification settings - Fork 258
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
NF: Pass dtype to Analyze-like images at initialization/serialization, warn on creation of NIfTI images with 64-bit ints (API change) #1082
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1082 +/- ##
==========================================
+ Coverage 92.29% 92.30% +0.01%
==========================================
Files 100 100
Lines 12247 12269 +22
Branches 2393 2399 +6
==========================================
+ Hits 11303 11325 +22
Misses 621 621
Partials 323 323
Continue to review full report at Codecov.
|
I think the logic is right - that the |
Thinking further about the future import - I think we'll have to make that a module global in fact, as in:
|
Hello @effigies, Thank you for updating! Cheers! There are no style issues detected in this Pull Request. 🍻 To test for issues locally, Comment last updated at 2022-03-29 14:43:35 UTC |
de5d4bd
to
81ed771
Compare
81ed771
to
504ced6
Compare
Dropped the |
504ced6
to
1b4aafc
Compare
3ff7421
to
9311297
Compare
This is ready for review. This PR aims to establish the API and semantics for explicit dtypes. I have not complicated this PR by trying to add in keywords like "compat" or "mask"; I think that will be cleaner as a separate PR that builds on what we end up with here. |
I don't know nibabel well enough to do an actual review but this seems to be in line with what was decided during the nilearn office hours. |
@jeromedockes Sorry, yes, in pinging you, I mostly meant "Does this API work for nilearn's purposes?" |
No problem, on the contrary thanks for pinging me! yes I do think that API will work for nilearn. We haven't really made progress because the nilearn developers team is at a somewhat reduced capacity at the moment but we should get to it soon. if you do open the follow-up PR adding some keywords please ping us there too as we might take advantage of these as well. |
@matthew-brett Could I bug you for a review? |
9311297
to
57baaa6
Compare
57baaa6
to
fa66516
Compare
@matthew-brett Any chance of a review? I think this one should be relatively straightforward while #1082 will take more careful thought. |
Going to merge. Can fix up later if something is found. Realizing we didn't get CIFTI fully supported on the creation side, but that's turning out to be complicated enough to be worth its own PR. |
No test yet, but a quick prototype based on the discussion in #1046.
I'm not sure what people's intuition about the behavior of a
dtype
parameter should be. What I've done for now is just toset_data_dtype()
so that the array is untouched but will be coerced at write time. However, I could see an argument that the expectation is that the array would be immediately cast so that the result ofnp.asanyarray(img.dataobj)
will have the dtype passed to the image.Additionally, this currently assumes that passing a header is as good as passing a dtype, but this is going to have the problem that passing the header of a 64-bit image will succeed silently.
I have not made any attempt to implement a
from nibabel.__future__ import int64_error
at this point. Figured I'd get some code out and argue out the semantics before refining.