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

BUG: Use the appropriate index to extract b-values #72

Merged
merged 6 commits into from
Jan 28, 2025

Conversation

jhlegarreta
Copy link
Contributor

@jhlegarreta jhlegarreta commented Jan 25, 2025

  • BUG: Use the appropriate index to extract b-values
  • STYLE: Add gradient-related properties to DWI data class
  • STYLE: Make bvecs/bvals serialized shapes match comments/expectations
  • STYLE: Simplify getting the root name for DWI serialization
  • DOC: Mark the insert_b0 parameter as optional
  • ENH: Add decimal places for bval/bvec serialization

@jhlegarreta jhlegarreta force-pushed the FixbvalueExtractionIndex branch from b613d8d to 729ff14 Compare January 25, 2025 21:20
Copy link

codecov bot commented Jan 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.15%. Comparing base (23a1997) to head (138573f).
Report is 27 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #72      +/-   ##
==========================================
+ Coverage   68.75%   69.15%   +0.40%     
==========================================
  Files          20       20              
  Lines         957      963       +6     
  Branches      121      119       -2     
==========================================
+ Hits          658      666       +8     
  Misses        254      254              
+ Partials       45       43       -2     

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

@jhlegarreta jhlegarreta force-pushed the FixbvalueExtractionIndex branch from 729ff14 to edcaf94 Compare January 25, 2025 22:39
@jhlegarreta
Copy link
Contributor Author

A round-trip test is probably missing to prevent issues like the one in 63bdf03. Do not have the bandwidth to do that now.

@jhlegarreta jhlegarreta force-pushed the FixbvalueExtractionIndex branch from f4e401c to 3fd773a Compare January 26, 2025 14:45
@jhlegarreta
Copy link
Contributor Author

jhlegarreta commented Jan 26, 2025

Re: #72 (comment) There is a round-trip test in

assert np.allclose(dwi_h5.gradients, dwi_from_nifti1.gradients)

But there is definitely something not working or missing there that is not being captured, as otherwise the test should have failed due to the bug that this PR addresses. I cannot debug this due to issue #73.

@jhlegarreta
Copy link
Contributor Author

Re #72 (comment): issue #79. Since fixing the issue seems to require a bit of work, including maybe some discussion or clarification as I am not convinced by the insert_b0 option or do not fully understand the rationale of other aspects of the current logic, I would leave fixing #79 for a separate PR.

jhlegarreta and others added 4 commits January 26, 2025 15:54
Use the appropriate index to extract b-values from the gradient data
when serializing b-values.
Add gradient-related properties to DWI data class: add a property to
retrieve the b-vectors and another one to retrieve the b-values.

Co-authored-by: Oscar Esteban <[email protected]>
Simplify getting the root name for DWI serialization: leverage the
`pathlib.Path` methods to remove all suffixes and avoid a two-step
process relying on expected extensions.
@jhlegarreta jhlegarreta force-pushed the FixbvalueExtractionIndex branch from 45ee74c to 25f6f27 Compare January 26, 2025 20:55
Mark the `insert_b0` parameter as optional.
Add decimal places parameter for bval/bvec serialization. Provide some
sensible default values. Change the default precision for b-values from
6 to 2.
@jhlegarreta jhlegarreta force-pushed the FixbvalueExtractionIndex branch from e374a27 to 138573f Compare January 27, 2025 23:38
@jhlegarreta jhlegarreta merged commit 237a9cb into nipreps:main Jan 28, 2025
14 checks passed
@jhlegarreta jhlegarreta deleted the FixbvalueExtractionIndex branch January 28, 2025 13:49
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