-
Notifications
You must be signed in to change notification settings - Fork 46
feat: Add body-part aware initial guesses for IVIM fitting (Feature #87) #149
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
Open
Devguru-codes
wants to merge
3
commits into
OSIPI:main
Choose a base branch
from
Devguru-codes:feature-body-part-initial-guesses
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,147 @@ | ||
| """ | ||
| Body-part specific IVIM parameter defaults. | ||
|
|
||
| Literature-based initial guesses, bounds, and thresholds for | ||
| different anatomical regions. Used by OsipiBase when the user | ||
| specifies a body_part parameter. | ||
|
|
||
| References: | ||
| Brain: Federau 2017 (DOI: 10.1002/nbm.3780) | ||
| Liver: Dyvorne 2013 (DOI: 10.1016/j.ejrad.2013.03.003), | ||
|
Devguru-codes marked this conversation as resolved.
Outdated
|
||
| Guiu 2012 (DOI: 10.1002/jmri.23762) | ||
|
Devguru-codes marked this conversation as resolved.
Outdated
|
||
| Kidney: Li 2017 (DOI: 10.1002/jmri.25571), | ||
|
Devguru-codes marked this conversation as resolved.
Outdated
|
||
| Ljimani 2020 (DOI: 10.1007/s10334-019-00802-0) | ||
|
Devguru-codes marked this conversation as resolved.
Outdated
|
||
| Prostate: Kuru 2014 (DOI: 10.1007/s00330-014-3165-y) | ||
|
Devguru-codes marked this conversation as resolved.
Outdated
|
||
| Pancreas: Barbieri 2020 (DOI: 10.1002/mrm.27910) | ||
| Head/Neck: Sumi 2012 (DOI: 10.1259/dmfr/15696758) | ||
|
Devguru-codes marked this conversation as resolved.
Outdated
|
||
| Breast: Lee 2018 (DOI: 10.1097/RCT.0000000000000661) | ||
|
Devguru-codes marked this conversation as resolved.
Outdated
|
||
| Placenta: Zhu 2023 (DOI: 10.1002/jmri.28858) | ||
|
Devguru-codes marked this conversation as resolved.
Outdated
|
||
| """ | ||
|
|
||
| IVIM_BODY_PART_DEFAULTS = { | ||
| "brain": { | ||
| "initial_guess": {"S0": 1.0, "f": 0.05, "Dp": 0.01, "D": 0.0008}, | ||
|
Devguru-codes marked this conversation as resolved.
Outdated
|
||
| "bounds": { | ||
|
Devguru-codes marked this conversation as resolved.
Outdated
|
||
| "S0": [0.7, 1.3], | ||
| "f": [0.0, 0.15], | ||
| "Dp": [0.005, 0.05], | ||
| "D": [0.0003, 0.002], | ||
| }, | ||
| "thresholds": [200], | ||
|
Devguru-codes marked this conversation as resolved.
|
||
| }, | ||
| "liver": { | ||
| "initial_guess": {"S0": 1.0, "f": 0.12, "Dp": 0.06, "D": 0.001}, | ||
| "bounds": { | ||
| "S0": [0.7, 1.3], | ||
|
Devguru-codes marked this conversation as resolved.
Outdated
|
||
| "f": [0.0, 0.40], | ||
|
Devguru-codes marked this conversation as resolved.
Outdated
|
||
| "Dp": [0.01, 0.15], | ||
| "D": [0.0003, 0.003], | ||
| }, | ||
| "thresholds": [200], | ||
| }, | ||
| "kidney": { | ||
| "initial_guess": {"S0": 1.0, "f": 0.20, "Dp": 0.03, "D": 0.0019}, | ||
| "bounds": { | ||
| "S0": [0.7, 1.3], | ||
| "f": [0.0, 0.50], | ||
| "Dp": [0.01, 0.08], | ||
| "D": [0.0005, 0.004], | ||
| }, | ||
| "thresholds": [200], | ||
| }, | ||
| "prostate": { | ||
| "initial_guess": {"S0": 1.0, "f": 0.08, "Dp": 0.025, "D": 0.0015}, | ||
| "bounds": { | ||
| "S0": [0.7, 1.3], | ||
| "f": [0.0, 0.25], | ||
| "Dp": [0.005, 0.06], | ||
| "D": [0.0003, 0.003], | ||
| }, | ||
| "thresholds": [200], | ||
| }, | ||
| "pancreas": { | ||
| "initial_guess": {"S0": 1.0, "f": 0.18, "Dp": 0.02, "D": 0.0012}, | ||
| "bounds": { | ||
| "S0": [0.7, 1.3], | ||
| "f": [0.0, 0.50], | ||
| "Dp": [0.005, 0.06], | ||
| "D": [0.0003, 0.003], | ||
| }, | ||
| "thresholds": [200], | ||
| }, | ||
| "head_and_neck": { | ||
| "initial_guess": {"S0": 1.0, "f": 0.15, "Dp": 0.025, "D": 0.001}, | ||
| "bounds": { | ||
| "S0": [0.7, 1.3], | ||
| "f": [0.0, 0.40], | ||
| "Dp": [0.005, 0.08], | ||
| "D": [0.0003, 0.003], | ||
| }, | ||
| "thresholds": [200], | ||
| }, | ||
| "breast": { | ||
| "initial_guess": {"S0": 1.0, "f": 0.10, "Dp": 0.02, "D": 0.0014}, | ||
| "bounds": { | ||
| "S0": [0.7, 1.3], | ||
| "f": [0.0, 0.30], | ||
| "Dp": [0.005, 0.06], | ||
| "D": [0.0004, 0.003], | ||
| }, | ||
| "thresholds": [200], | ||
| }, | ||
| "placenta": { | ||
| "initial_guess": {"S0": 1.0, "f": 0.28, "Dp": 0.04, "D": 0.0017}, | ||
| "bounds": { | ||
| "S0": [0.7, 1.3], | ||
| "f": [0.05, 0.60], | ||
| "Dp": [0.01, 0.1], | ||
| "D": [0.0005, 0.004], | ||
| }, | ||
| "thresholds": [200], | ||
| }, | ||
| } | ||
|
|
||
| # Keep the current universal defaults as "generic" | ||
| IVIM_BODY_PART_DEFAULTS["generic"] = { | ||
| "initial_guess": {"S0": 1.0, "f": 0.1, "Dp": 0.01, "D": 0.001}, | ||
| "bounds": { | ||
| "S0": [0.7, 1.3], | ||
| "f": [0, 1.0], | ||
| "Dp": [0.005, 0.2], | ||
| "D": [0, 0.005], | ||
| }, | ||
| "thresholds": [200], | ||
| } | ||
|
|
||
|
|
||
| def get_body_part_defaults(body_part): | ||
| """Get IVIM default parameters for a given body part. | ||
|
|
||
| Args: | ||
| body_part (str): Name of the body part (e.g., "brain", "liver", "kidney"). | ||
| Case-insensitive. Spaces and hyphens are normalized to | ||
| underscores (e.g., "head and neck" -> "head_and_neck"). | ||
|
|
||
| Returns: | ||
| dict: Dictionary with keys "initial_guess", "bounds", and "thresholds". | ||
|
|
||
| Raises: | ||
| ValueError: If the body part is not in the lookup table. | ||
| """ | ||
| key = body_part.lower().replace(" ", "_").replace("-", "_") | ||
| if key not in IVIM_BODY_PART_DEFAULTS: | ||
| available = ", ".join(sorted(IVIM_BODY_PART_DEFAULTS.keys())) | ||
| raise ValueError( | ||
| f"Unknown body part '{body_part}'. " | ||
| f"Available body parts: {available}" | ||
|
Devguru-codes marked this conversation as resolved.
|
||
| ) | ||
| return IVIM_BODY_PART_DEFAULTS[key] | ||
|
|
||
|
|
||
| def get_available_body_parts(): | ||
| """Return a sorted list of all available body part names. | ||
|
|
||
| Returns: | ||
| list: Sorted list of body part name strings. | ||
| """ | ||
| return sorted(IVIM_BODY_PART_DEFAULTS.keys()) | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.