muscbridge / PyDesigner

A hands-free DTI, DKI, FBI and FBWM preprocessing pipeline. Information on algorithms and preprocessing steps are available at https://www.biorxiv.org/content/10.1101/2021.10.20.465189v1 A video tutorial on PyDesigner and its usage is now available at https://www.youtube.com/watch?v=mChQFuQqX3k
https://pydesigner.readthedocs.io/en/latest/
Other
23 stars 7 forks source link

Float b-values throw error during int(x) conversion #292

Closed j-tseng closed 1 year ago

j-tseng commented 1 year ago

Describe the Issue

Some b-values with scaling are floating point numbers (see discussion here), which subsequently throws an error in mrinfoutil.py at line 399 when converting the string b-value to int.

https://github.com/m-ama/PyDesigner/blob/faa1b7593ff5f79b6cf311de29163e4a3737ed8b/designer/preprocessing/mrinfoutil.py#L399

Issue Reproduction

Relevant error message: ValueError: invalid literal for int() with base 10: '1000.02'

Proposed Solution

My gut suggests changing line 399 to int(round(float(x))) to handle this. If that's an acceptable solution, I'm happy to submit a pull request for it!

P.S. Would love to join the Slack channel, but it bars me as I "don't have an account in this workspace". Are you still open to users joining your Slack? Thanks!

TheJaeger commented 1 year ago

Hey @j-tseng, thanks for catching this bug! Your solution makes sense and you can definitely submit a PR. I'll merge it into the next update.

TheJaeger commented 1 year ago

We are not using Slack anymore since GitHub now has a Discussions tab. I'll remove the link to Slack in the next update.