Skip to content

Commit 334fba7

Browse files
committed
Moving all provenance records to json sidecar / dcm2niix example
1 parent e063152 commit 334fba7

File tree

8 files changed

+55
-72
lines changed

8 files changed

+55
-72
lines changed

examples/dcm2niix_3/README.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ This example aims at showing provenance traces from a DICOM to Nifti conversion,
66

77
This time, we describe the provenance records using BIDS Prov, but inside several *JSON* files.
88

9+
The example illustrates a case where only one file is generated, hence all provenance records are stored in the *JSON* sidecar file `sub-02_T1w.json`.s
10+
911
After conversion, and adding provenance traces, the resulting directory tree looks like this:
1012

1113
```
1214
prov/
13-
├── prov-dcm2niix_act.prov.json
14-
├── prov-dcm2niix_base.prov.json
15-
├── prov-dcm2niix_env.prov.json
16-
└── prov-dcm2niix_soft.prov.json
15+
└── prov-dcm2niix_base.prov.json
1716
sourcedata/
1817
sub-02/
1918
└── anat
@@ -61,16 +60,8 @@ We introduce the following BIDS entity that is currently not existing:
6160
* Format: `prov-<label>`
6261
* Definition: A grouping of provenance traces. Defining multiple provenance traces groups is appropriate when several processings have been performed on data.
6362

64-
We introduce the following BIDS suffixes that are currently not existing:
65-
* `act`: the file describes BIDS Prov `Activities` for the group of provenance traces
66-
* `soft`: the file describes BIDS Prov `Software` for the group of provenance traces
67-
* `env`: the file describes BIDS Prov `Environments` for the group of provenance traces
68-
* `base`: the file describes common BIDS Prov parameters for the group of provenance traces (version and context for BIDS Prov)
69-
7063
We use the `GeneratedBy` field of JSON sidecars to link to `Activities` that created the file the sidecars refers to.
7164

72-
In this example, we rely on the fact that nodes defined in the `prov/*.prov.jsonld` files have `bids::prov/` as base IRIs.
73-
7465
The `code/merge_prov.py` code is responsible for:
7566
* merging the JSON provenance traces into the base JSON-LD graph;
7667
* create an `Entity` and linking it to the `Activity` described by the `GeneratedBy` field in the case of JSON sidecars.

examples/dcm2niix_3/code/merge_prov.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@
88

99
# List of available prov files
1010
prov_soft_files = [
11-
'prov/prov-dcm2niix_soft.prov.json'
1211
]
1312
prov_env_files = [
14-
'prov/prov-dcm2niix_env.prov.json'
1513
]
1614
prov_act_files = [
17-
'prov/prov-dcm2niix_act.prov.json'
1815
]
1916
sidecar_files = [
2017
'sub-02/anat/sub-02_T1w.json'

examples/dcm2niix_3/prov/merged/prov-dcm2niix.prov.jsonld

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
11
{
22
"Records": {
3-
"Software": [
4-
{
5-
"Label": "dcm2niix",
6-
"Version": "v1.0.20220720",
7-
"Id": "bids::prov/#dcm2niix-khhkm7u1"
8-
}
9-
],
10-
"Activities": [
11-
{
12-
"Label": "Conversion",
13-
"Command": "dcm2niix -o . -f sub-%i/anat/sub-%i_T1w sourcedata/hirni-demo/acq1/dicoms/example-dicom-structural-master/dicoms",
14-
"AssociatedWith": "bids::prov/#dcm2niix-khhkm7u1",
15-
"Used": [
16-
"bids::prov/#fedora-uldfv058",
17-
{
18-
"Id": "bids::sourcedata/hirni-demo/acq1/dicoms/example-dicom-structural-master/dicoms",
19-
"Type": "Entity",
20-
"Label": "dicoms"
21-
}
22-
],
23-
"Id": "bids::prov/#conversion-00f3a18f"
24-
}
25-
],
3+
"Software": [],
4+
"Activities": [],
265
"Entities": [
27-
{
28-
"Label": "Fedora release 36 (Thirty Six)",
29-
"OperatingSystem": "GNU/Linux 6.2.15-100.fc36.x86_64",
30-
"Id": "bids::prov/#fedora-uldfv058"
31-
},
326
{
337
"Id": "bids::sub-02/anat/sub-02_T1w.nii",
34-
"GeneratedBy": "bids::prov/#conversion-00f3a18f"
8+
"GeneratedBy": {
9+
"Id": "bids::sub-02/anat/#conversion-00f3a18f",
10+
"Type": "Activity",
11+
"Label": "Conversion",
12+
"Command": "dcm2niix -o . -f sub-%i/anat/sub-%i_T1w sourcedata/hirni-demo/acq1/dicoms/example-dicom-structural-master/dicoms",
13+
"AssociatedWith": {
14+
"Id": "bids::sub-02/anat/#dcm2niix-khhkm7u1",
15+
"Type": "Software",
16+
"Label": "dcm2niix",
17+
"Version": "v1.0.20220720"
18+
},
19+
"Used": [
20+
{
21+
"Id": "bids::sub-02/anat/#fedora-uldfv058",
22+
"Type": "Entity",
23+
"Label": "Fedora release 36 (Thirty Six)",
24+
"OperatingSystem": "GNU/Linux 6.2.15-100.fc36.x86_64"
25+
},
26+
{
27+
"Id": "bids::sourcedata/hirni-demo/acq1/dicoms/example-dicom-structural-master/dicoms",
28+
"Type": "Entity",
29+
"Label": "dicoms"
30+
}
31+
]
32+
}
3533
}
3634
]
3735
},
6.26 KB
Loading

examples/dcm2niix_3/prov/prov-dcm2niix_act.prov.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

examples/dcm2niix_3/prov/prov-dcm2niix_env.prov.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/dcm2niix_3/prov/prov-dcm2niix_soft.prov.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/dcm2niix_3/sub-02/anat/sub-02_T1w.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,29 @@
2020
-0.128044 ],
2121
"ConversionSoftware": "dcm2niix",
2222
"ConversionSoftwareVersion": "v1.0.20220720",
23-
"GeneratedBy": "bids::prov/#conversion-00f3a18f"
23+
"GeneratedBy": {
24+
"Id": "bids::sub-02/anat/#conversion-00f3a18f",
25+
"Type": "Activity",
26+
"Label": "Conversion",
27+
"Command": "dcm2niix -o . -f sub-%i/anat/sub-%i_T1w sourcedata/hirni-demo/acq1/dicoms/example-dicom-structural-master/dicoms",
28+
"AssociatedWith": {
29+
"Id": "bids::sub-02/anat/#dcm2niix-khhkm7u1",
30+
"Type": "Software",
31+
"Label": "dcm2niix",
32+
"Version": "v1.0.20220720"
33+
},
34+
"Used": [
35+
{
36+
"Id": "bids::sub-02/anat/#fedora-uldfv058",
37+
"Type": "Entity",
38+
"Label": "Fedora release 36 (Thirty Six)",
39+
"OperatingSystem": "GNU/Linux 6.2.15-100.fc36.x86_64"
40+
},
41+
{
42+
"Id": "bids::sourcedata/hirni-demo/acq1/dicoms/example-dicom-structural-master/dicoms",
43+
"Type": "Entity",
44+
"Label": "dicoms"
45+
}
46+
]
47+
}
2448
}

0 commit comments

Comments
 (0)