feat: Add body-part aware initial guesses for IVIM fitting (Feature #87)#149
Open
Devguru-codes wants to merge 1 commit intoOSIPI:mainfrom
Open
feat: Add body-part aware initial guesses for IVIM fitting (Feature #87)#149Devguru-codes wants to merge 1 commit intoOSIPI:mainfrom
Devguru-codes wants to merge 1 commit intoOSIPI:mainfrom
Conversation
…SIPI#87) Add literature-sourced default initial guesses, bounds, and thresholds for 8 anatomical regions: brain, liver, kidney, prostate, pancreas, head_and_neck, breast, placenta. New files: - src/wrappers/ivim_body_part_defaults.py: lookup table module with get_body_part_defaults() and get_available_body_parts() - tests/IVIMmodels/unit_tests/test_body_part_defaults.py: 22 unit tests Modified files: - src/wrappers/OsipiBase.py: add body_part parameter to __init__(), support initial_guess as string (e.g. initial_guess='liver') API usage: OsipiBase(algorithm='X', bvalues=b, body_part='liver') OsipiBase(algorithm='X', bvalues=b, initial_guess='brain') 100% backward compatible: body_part=None uses original generic defaults. User-provided bounds/initial_guess always take priority. No regressions: 1127 passed, 167 skipped, 22 xfailed, 6 xpassed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello @etpeterson - I saw no updates were made on this issue so I worked on it. If there is need of improvement, comment it and i will update this pr.
Description
Closes #87. Adds organ-specific initial guesses, bounds, and thresholds for IVIM fitting, sourced from peer-reviewed literature. This enables faster convergence, reduced local minima, and more physiologically plausible results when scanning specific body parts.
Problem
The current generic defaults (
f=0.1, D=0.001, Dp=0.01) are reasonable for the brain but significantly off for other organs:Solution: Literature-Sourced Lookup Table
Each body part also includes organ-specific bounds (tighter than the generic ones) to constrain the optimizer to physiologically plausible regions.
Justification for chosen values:
Changes Made
src/wrappers/ivim_body_part_defaults.pyget_body_part_defaults(),get_available_body_parts()src/wrappers/OsipiBase.pybody_partparam to__init__(), supportinitial_guessas stringtests/.../test_body_part_defaults.pyAPI Usage
Testing
body_part="liver"produced near-perfect results:Known Issue (Pre-existing, Not Introduced by This PR)
When using
body_part=together withalgorithm="IAR_LU_biexp", theIAR_LU_biexpalgorithm's internalset_bounds()crashes withKeyError: 0because it expects bounds as list-of-lists (bounds[0],bounds[1]) but receives dict-format bounds. This is the same bug onmainthat is already documented in Issue #86 and fixed in PR #142 — it reproduces identically withbody_part=None(generic defaults). Once PR #142 is merged, this will work seamlessly.Backward Compatibility
body_part=None(default) → identical to current behaviorinitial_guess=dict→ identical to current behaviorbounds/initial_guessalways override body-part defaultsChecklist
tests/IVIMmodels/unit_tests/test_body_part_defaults.pynumpy,scipyalready required)