Summary
The bids.reports module currently lacks parsing functions and templates for several newer, officially supported BIDS modalities, specifically Arterial Spin Labeling (ASL), Positron Emission Tomography (PET), and Magnetic Resonance Spectroscopy (MRS).
As a result, users attempting to generate automated methods sections for datasets containing these modalities will find that the files are either skipped or generate incomplete, fallback text.
Background
Currently, the BIDSReport.generate_from_files() pipeline routes files to specific parsing functions based on their data type and suffix (e.g., func_info, anat_info, dwi_info, fmap_info). These functions are hardcoded in src/bids/reports/parsing.py and rely on a configuration mapped in src/bids/reports/config/converters.json to extract relevant JSON metadata (like RepetitionTime, EchoTime, FlipAngle) and format it into publication-ready prose.
Over the last few years, the BIDS specification has officially integrated several new modalities:
- ASL (BEP005) - requires parsing for
LabelingDuration, PostLabelingDelay, BackgroundSuppression, etc.
- PET (BEP009) - requires parsing for
TracerName, InjectedRadioactivity, ModeOfAdministration, etc.
- MRS (BEP022) - requires parsing for
WaterSuppressed, EchoTime, SpectrometerFrequency, etc.
Expected Behavior
Running report = BIDSReport(layout) and report.generate_from_files(files) on an ASL, PET, or MRS dataset should return a fully formed methods paragraph detailing the specific acquisition parameters unique to that modality, exactly as it currently does for BOLD and T1w data.
Proposed Implementation
To resolve this, we would need to:
- Update
src/bids/reports/parsing.py: Create new dedicated parsing functions (e.g., asl_info(layout, files, config), pet_info(...), mrs_info(...)) that extract the mandatory and recommended metadata fields for each modality.
- Update
src/bids/reports/report.py: Add routing logic to detect these suffixes/datatypes and pass them to the new parsing functions.
- Update
converters.json: Add the corresponding metadata fields and grammatical conversion rules so that raw JSON values are correctly translated into prose.
- Add Tests: Include synthetic mock datasets for ASL, PET, and MRS in
src/bids/tests/data/ (or use existing ones if available) and add pytest coverage in src/bids/reports/tests/test_reports.py to ensure the generated strings match expectations.
I would love to take a stab at implementing one of these modalities (e.g., ASL) if a maintainer is willing to point me in the right direction!
Summary
The
bids.reportsmodule currently lacks parsing functions and templates for several newer, officially supported BIDS modalities, specifically Arterial Spin Labeling (ASL), Positron Emission Tomography (PET), and Magnetic Resonance Spectroscopy (MRS).As a result, users attempting to generate automated methods sections for datasets containing these modalities will find that the files are either skipped or generate incomplete, fallback text.
Background
Currently, the
BIDSReport.generate_from_files()pipeline routes files to specific parsing functions based on their data type and suffix (e.g.,func_info,anat_info,dwi_info,fmap_info). These functions are hardcoded insrc/bids/reports/parsing.pyand rely on a configuration mapped insrc/bids/reports/config/converters.jsonto extract relevant JSON metadata (likeRepetitionTime,EchoTime,FlipAngle) and format it into publication-ready prose.Over the last few years, the BIDS specification has officially integrated several new modalities:
LabelingDuration,PostLabelingDelay,BackgroundSuppression, etc.TracerName,InjectedRadioactivity,ModeOfAdministration, etc.WaterSuppressed,EchoTime,SpectrometerFrequency, etc.Expected Behavior
Running
report = BIDSReport(layout)andreport.generate_from_files(files)on an ASL, PET, or MRS dataset should return a fully formed methods paragraph detailing the specific acquisition parameters unique to that modality, exactly as it currently does for BOLD and T1w data.Proposed Implementation
To resolve this, we would need to:
src/bids/reports/parsing.py: Create new dedicated parsing functions (e.g.,asl_info(layout, files, config),pet_info(...),mrs_info(...)) that extract the mandatory and recommended metadata fields for each modality.src/bids/reports/report.py: Add routing logic to detect these suffixes/datatypes and pass them to the new parsing functions.converters.json: Add the corresponding metadata fields and grammatical conversion rules so that raw JSON values are correctly translated into prose.src/bids/tests/data/(or use existing ones if available) and addpytestcoverage insrc/bids/reports/tests/test_reports.pyto ensure the generated strings match expectations.I would love to take a stab at implementing one of these modalities (e.g., ASL) if a maintainer is willing to point me in the right direction!