Iguane on Biowulf

Iguane is a tool for harmonizing T1-weighted brain MRI scans so images collected under different conditions are more comparable. It works with compressed NIfTI files and includes tools for preprocessing, brain extraction, image registration, intensity normalization, cropping, and harmonization with a pretrained model. Iguane can process one image or a batch of images and can run on either CPUs or GPUs. It also includes code for training custom harmonization and prediction models.

Documentation
Important Notes

Interactive job
Interactive jobs should be used for debugging, graphics, or applications that cannot be run as batch jobs.

Allocate an interactive session and run the program.
Sample session (user input in bold):

[user@biowulf]$ sinteractive --gres=gpu:a100:1 --mem=32g --cpus-per-task=4
salloc.exe: Pending job allocation 46116226
salloc.exe: job 46116226 queued and waiting for resources
salloc.exe: job 46116226 has been allocated resources
salloc.exe: Granted job allocation 46116226
salloc.exe: Waiting for resource configuration
salloc.exe: Nodes cn3144 are ready for job

[user@cn3144 ~]$ module load iguane
[+] Loading iguane  9d6710c  on cn1069 
[+] Loading singularity  4.3.7  on cn1069 

[user@cn3144 ~]$ cd /data/$USER

[user@cn3144 ~]$ git clone https://github.com/RocaVincent/iguane_harmonization.git
Cloning into 'iguane_harmonization'...
remote: Enumerating objects: 124, done.
remote: Counting objects: 100% (124/124), done.
remote: Compressing objects: 100% (94/94), done.
remote: Total 124 (delta 50), reused 98 (delta 28), pack-reused 0 (from 0)
Receiving objects: 100% (124/124), 33.71 MiB | 26.89 MiB/s, done.
Resolving deltas: 100% (50/50), done.

[user@cn3144 ~]$ mkdir IGUANE_TEST
[user@cn3144 ~]$ cp iguane_harmonization/preprocessing/MNI152_T1_1mm_brain.nii.gz IGUANE_TEST/.

[user@cn3144 ~]$ iguane --in-mri IGUANE_TEST/MNI152_T1_1mm_brain.nii.gz --out-mri IGUANE_TEST/harmonized.nii.gz
mkdir: created directory 'preprocessing'
mkdir: created directory 'harmonization'
File: /tmp/96681561fd744f16acfc1341b8e3d703.nii.gz
preprocessing...
image shape after preprocessing:  (121, 145, 121)
prediction (CNN id)...
0
1
2
3
4
exporting segmentation...
End of execution, total processing time = 39 seconds

[user@cn3144 ~]$ exit
salloc.exe: Relinquishing job allocation 46116226
[user@biowulf ~]$

Batch job
Most jobs should be run as batch jobs.

Create a batch input file (e.g. iguane.sh). For example:

#!/bin/bash

module load iguane

cd /data/$USER

git clone https://github.com/RocaVincent/iguane_harmonization.git

mkdir IGUANE_TEST
cp iguane_harmonization/preprocessing/MNI152_T1_1mm_brain.nii.gz IGUANE_TEST/.

iguane --in-mri IGUANE_TEST/MNI152_T1_1mm_brain.nii.gz --out-mri IGUANE_TEST/harmonized.nii.gz

Submit this job using the Slurm sbatch command.

sbatch --partition=gpu --cpus-per-task=4 --mem=32g --gres=gpu:a100:1 iguane.sh
Swarm of Jobs
A swarm of jobs is an easy way to submit a set of independent commands requiring identical resources.

Create a swarmfile (e.g. iguane.swarm). For example:

iguane --in-mri IGUANE_TEST01/input01.nii.gz --out-mri IGUANE_TEST01/harmonized01.nii.gz
iguane --in-mri IGUANE_TEST02/input02.nii.gz --out-mri IGUANE_TEST02/harmonized01.nii.gz
iguane --in-mri IGUANE_TEST03/input03.nii.gz --out-mri IGUANE_TEST03/harmonized03.nii.gz

Submit this job using the swarm command.

swarm -g 32 -t 4 --partition=gpu --gres=gpu:a100:1 --module iguane iguane.swarm
where
-g # Number of Gigabytes of memory required for each process (1 line in the swarm command file)
-t # Number of threads/CPUs required for each process (1 line in the swarm command file).
--module iguane Loads the iguane module for each subjob in the swarm