Skip to content

Commit 0f49b78

Browse files
committed
update docs
1 parent b162471 commit 0f49b78

File tree

2 files changed

+48
-4
lines changed

2 files changed

+48
-4
lines changed

README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ This software can be installed via source or via pip from PyPi with `pip install
3636

3737
```bash
3838
usage: petdeface.py [-h] [--output_dir OUTPUT_DIR] [--anat_only]
39-
[--subject SUBJECT] [--session SESSION] [--docker]
40-
[--n_procs N_PROCS] [--skip_bids_validator] [--version]
41-
[--placement PLACEMENT] [--remove_existing] input_dir
39+
[--subject SUBJECT] [--session SESSION] [--docker]
40+
[--singularity] [--n_procs N_PROCS] [--skip_bids_validator]
41+
[--version] [--placement PLACEMENT] [--remove_existing]
42+
input_dir
4243

4344
PetDeface
4445

@@ -55,6 +56,7 @@ options:
5556
--session SESSION, -ses SESSION
5657
The label of the session to be processed.
5758
--docker, -d Run in docker container
59+
--singularity, -si Run in singularity container
5860
--n_procs N_PROCS Number of processors to use when running the workflow
5961
--skip_bids_validator
6062
--version, -v show programs version number and exit
@@ -106,6 +108,29 @@ docker run --user=$UID:$GID -a stderr -a stdout --rm \
106108
petdeface:latest /input --output_dir /output --n_procs 16 --skip_bids_validator --placement adjacent --user=$UID:$GID system_platform=Linux
107109
```
108110

111+
### Singularity Usage
112+
113+
Requirements:
114+
- Singularity must be installed
115+
- `openneuropet/petdeface` must be present or reachable at dockerhub
116+
117+
One can execute petdeface in singularity either directly via:
118+
119+
```bash
120+
singularity exec -e --bind license.txt:/opt/freesurfer/license.txt docker://openneuropet/petdeface:0.1.1 petdeface
121+
```
122+
123+
Input and Output directories don't need to be bound, but one does need to bind a freesurfer license to the image before they can proceed with defacing.
124+
Otherwise, one can run and execute petdeface with the same syntax as calling it from the command line, the only difference being that petdeface is prepended
125+
with `singularity exec -e`
126+
127+
```bash
128+
singularity exec -e --bind license.txt:/opt/freesurfer/license.txt docker://openneuropet/petdeface:0.1.1 petdeface /input --output-dir /output --n_procs 10
129+
```
130+
131+
**_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
132+
trouble running this container in singularity/apptainer.
133+
109134
## Development
110135

111136
This project uses poetry to package and build, to create a pip installable version of the package run:

docs/usage.rst

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,23 @@ One needs to create 3 bind mounts to the docker container when running PETdeface
145145
If one is running PETdeface on a linux machine and desires non-root execution of the container,
146146
the ``--user`` flag needs to be set to the UID and GID of the user running the container.
147147

148-
Of course all of the above is done automatically when running PETdeface using the ``--docker`` flag.
148+
Of course all of the above is done automatically when running PETdeface using the ``--docker`` flag.
149+
150+
Singularity Based
151+
-----------------
152+
153+
PETdeface can also be run using singularity, however one will need access to the internet/dockerhub as
154+
it relies on being able to retrieve the docker image from dockerhub. The syntax is as follows::
155+
156+
petdeface /inputfolder --output_dir /outputfolder --singularity
157+
158+
Running petdeface in singularity will generate then execute a singularity command that will pull the
159+
docker image from dockerhub and run the pipeline.
160+
161+
singularity exec -e --bind license.txt:/opt/freesurfer/license.txt docker://openneuropet/petdeface:latest petdeface /inputfolder --output_dir /outputfolder --n_procs 2 --placement adjacent
162+
163+
PETdeface will do it's best to locate a valid FreeSurfer license file on the host machine and bind it
164+
to the container by checking `FREESURFER_HOME` and `FREESURFER_LICENSE` environment variables. If you
165+
receive an error message relating to the FreeSurfer license file, try setting and exporting the
166+
`FREESURFER_LICENSE` environment variable to the location of the FreeSurfer license file on the host
167+
machine.

0 commit comments

Comments
 (0)