Skip to content

Fix #130: Expose delay fitting options in CLI config classes#137

Open
Devguru-codes wants to merge 1 commit intoOSIPI:mainfrom
Devguru-codes:fix/130-expose-delay-fitting
Open

Fix #130: Expose delay fitting options in CLI config classes#137
Devguru-codes wants to merge 1 commit intoOSIPI:mainfrom
Devguru-codes:fix/130-expose-delay-fitting

Conversation

@Devguru-codes
Copy link
Copy Markdown
Contributor

@Devguru-codes Devguru-codes commented Apr 5, 2026

Hello @ltorres6 sir, I am making this pr because i saw the issue created by you. This PR exposes the delay fitting options that already exist in the library layer (fit_model() in osipy/dce/fitting.py) through the CLI configuration system, allowing users to enable and configure arterial delay fitting via YAML config files. The changes made are -

  1. osipy/cli/config.py - Added fit_delay: bool = False and delay_bounds: list[float] = [0.0, 60.0] to DCEFittingConfig, with a validator ensuring delay_bounds is a valid [lower, upper] pair.

  2. osipy/pipeline/dce_pipeline.py - Added fit_delay and delay_bounds to the DCEPipelineConfig dataclass, and passed fit_delay=self.config.fit_delay in the fit_model() call inside DCEPipeline.run().

  3. osipy/cli/runner.py - Wired fit_delay and delay_bounds from the YAML config through both runner code paths:

    • NIfTI path (_run_dce): Passed when building DCEPipelineConfig
    • DICOM path (_run_dce_from_dicom): Passed directly to fit_model()
  4. tests/unit/cli/test_config.py - Added 5 new tests:

    • Default values for fit_delay and delay_bounds
    • Custom delay_bounds parsing
    • Validation for wrong-length and inverted bounds
    • Full YAML round-trip test with delay fitting enabled

DSC Note

DSC delay maps (Ta/Tmax) are already computed automatically by the SVD deconvolution methods - they come from the residue function peak, not from a configurable fitting toggle. No DSC config changes are needed.

Usage

Users can now enable delay fitting in their YAML config:

modality: dce
pipeline:
model: extended_tofts
fitting:
fit_delay: true
delay_bounds: [0.0, 30.0]

I will wait for suggestions from your side and then update this pr accordingly. Thank you.
Fixes #130

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.

Expose delay fitting options in CLI config classes

1 participant