Skip to content

Standardize output pipleine#105

Open
gitnoob101 wants to merge 3 commits intoOSIPI:mainfrom
gitnoob101:standardize-output-pipleine
Open

Standardize output pipleine#105
gitnoob101 wants to merge 3 commits intoOSIPI:mainfrom
gitnoob101:standardize-output-pipleine

Conversation

@gitnoob101
Copy link

This update standardizes the output format across all imaging modalities in osipy. Before, every perfusion pipeline like DCE, DSC, ASL, and IVIM gave out data in their own unique ways, which made it tough for researchers to write flexible scripts that could handle different data types without having to write special code for each one.Now, all pipelines universally return a standardized AnalysisResult. This ensures that things like $K^{trans}$, $CBF$, or $D$, along with quality masks and consistent audit trails, are always available in the same way.
Usage Example
This makes it easier to move and show data for studies that use different types of info.Before: Researchers had to jot down different code for each way they were looking at things.
'''
result = pipeline.run(data, ...)
if modality == "dce":
ktrans = result.ktrans_map
elif modality == "ivim":
d = result.fit_result.D
elif modality == "dsc":
cbf = result.cbf_map

'''
After (This PR): The new run_analysis function returns a uniform output, so plotting or saving your data requires only one concise loop regardless of the MRI contrast used:
'''
result = run_analysis(data, modality=modality, ...)
for parameter_name, parameter_map in result.parameter_maps.items():
save_nifti(parameter_map.values, f"{parameter_name}.nii.gz")
''''
Key Improvements
1.Uniform Parameter Mapping: All calculated parameter maps are now bundled together in a standardized dictionary using OSIPI CAPLEX nomenclature, preventing the need to hunt for specific object attributes.
2.Guaranteed Quality Masks: Now, every time you run an analysis, you'll get a clear yes-or-no answer on whether the voxels were fitted properly or not.
3.Built-in Reproducibility (Audit Trails): Every result now automatically logs its details (provenance), capturing the exact osipy version, timestamp, modality, and configuration parameters used. This means we can check and repeat the same outcomes later on.

Backward Compatibility
If you've been using those old-school script classes straight from the inside (like DCEPipeline.run()), your code's gonna keep doing its thing just like it always has, no need to change anything.

Validation
This unified framework has successfully cleared 792 automated tests against standard digital reference objects to ensure accuracy in Python 3.12 and newer environments.

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.

1 participant