Skip to content

Commit b963db9

Browse files
authored
Merge pull request #223 from arnaudbore/update_doc_v3
Improve doc for v3.0.0
2 parents 080c9d1 + c46d4c4 commit b963db9

File tree

12 files changed

+742
-150
lines changed

12 files changed

+742
-150
lines changed

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ Your friendly DICOM converter.
2424

2525
`dcm2bids` reorganises NIfTI files using [dcm2niix][dcm2niix-github] into the [Brain Imaging Data Structure][bids] (BIDS).
2626

27+
28+
## Major upgrade with dcm2bids >=3.0.0
29+
30+
⚠️ Breaking changes alert ⚠️
31+
32+
**dcm2bids>=3.0.0 is not compatible with config files made for v2.1.9 and below**.
33+
In order to develop dcm2bids new features we had to rewrite some of its code.
34+
Since v3.0.0, dcm2bids has become **more powerful** and **more flexible** while reducing the burden of creating config files. Porting your config file should be relatively easy by following the [How-to upgrade][dcm2bids-upgrade] page.
35+
If you have any issues with it don't hesitate to report it on [Neurostars][neurostars-dcm2bids].
36+
2737
## Scope
2838

2939
`dcm2bids` is a community-centered project. It aims to be a friendly,
@@ -55,12 +65,13 @@ Before posting your question, you may want to first browse through questions tha
5565
[bids-examples]: https://github.com/bids-standard/bids-examples
5666
[bids-spec]: https://bids-specification.readthedocs.io/en/stable/
5767
[dcm2bids-doc]: https://unfmontreal.github.io/Dcm2Bids
58-
[dcm2bids-install]: https://unfmontreal.github.io/Dcm2Bids/docs/get-started/install/
59-
[dcm2bids-tutorial]: https://unfmontreal.github.io/Dcm2Bids/docs/tutorial/first-steps/#tutorial-first-steps
60-
[dcm2bids-advanced]: https://unfmontreal.github.io/Dcm2Bids/docs/advanced/
68+
[dcm2bids-install]: https://unfmontreal.github.io/Dcm2Bids/latest/get-started/install/
69+
[dcm2bids-tutorial]: https://unfmontreal.github.io/Dcm2Bids/latest/tutorial/first-steps/#tutorial-first-steps
70+
[dcm2bids-advanced]: https://unfmontreal.github.io/Dcm2Bids/latest/advanced/
71+
[dcm2bids-upgrade]: https://unfmontreal.github.io/Dcm2Bids/latest/upgrade/
6172
[dcm2bids-issues]: https://github.com/UNFmontreal/Dcm2Bids/issues
6273
[dcm2niix-install]: https://github.com/rordenlab/dcm2niix#install
6374
[dcm2niix-github]: https://github.com/rordenlab/dcm2niix
6475
[neurostars]: https://neurostars.org/
6576
[neurostars-dcm2bids]: https://neurostars.org/tag/dcm2bids
66-
[dcm2bids-contributing]: https://unfmontreal.github.io/Dcm2Bids/CONTRIBUTING
77+
[dcm2bids-contributing]: https://unfmontreal.github.io/Dcm2Bids/latest/how-to/contributing/

dcm2bids/cli/dcm2bids.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _build_arg_parser():
4949
p.add_argument("--auto_extract_entities",
5050
action='store_true',
5151
help="If set, it will automatically try to extract entity"
52-
"information [task, dir, echo] based on the suffix and dataType."
52+
"information [task, dir, echo] based on the suffix and datatype."
5353
" [%(default)s]")
5454

5555
p.add_argument("--bids_validate",

dcm2bids/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
_version_major = 3
55
_version_minor = 0
66
_version_micro = 0
7-
_version_extra = 'dev'
7+
_version_extra = 'rc1'
88

99
# Construct full version string from these.
1010
_ver = [_version_major, _version_minor]
File renamed without changes.

docs/get-started/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ function:
3737
[installation]: ./install.md
3838
[tutorial]: ../tutorial/first-steps.md
3939
[how-to]: ../how-to
40-
[reference]: /reference/dcm2bids
40+
[reference]: ../dcm2bids
4141
[get-help]: ../how-to/get-help.md

docs/get-started/install.md

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,76 @@ date: 2022-04-17
77

88
# Installation
99

10+
There are several ways to install dcm2bids.
11+
12+
## Installing binary executables
13+
14+
From dcm2bids>=3.0.0, we provide binaries for macOS, Windows and Linux
15+
(debian-based and rhel-based).
16+
17+
They can easily been downloaded from
18+
[the release page](https://github.com/UNFmontreal/Dcm2Bids/releases/latest).
19+
20+
Once downloaded, you should be able to extract the `dcm2bids`,
21+
`dcm2bids_scaffold`, and `dcm2bids_helper` files and use them with the full
22+
path.
23+
24+
=== "Example on Ubuntu 22.04"
25+
26+
```bash
27+
sam:~/software$ curl -fLO https://github.com/unfmontreal/dcm2bids/releases/latest/download/dcm2bids_debian-based_3.0.rc1.tar.gz
28+
sam:~/software$ tar -xvf dcm2bids_debian-based*.tar.gz
29+
sam:~/software$ cd ../data
30+
sam:~/data$ ~/software/dcm2bids_scaffold -o new-bids-project
31+
```
32+
33+
=== "Ouput"
34+
35+
```bash
36+
sam:~/software$ curl -fLO https://github.com/unfmontreal/dcm2bids/releases/latest/download/dcm2bids_debian-based_3.0.0rc1.tar.gz
37+
% Total % Received % Xferd Average Speed Time Time Time Current
38+
Dload Upload Total Spent Left Speed
39+
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
40+
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
41+
100 40.6M 100 40.6M 0 0 23.2M 0 0:00:01 0:00:01 --:--:-- 36.4M
42+
43+
sam:~/software$ tar -xvf dcm2bids_debian-based*.tar.gz
44+
dcm2bids
45+
dcm2bids_helper
46+
dcm2bids_scaffold
47+
48+
sam:~/software$ cd ../data
49+
50+
sam:~/data$ ~/software/dcm2bids_scaffold -o new-bids-project
51+
INFO | --- dcm2bids_scaffold start ---
52+
INFO | Running the following command: /home/sam/software/dcm2bids_scaffold -o new-bids-project
53+
INFO | OS version: Linux-5.15.0-76-generic-x86_64-with-glibc2.31
54+
INFO | Python version: 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0]
55+
INFO | dcm2bids version: 3.0.rc1
56+
INFO | Checking for software update
57+
INFO | Currently using the latest version of dcm2bids.
58+
INFO | The files used to create your BIDS directory were taken from https://github.com/bids-standard/bids-starter-kit.
59+
60+
INFO | Tree representation of new-bids-project/
61+
INFO | new-bids-project/
62+
INFO | ├── code/
63+
INFO | ├── derivatives/
64+
INFO | ├── sourcedata/
65+
INFO | ├── tmp_dcm2bids/
66+
INFO | │ └── log/
67+
INFO | │ └── scaffold_20230716-122220.log
68+
INFO | ├── .bidsignore
69+
INFO | ├── CHANGES
70+
INFO | ├── dataset_description
71+
INFO | ├── participants.json
72+
INFO | ├── participants.tsv
73+
INFO | └── README
74+
INFO | Log file saved at new-bids-project/tmp_dcm2bids/log/scaffold_20230716-122220.log
75+
INFO | --- dcm2bids_scaffold end ---
76+
```
77+
78+
## Installing using pip or conda
79+
1080
Before you can use dcm2bids, you will need to get it installed. This page guides
1181
you through a minimal, typical dcm2bids installation workflow that is sufficient
1282
to complete all dcm2bids tasks.
@@ -21,6 +91,8 @@ dcm2bids.
2191

2292
??? tip "You just want the installation command?"
2393

94+
You can use the binaries provided with each release (starting with dcm2bids>=3)
95+
2496
If you are used to installing packages, you can get it from PyPI or conda:
2597

2698
`pip install dcm2bids`
@@ -134,8 +206,9 @@ installed and correctly setup on your computer as it is the easiest way to
134206
install dcm2bids and its dependencies on any OS. We assume that if you want to
135207
install it in a different way, you have enough skills to do it on your own.
136208

137-
If you installed Anaconda and want to use the graphical user interface (GUI), you can follow the steps as
138-
demonstrated below and only read the steps until the end of the installation guide.
209+
If you installed Anaconda and want to use the graphical user interface (GUI),
210+
you can follow the steps as demonstrated below and only read the steps until the
211+
end of the installation guide.
139212

140213
??? info "Create your environment with the **Anaconda Navigator** GUI"
141214

@@ -168,8 +241,6 @@ But this would install the software in the main environment instead of a
168241
dedicated one, assuming none were active. This could have atrocious dependencies
169242
issues in the long-term if you want to install other software.
170243

171-
172-
173244
#### Create environment.yml
174245

175246
That is exactly why dedicated environments were invented. To help creating

docs/how-to/create-config-file.md

Lines changed: 66 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,53 +6,57 @@
66
{
77
"descriptions": [
88
{
9-
"dataType": "anat",
10-
"modalityLabel": "T2w",
9+
"datatype": "anat",
10+
"suffix": "T2w",
1111
"criteria": {
1212
"SeriesDescription": "*T2*",
1313
"EchoTime": 0.1
1414
},
15-
"sidecarChanges": {
15+
"sidecar_changes": {
1616
"ProtocolName": "T2"
1717
}
1818
},
1919
{
20-
"dataType": "func",
21-
"modalityLabel": "bold",
22-
"customLabels": "task-rest",
20+
"id": "task-rest",
21+
"datatype": "func",
22+
"suffix": "bold",
23+
"custom_entities": "task-rest",
2324
"criteria": {
2425
"ProtocolName": "func_task-*",
2526
"ImageType": ["ORIG*", "PRIMARY", "M", "MB", "ND", "MOSAIC"]
2627
}
2728
},
2829
{
29-
"dataType": "fmap",
30-
"modalityLabel": "fmap",
31-
"intendedFor": 1,
30+
"datatype": "fmap",
31+
"suffix": "fmap",
3232
"criteria": {
3333
"ProtocolName": "*field_mapping*"
34+
},
35+
"sidecar_changes": {
36+
"IntendedFor": "task_rest"
3437
}
3538
},
3639
{
37-
"dataType": "func",
38-
"modalityLabel": "bold",
39-
"customLabels": "task-learning",
40+
"id": "id_task_learning",
41+
"datatype": "func",
42+
"suffix": "bold",
43+
"custom_entities": "task-learning",
4044
"criteria": {
4145
"SeriesDescription": "bold_task-learning"
4246
},
43-
"sidecarChanges": {
47+
"sidecar_changes": {
4448
"TaskName": "learning"
4549
}
4650
},
4751
{
48-
"dataType": "fmap",
49-
"modalityLabel": "epi",
52+
"datatype": "fmap",
53+
"suffix": "epi",
5054
"criteria": {
5155
"SeriesDescription": "fmap_task-learning"
5256
},
53-
"IntendedFor": 2,
54-
"sidecarChanges": {
55-
"TaskName": "learning"
57+
"sidecar_changes": {
58+
"TaskName": "learning",
59+
"IntendedFor": "id_task_learning"
5660
}
5761
}
5862
]
@@ -98,7 +102,7 @@ subject to change depending on the dcm2niix version in use.
98102
You can enter several criteria. **All criteria must match** for a description to
99103
be linked to a sidecar.
100104

101-
## dataType
105+
## datatype
102106

103107
It is a mandatory field. Here is a definition from `bids v1.2.0` :
104108

@@ -108,12 +112,12 @@ It is a mandatory field. Here is a definition from `bids v1.2.0` :
108112
> field maps), anat (structural imaging such as T1, T2, etc.), meg
109113
> (magnetoencephalography), beh (behavioral).
110114
111-
## modalityLabel
115+
## suffix
112116

113117
It is a mandatory field. It describes the modality of the acquisition like
114118
`T1w`, `T2w` or `dwi`, `bold`.
115119

116-
## customLabels
120+
## custom_entities
117121

118122
It is an optional field. For some acquisitions, you need to add information in
119123
the file name. For resting state fMRI, it is usually `task-rest`.
@@ -124,19 +128,52 @@ specifications][bids-spec].
124128
For a longer example of a Dcm2Bids config json, see
125129
[here](https://github.com/unfmontreal/Dcm2Bids/blob/master/example/config.json).
126130

127-
## sidecarChanges
131+
Note that the different bids labels must come in a very specific order to be
132+
bids valid filenames. If the custom_entities fields that are entered that are in
133+
the wrong order, then dcm2bids will reorder them for you.
134+
135+
For example if you entered:
136+
137+
```json
138+
"custom_entities": "run-01_task-rest"
139+
```
140+
141+
when running dcm2bids, you will get the following warning:
142+
143+
```bash
144+
WARNING:dcm2bids.structure:✅ Filename was reordered according to BIDS entity table order:
145+
from: sub-ID01_run-01_task-rest_bold
146+
to: sub-ID01_task-rest_run-01_bold
147+
```
148+
149+
custom_entities could also be combined with extractors. See
150+
[custom_entities combined with extractors](./use-advanced-commands.md#custom_entities-combined-with-extractors)
151+
152+
## sidecar_changes, id and IntendedFor
128153

129154
Optional field to change or add information in a sidecar.
130155

131-
## intendedFor
156+
:warning: `IntendedFor` is now considered a sidecar_changes.
157+
158+
Example:
159+
160+
```json
161+
{
162+
"sidecar_changes": {
163+
"IntendedFor": "task_rest"
164+
}
165+
}
166+
```
167+
168+
If you want to add an `IntendedFor` entry or any extra sidecar linked to a
169+
specific file, you will need to set an id to the corresponding description and
170+
put the same id with `IntendedFor`.
132171

133-
Optional field to add an `IntendedFor` entry in the sidecar of a fieldmap. Just
134-
put the index or a list of indices of the description(s) that's intended for.
172+
Fo example, **`task_rest`** means it is intended for `task-rest_bold` and
173+
**`id_task_learning`** is intended for `task-learning_bold`.
135174

136-
Python index begins at `0` so in the example, **`1`** means it is intended for
137-
`task-rest_bold` and **`2`** is intended for `task-learning` which will be
138-
renamed to only `learning` because of the
139-
`"sidecarChanges": { "TaskName": "learning" }` field.
175+
You could also use this feature to feed sidecar such as `Source`` for example or
176+
anything that suits your needs.
140177

141178
## Multiple config files
142179

docs/how-to/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ title: How-to guides
1818

1919
## Development and Community
2020

21-
- [Contribute to dcm2bids](/CONTRIBUTING.md)
21+
- [Contribute to dcm2bids](./contributing.md)

0 commit comments

Comments
 (0)