From 048edeaea86c2cecf7e853a7496fe80109d057bc Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot <> Date: Wed, 9 Apr 2025 13:19:29 +0000 Subject: [PATCH 1/4] automated nidm example computation from github action --- ...5_04_09_12h04m20s.txt => context_2025_04_09_13h19m26s.txt} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename examples/from_parsers/{context_2025_04_09_12h04m20s.txt => context_2025_04_09_13h19m26s.txt} (98%) diff --git a/examples/from_parsers/context_2025_04_09_12h04m20s.txt b/examples/from_parsers/context_2025_04_09_13h19m26s.txt similarity index 98% rename from examples/from_parsers/context_2025_04_09_12h04m20s.txt rename to examples/from_parsers/context_2025_04_09_13h19m26s.txt index 38a7faaf..a08aab2a 100644 --- a/examples/from_parsers/context_2025_04_09_12h04m20s.txt +++ b/examples/from_parsers/context_2025_04_09_13h19m26s.txt @@ -1,4 +1,4 @@ -Date : 2025_04_09_12h04m20s +Date : 2025_04_09_13h19m26s Processing files... file= nidmresults-examples/afni_alt_onesided_proc.sub_001 file= nidmresults-examples/afni_alt_onesided_proc.sub_001 @@ -69,4 +69,4 @@ Processing files... file= nidmresults-examples/spm_thr_voxelfdrp05_batch.m file= nidmresults-examples/spm_thr_voxelfwep05_batch.m file= nidmresults-examples/spm_thr_voxelunct4_batch.m -End of processed files. Results in dir : 'examples/from_parsers'. Time required: 0:00:02.127313 +End of processed files. Results in dir : 'examples/from_parsers'. Time required: 0:00:02.107409 From 232aa68c240370aafc7bf0dc00845407bc908a9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Cl=C3=A9net?= Date: Wed, 21 May 2025 09:38:40 +0200 Subject: [PATCH 2/4] dcm2niix example allowing BIDS validation --- examples/dcm2niix_5/README.md | 87 +++++++++++++ examples/dcm2niix_5/code/merge_prov.py | 114 ++++++++++++++++++ .../prov/merged/prov-dcm2niix.jsonld | 45 +++++++ .../dcm2niix_5/prov/merged/prov-dcm2niix.png | Bin 0 -> 45396 bytes .../dcm2niix_5/sub-02/anat/sub-02_T1w.nii | 0 5 files changed, 246 insertions(+) create mode 100644 examples/dcm2niix_5/README.md create mode 100644 examples/dcm2niix_5/code/merge_prov.py create mode 100644 examples/dcm2niix_5/prov/merged/prov-dcm2niix.jsonld create mode 100644 examples/dcm2niix_5/prov/merged/prov-dcm2niix.png create mode 100644 examples/dcm2niix_5/sub-02/anat/sub-02_T1w.nii diff --git a/examples/dcm2niix_5/README.md b/examples/dcm2niix_5/README.md new file mode 100644 index 00000000..a4165379 --- /dev/null +++ b/examples/dcm2niix_5/README.md @@ -0,0 +1,87 @@ +# BIDS Prov example #5 for `dcm2niix` + +This example aims at showing provenance traces from a DICOM to Nifti conversion, performed by `dcm2niix` on a Linux-based (Fedora) operating system. + +## Overview + +This time, we describe the provenance records using BIDS Prov, but inside several *JSON* files. + +Although this example generates only one file, it illustrates how to store provenance records in the case where the dcm2niix `Conversion` Activity is responsible for several conversions. + +After conversion, and adding provenance traces, the resulting directory tree looks like this: + +``` +prov/ +├── prov-dcm2niix_act.prov.json +├── prov-dcm2niix_env.prov.json +└── prov-dcm2niix_soft.prov.json +sourcedata/ +sub-02/ +└── anat + ├── sub-02_T1w.json + └── sub-02_T1w.nii +``` + +Note that the `sourcedata/` directory contains the source dataset described in the [section hereafter](#source-dataset). + +We use: + +* the `GeneratedBy` field of JSON sidecar, already existing in the BIDS specification +* modality agnostic files inside the `prov/` directory + +Note that we assume that both `sub-02_T1w.nii` and its JSON sidecar `sub-02_T1w.json` were generated by the same Activity. + +## Provenance merge + +The python script `code/merge_prov.py` aims at merging all provenance records into one JSON-LD graph. + +```shell +pip install bids-prov==0.1.0 +mkdir prov/merged/ +python code/merge_prov.py +``` + +## Provenance visualization + +We are then able to visualize these provenance files using the following commands (current directory is `examples/dcm2niix_3/`): + +```shell +pip install bids-prov==0.1.0 +bids_prov_visualizer --input_file prov/merged/prov-dcm2niix.jsonld --output_file prov/merged/prov-dcm2niix.png +``` + +![](/examples/dcm2niix_3/prov/merged/prov-dcm2niix.png) + +## Source dataset + +Dataset is the same as the one for [example dcm2niix_1](/BEP028_BIDSprov/examples/dcm2niix_1/README.md#source-dataset). + +## Notes + +We introduce the following BIDS entity that is currently not existing: +* `prov` + * Full name: Provenance traces + * Format: `prov-