Skip to content

Commit

Permalink
Revised singularity documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kdiers committed Oct 16, 2024
1 parent 563376d commit 65b9d64
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions singularity/Singularity.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,17 @@ For how to create your own Docker images see our [Docker guide](../docker/Docker

## Using a Singularity image

After building the Singularity image, you need to register at the FreeSurfer website (https://surfer.nmr.mgh.harvard.edu/registration.html) to acquire a valid license (for free). If you already have an existing FreeSurfer installation, you can use the license file of that installation as well.

To run the shape and thickness analysis on a given subject using the Singularity image, execute the following command (after adjusting to your particular environment):

```bash
singularity exec \
-B /path/to/filename:/path_to_filename_inside_container \
-B /path/to/my/output/directory:/path_to_output_directory_inside_container \
/home/user/my_singularity_images/fsqc.sif \
python3 /app/fsqc/fsqc.py \
--filename /path_to_filename_inside_container/my_filename.mgz \
--outputdir /path_to_output_directory_inside_container \
--hemi HEMISPHERE \
--lut LOOKUP-TABLE \
--logfiledir /path_to_output_directory_inside_container
-B /path/to/subjects/directory:/data \
-B /path/to/subjects/directory:/out \
/home/user/my_singularity_images/fsqc-myimage.sif \
/app/fsqc/run_fsqc \
--subjects_dir /data \
--output_dir /out
```

* The first two `-B` arguments mount your data directory and output directories into the singularity image (note that full, not relative, pathnames should be given). Inside the image, they are visible under the name following the colon (in this case `/path_to_filename_inside_container` and `/path_to_output_directory_inside_container`, but these can be different). From within the singularity image / container, there will be read and write access to the directories that are mounted into the image (unless specified otherwise).
* The next part of the command is the name of the Singularity image, which is `fsqc.sif`. In this example it is located in `/home/user/my_singularity_images`, but the specific path will likely be different on your local system.
* For the Singularity image, we also have to explicitly specify the command that we want run, i.e. `python3 /app/fsqc/fsqc.py`.
* After that, all other flags are identical to the ones that are used for the `fsqc.py` program (which are explained on the main page and the help message of the program). Note that file- and pathnames need to correspond to the targets of the file / directory mappings within the singularity image, not to the local system.
* The next part of the command is the name of the Singularity image, which is `fsqc-myimage.sif` in this example, but can be freely chosen depending on what was set during the build process (see above). In this example, the image is located in `/home/user/my_singularity_images`, but the specific path will likely be different on your local system.
* For the Singularity image, we also have to explicitly specify the command that we want run, i.e. `python3 /app/fsqc/run_fsqc`.
* After that, all other flags are identical to the ones that are used for the `fsqc` program (which are explained on the main page and the help message of the program). That is, there can be more options than specified in this example command. Note that file- and pathnames need to correspond to the targets of the file / directory mappings within the singularity image, not to the local system.

0 comments on commit 65b9d64

Please sign in to comment.