Skip to content

Commit 808b8fd

Browse files
committed
Readme explaining the creation of dcm2niix example
1 parent 335177b commit 808b8fd

File tree

2 files changed

+75
-5
lines changed

2 files changed

+75
-5
lines changed

examples/dcm2niix/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# A `dcm2niix` example for BIDS-Prov
2+
3+
This example aim at showing provenance traces from a DICOM to Nifti conversion, performed by `dcm2niix` on a Linux-based (Fedora) operating system.
4+
5+
## `dcm2niix` installation
6+
7+
```shell
8+
sudo yum install dcm2niix
9+
```
10+
11+
## Source dataset
12+
13+
We get raw data from https://github.com/psychoinformatics-de/hirni-demo.git, a demo datalad dataset containing dicoms.
14+
15+
```shell
16+
# Get example dicom(s) in a sourcedata/ directory
17+
mkdir sourcedata
18+
cd sourcedata
19+
datalad install --recursive https://github.com/psychoinformatics-de/hirni-demo.git
20+
cd acq1
21+
datalad get ./*
22+
cd ../acq2
23+
datalad get ./*
24+
ls -1
25+
acq1
26+
acq2
27+
code
28+
dataset_description.json
29+
README
30+
studyspec.json
31+
cd ..
32+
```
33+
34+
## Conversions
35+
36+
With this setup we are ready to convert dicoms to nifti files using `dcm2niix`.
37+
38+
```shell
39+
dcm2niix -o . -f sub-%i/ses-%t/anat/sub-%i_ses-%t_T1w sourcedata/acq1/dicoms/example-dicom-structural-master/dicoms/
40+
dcm2niix -o . -f sub-%i/ses-%t/func/sub-%i_ses-%t_task-oneback_run-1_bold sourcedata/acq1/dicoms/example-dicom-structural-master/dicoms/
41+
42+
# Control results
43+
tree sub-02/
44+
sub-02/
45+
├── ses-20130717141500
46+
│ └── anat
47+
│ ├── sub-02_ses-20130717141500_T1w.json
48+
│ └── sub-02_ses-20130717141500_T1w.nii
49+
└── ses-20140425155335
50+
└── func
51+
├── sub-02_ses-20140425155335_task-oneback_run-1_bold.json
52+
└── sub-02_ses-20140425155335_task-oneback_run-1_bold.nii
53+
```
54+
55+
## Associated provenance
56+
57+
See the `dcm2niix.prov.jsonld` file.
58+
59+
Some limitations :
60+
* for now, the values of Activities `Used` keys only refer to the first dicom file of a series, although each activity should be linked to all the data it actually used (i.e.: all dicom files in a directory in our case).
61+
* as there is a high number of dicom files (384 in `acq1/` and 5460 in `acq2/`), we did not create an entity for each of these. Only the first three files of each directory were represented.

examples/dcm2niix/dcm2niix.prov.jsonld

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22
"@context": "https://purl.org/nidash/bidsprov/context.json",
33
"BIDSProvVersion": "0.0.1",
44
"Records": {
5+
"Environments": [
6+
{
7+
"Id": "urn:fedora",
8+
"Label": "Fedora release 36 (Thirty Six)",
9+
"OperatingSystem": " GNU/Linux 6.2.15-100.fc36.x86_64"
10+
}
11+
],
512
"Software": [
613
{
7-
"Id": "urn:dcm2niix-4a586b50",
14+
"Id": "urn:dcm2niix",
815
"Label": "dcm2niix",
916
"Version": "v1.0.20220720"
1017
}
@@ -13,14 +20,16 @@
1320
{
1421
"Id": "urn:conversion-00f3a18f",
1522
"Label": "Conversion",
16-
"Command": "dcm2niix -o . -f sub-%i/ses-%t/anat/sub-%i_ses-%t_T1w sourcedata/acq1/dicoms/example-dicom-structural-master/dicoms/"
17-
"AssociatedWith": "urn:dcm2niix-4a586b50"
23+
"Command": "dcm2niix -o . -f sub-%i/ses-%t/anat/sub-%i_ses-%t_T1w sourcedata/acq1/dicoms/example-dicom-structural-master/dicoms/",
24+
"AssociatedWith": "urn:dcm2niix-4a586b50",
25+
"Used": "bids::sourcedata/hirni-demo/acq1/dicoms/example-dicom-structural-master/dicoms/N2D_0001.dcm"
1826
},
1927
{
2028
"Id": "urn:conversion-5a66f5be",
2129
"Label": "Conversion",
22-
"Command": "dcm2niix -o . -f sub-%i/ses-%t/func/sub-%i_ses-%t_task-oneback_run-1_bold sourcedata/acq1/dicoms/example-dicom-structural-master/"
23-
"AssociatedWith": "urn:dcm2niix-4a586b50"
30+
"Command": "dcm2niix -o . -f sub-%i/ses-%t/func/sub-%i_ses-%t_task-oneback_run-1_bold sourcedata/acq1/dicoms/example-dicom-structural-master/dicoms/",
31+
"AssociatedWith": "urn:dcm2niix-4a586b50",
32+
"Used": "bids::sourcedata/hirni-demo/acq2/dicoms/example-dicom-functional-master/dicoms/MR.1.3.46.670589.11.38317.5.0.4476.2014042516042547586"
2433
}
2534
],
2635
"Entities": [

0 commit comments

Comments
 (0)