Skip to content

Commit b27a724

Browse files
authored
Merge pull request #47 from openneuropet/46-standardize-input-names-across-pet-prep-piplines
updated to be more bids-app like
2 parents 5779123 + 83f337c commit b27a724

File tree

4 files changed

+260
-182
lines changed

4 files changed

+260
-182
lines changed

README.md

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,46 +35,49 @@ This software can be installed via source or via pip from PyPi with `pip install
3535
**_NOTE:_** This project is currently in beta release, some features listed below may not be available for version numbers < 1.0.0
3636

3737
```bash
38-
usage: petdeface.py [-h] [--output_dir OUTPUT_DIR] [--anat_only]
39-
[--subject SUBJECT] [--session SESSION] [--docker]
40-
[--singularity] [--n_procs N_PROCS] [--skip_bids_validator]
41-
[--version] [--placement PLACEMENT] [--remove_existing]
42-
[--excludesubject] input_dir
38+
usage: petdeface.py [-h] [--anat_only] [--participant_label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]] [--docker] [--singularity] [--n_procs N_PROCS]
39+
[--skip_bids_validator] [--version] [--placement PLACEMENT] [--remove_existing] [--preview_pics]
40+
[--participant_label_exclude participant_label_exclude [participant_label_exclude ...]] [--session_label SESSION [SESSION ...]]
41+
[--session_label_exclude session_label_exclude [session_label_exclude ...]]
42+
bids_dir [output_dir] [analysis_level]
4343

4444
PetDeface
4545

4646
positional arguments:
47-
input_dir The directory with the input dataset
47+
bids_dir The directory with the input dataset
48+
output_dir The directory where the output files should be stored, if not supplied will default to <bids_dir>/derivatives/petdeface
49+
analysis_level This BIDS app always operates at the participant level, if this argument is changed it will be ignored and run as a participant level
50+
analysis
4851

4952
options:
5053
-h, --help show this help message and exit
51-
--output_dir OUTPUT_DIR, -o OUTPUT_DIR
52-
The directory where the output files should be stored
5354
--anat_only, -a Only deface anatomical images
54-
--subject SUBJECT, -s SUBJECT
55-
The label of the subject to be processed.
56-
--session SESSION, -ses SESSION
57-
The label of the session to be processed.
55+
--participant_label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...], -pl PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]
56+
The label(s) of the participant/subject to be processed. When specifying multiple subjects separate them with spaces.
5857
--docker, -d Run in docker container
5958
--singularity, -si Run in singularity container
6059
--n_procs N_PROCS Number of processors to use when running the workflow
6160
--skip_bids_validator
62-
--version, -v show programs version number and exit
61+
--version, -v show program's version number and exit
6362
--placement PLACEMENT, -p PLACEMENT
64-
Where to place the defaced images. Options are
65-
'adjacent': next to the input_dir (default) in a folder appended with _defaced
66-
'inplace': defaces the dataset in place, e.g. replaces faced PET and T1w images
67-
w/ defaced at input_dir
68-
'derivatives': does all of the defacing within the derivatives folder in input_dir.
69-
--remove_existing, -r Remove existing output files in output_dir.
70-
--excludesubject EXCLUDESUBJECT [EXCLUDESUBJECT ...]
71-
Exclude a subject(s) from the defacing workflow. e.g. --excludesubject sub-01 sub-02
63+
Where to place the defaced images. Options are 'adjacent': next to the bids_dir (default) in a folder appended with _defaced'inplace':
64+
defaces the dataset in place, e.g. replaces faced PET and T1w images w/ defaced at bids_dir'derivatives': does all of the defacing within
65+
the derivatives folder in bids_dir.
66+
--remove_existing, -r
67+
Remove existing output files in output_dir.
68+
--preview_pics Create preview pictures of defacing, defaults to false for docker
69+
--participant_label_exclude participant_label_exclude [participant_label_exclude ...]
70+
Exclude a subject(s) from the defacing workflow. e.g. --participant_label_exclude sub-01 sub-02
71+
--session_label SESSION [SESSION ...]
72+
Select only a specific session(s) to include in the defacing workflow
73+
--session_label_exclude session_label_exclude [session_label_exclude ...]
74+
Select a specific session(s) to exclude from the defacing workflow
7275
```
7376
7477
Working example usage:
7578
7679
```bash
77-
petdeface /inputfolder --output_dir /outputfolder --n_procs 16 --skip_bids_validator --placement adjacent
80+
petdeface /inputfolder /outputfolder --n_procs 16 --skip_bids_validator --placement adjacent
7881
```
7982
8083
### Docker Usage
@@ -107,7 +110,7 @@ docker run --user=$UID:$GID -a stderr -a stdout --rm \
107110
-v /Data/defaced_pet_data/:/output \
108111
-v /home/freesurfer/license.txt:/opt/freesurfer/license.txt \
109112
--platform linux/amd64 \
110-
petdeface:latest /input --output_dir /output --n_procs 16 --skip_bids_validator --placement adjacent --user=$UID:$GID system_platform=Linux
113+
petdeface:latest /input /output --n_procs 16 --skip_bids_validator --placement adjacent --user=$UID:$GID system_platform=Linux
111114
```
112115
113116
### Singularity Usage
@@ -127,7 +130,7 @@ Otherwise, one can run and execute petdeface with the same syntax as calling it
127130
with `singularity exec -e`
128131

129132
```bash
130-
singularity exec -e --bind license.txt:/opt/freesurfer/license.txt docker://openneuropet/petdeface:0.1.1 petdeface /input --output-dir /output --n_procs 10
133+
singularity exec -e --bind license.txt:/opt/freesurfer/license.txt docker://openneuropet/petdeface:0.1.1 petdeface /input /output --n_procs 10
131134
```
132135

133136
**_NOTE_**: Testing with singularity has been limited to version singularity-ce 4.2.0, please let us know in the issues section of this repo if you have

docs/usage.rst

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -81,40 +81,48 @@ When viewed, a succesfully defaced PET image will have varying intensities in th
8181

8282
The number of processors made available to PETdeface can be set by the `--n_procs` flag e.g.::
8383

84-
petdeface /inputfolder --output_dir /outputfolder --n_procs 4
84+
petdeface /inputfolder /outputfolder --n_procs 4
8585

8686
Additional options can be found in the help menu::
8787

8888
petdeface -h
89-
usage: petdeface [-h] [--output_dir OUTPUT_DIR] [--anat_only] [--subject SUBJECT] [--session SESSION] [--docker] [--n_procs N_PROCS] [--skip_bids_validator] [--version]
90-
[--placement PLACEMENT] [--remove_existing]
91-
input_dir
92-
93-
PetDeface
94-
95-
positional arguments:
96-
input_dir The directory with the input dataset
97-
98-
options:
99-
-h, --help show this help message and exit
100-
--output_dir OUTPUT_DIR, -o OUTPUT_DIR
101-
The directory where the output files should be stored
102-
--anat_only, -a Only deface anatomical images
103-
--subject SUBJECT, -s SUBJECT
104-
The label of the subject to be processed.
105-
--session SESSION, -ses SESSION
106-
The label of the session to be processed.
107-
--docker, -d Run in docker container
108-
--n_procs N_PROCS Number of processors to use when running the workflow
109-
--skip_bids_validator
110-
--version, -v show program's version number and exit
111-
--placement PLACEMENT, -p PLACEMENT
112-
Where to place the defaced images. Options are 'adjacent': next to the input_dir (default) in a folder appended with _defaced'inplace': defaces the dataset in place,
113-
e.g. replaces faced PET and T1w images w/ defaced at input_dir'derivatives': does all of the defacing within the derivatives folder in input_dir.
114-
--remove_existing, -r
115-
Remove existing output files in output_dir.
116-
--excludesubject EXCLUDESUBJECT [EXCLUDESUBJECT ...]
117-
Exclude a subject(s) from the defacing workflow. e.g. --excludesubject sub-01 sub-02
89+
usage: petdeface.py [-h] [--anat_only] [--participant_label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]] [--docker] [--singularity] [--n_procs N_PROCS]
90+
[--skip_bids_validator] [--version] [--placement PLACEMENT] [--remove_existing] [--preview_pics]
91+
[--participant_label_exclude participant_label_exclude [participant_label_exclude ...]] [--session_label SESSION [SESSION ...]]
92+
[--session_label_exclude session_label_exclude [session_label_exclude ...]]
93+
bids_dir [output_dir] [analysis_level]
94+
95+
PetDeface
96+
97+
positional arguments:
98+
bids_dir The directory with the input dataset
99+
output_dir The directory where the output files should be stored, if not supplied will default to <bids_dir>/derivatives/petdeface
100+
analysis_level This BIDS app always operates at the participant level, if this argument is changed it will be ignored and run as a participant level
101+
analysis
102+
103+
options:
104+
-h, --help show this help message and exit
105+
--anat_only, -a Only deface anatomical images
106+
--participant_label PARTICIPANT_LABEL [PARTICIPANT_LABEL ...], -pl PARTICIPANT_LABEL [PARTICIPANT_LABEL ...]
107+
The label(s) of the participant/subject to be processed. When specifying multiple subjects separate them with spaces.
108+
--docker, -d Run in docker container
109+
--singularity, -si Run in singularity container
110+
--n_procs N_PROCS Number of processors to use when running the workflow
111+
--skip_bids_validator
112+
--version, -v show program's version number and exit
113+
--placement PLACEMENT, -p PLACEMENT
114+
Where to place the defaced images. Options are 'adjacent': next to the bids_dir (default) in a folder appended with _defaced'inplace':
115+
defaces the dataset in place, e.g. replaces faced PET and T1w images w/ defaced at bids_dir'derivatives': does all of the defacing within
116+
the derivatives folder in bids_dir.
117+
--remove_existing, -r
118+
Remove existing output files in output_dir.
119+
--preview_pics Create preview pictures of defacing, defaults to false for docker
120+
--participant_label_exclude participant_label_exclude [participant_label_exclude ...]
121+
Exclude a subject(s) from the defacing workflow. e.g. --participant_label_exclude sub-01 sub-02
122+
--session_label SESSION [SESSION ...]
123+
Select only a specific session(s) to include in the defacing workflow
124+
--session_label_exclude session_label_exclude [session_label_exclude ...]
125+
Select a specific session(s) to exclude from the defacing workflow
118126

119127
Docker Based
120128
------------

0 commit comments

Comments
 (0)