You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/dcm2niix/README.md
+54-25Lines changed: 54 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
This example aims at showing the capture of provenance for a [`dcm2niix`](https://github.com/rordenlab/dcm2niix) usecase: converting DICOM data to Nifti files within a BIDS dataset.
4
4
5
5
Source data for this example can be found here: https://github.com/psychoinformatics-de/hirni-demo. This is a datalad dataset containing anatomical and functional MRI acquisitions. The contents of this dataset can be downloaded using:
We introduce the following BIDS suffixes that are currently not existing:
34
-
*`soft`:
35
-
*`env`:
45
+
*`soft`: the file describes BIDS Prov `Software` for the provenance traces
46
+
*`env`: the file describes BIDS Prov `Environments` for the provenance traces
36
47
37
48
We introduce the following BIDS entity that is currently not existing:
38
49
*`prov`
39
50
* Full name: Provenance traces
40
51
* Format: `prov-<label>`
41
52
* Definition: A grouping of provenance traces. Defining multiple provenance traces groups is appropriate when several processings have been performed on data.
42
53
43
-
*`sub-02_ses-20130717141500_T1w.prov.jsonld` and `sub-02_ses-20140425155335_task-oneback_run-1_bold.prov.jsonld` are sidecars defining provenance for the corresponding `.nii` files.
44
-
*`environments.prov.jsonld` mutualises the declaration of software environments objects for lower level prov files
45
-
*`software.prov.jsonld` mutualises the declaration of software pieces objects for lower level prov files
54
+
We also use the `ses` entity for provenance files, in order to identify several groups of processes that happened at different times. In the example, `ses-01` and `ses-02` represent two different dcm2niix conversion sessions, with different versions of dcm2niix and environments.
55
+
56
+
We use the `GeneratedBy` field of JSON sidecars to describe `Activities` that created the file the sidecars refers to.
57
+
58
+
The `prov/base.prov.jsonld` contains an empty BIDS Prov JSON-LD graph as follows:
## Merging JSON in a JSON-LD file and plotting graph
46
72
47
-
The python script `code/exp1_merge_prov.py` aims at merging all these provenance records into one RFD graph.
73
+
The python script `code/merge_prov.py` aims at merging all these provenance records into one RFD graph.
48
74
49
75
```shell
50
-
pip install -r code/requirements.txt
51
-
mkdir prov/experiment_1/
52
-
python code/exp1_merge_prov.py
76
+
mkdir prov/merged/
77
+
python code/merge_prov.py
53
78
```
54
79
55
-
From that, we generate the RDF graph `prov/experiment_1/merged_provenance.ttl`. Then we were able to plot the graph as a png file. We used this command:
80
+
From that, we generate the JSON-LD graph `prov/merge/prov-dcm2niix.prov.jsonld`. Then we were able to plot the graph as a png file. We used this command:
In this example, we rely on the fact that nodes defined in the `prov/*.prov.jsonld` files have `bids::prov/` as base IRIs. Here are the involved nodes:
66
-
*`bids::prov/dcm2niix`
67
-
*`bids::prov/fedora`
90
+
In this example, we rely on the fact that nodes defined in the `prov/*.prov.jsonld` files have `bids::prov/` as base IRIs.
91
+
92
+
The `code/merge_prov.py` code is responsible for:
93
+
* merging the JSON provenance traces into the base JSON-LD graph;
94
+
* create an `Entity` and linking it to the `Activity` described by the `GeneratedBy` field in the case of JSON sidecars.
68
95
69
96
### Limitations
70
97
71
-
The `bids::prov/fedora` node defined in `prov/environments.prov.jsonld` (see grey node in the above graph plot) is not recognized as a `prov:Entity` as the current context (commit [ce0eb77](https://github.com/bids-standard/BEP028_BIDSprov/commit/ce0eb774abd9527e594bd69212a87d5047864678)) does not define the `Environments` term.
98
+
1.The `Environments` term is not defined in the current BIDS Prov context, hence we define environments as `Entities`.
72
99
73
-
Listing all the DICOM files used by the dcm2niix conversion steps would lower readability of the JSON-LD provenance files. Therefore we only listed the following directories as `Entities`:
100
+
2.Listing all the DICOM files used by the dcm2niix conversion steps would lower readability of the JSON-LD provenance files. Therefore we only listed the following directories as `Entities`:
0 commit comments