Quick test

Download datasets

$ cd /path/to/data

$ curl https://amubox.univ-amu.fr/public.php/dav/files/CoSC5w5ATZextme --output macapype_CI_v2.1.zip

$ unzip -o macapype_CI_v2.1.zip -d macapype_CI_v2.1

Testing depending on the installation

Testing from Singularity image

$ singularity run -B /path/to/data:/data /path/to/containers/macapype_v0.6.sif segment_pnh -data /data/macapype_CI_v2.1/cerimed_marmo -out /data/macapype_CI_v2.1/cerimed_marmo/results -soft ANTS_robustreg_test -species marmo -sub Tresor -ses 01 -deriv -padback -dt T1 T2

$ singularity run -B /path/to/data:/data /path/to/containers/macapype_v0.6.sif segment_pnh -data /data/macapype_CI_v2.1/cerimed_marmo -out /data/macapype_CI_v2.1/cerimed_marmo/results -soft ANTS_robustreg_prep -species marmo -sub Tresor -ses 01 -deriv -padback -dt T1 T2

$ singularity run -B /path/to/data:/data /path/to/containers/macapype_v0.6.sif segment_pnh -data /data/macapype_CI_v2.1/cerimed_marmo -out /data/macapype_CI_v2.1/cerimed_marmo/results -soft ANTS_robustreg_noseg -species marmo -sub Tresor -ses 01 -deriv -padback -dt T1 T2

$ singularity run -B /path/to/data:/data /path/to/containers/macapype_v0.6.sif segment_pnh -data /data/macapype_CI_v2.1/cerimed_marmo -out /data/macapype_CI_v2.1/cerimed_marmo/results -soft ANTS_robustreg -species marmo -sub Tresor -ses 01 -deriv -padback -dt T1 T2

The 4 commands earlier corresponds to brain segmentation performed on an example of marmoset (Tresor) . The 4 steps corresponds to incremental processings, and can performed in the given order. It is possible to test directly the last command (with -soft ANTS), but the caching system of nipype should work and the previous steps will not be performed again.

  • The first one (-soft ANTS_test) is to test the workflow graph. If it works, the representation graph of the pipeline is available as:

/path/to/data/macapype_CI_v2.1/cerimed_marmo/results/macapype_ants/graph.png
  • The second one (-soft ANTS_prep) is to run data preparation pipeline (corresponding to preprocessing). If it works, you should be able to see the data after automated croping and alignement in the template space:

/path/to/data/macapype_CI_v2.1/cerimed_marmo/results/derivatives/macapype_ants/sub-Tresor/ses-01/anat/sub-Tresor_ses-01_space-stereo_T1w.nii.gz
  • The third one (-soft ANTS_noseg) will perform brain extraction and stop afterward. This is normally the longest step (ranging from 45min to a few hours depending on the image resolution. If it works, you should be able to see the brain mask as :

/path/to/data/macapype_CI_v2.1/cerimed_marmo/results/derivatives/macapype_ants/sub-Tresor/ses-01/anat/sub-Tresor_ses-01_space-stereo_desc-brain_mask.nii.gz
  • The fourth and last one (-soft ANTS) will perform brain segmentation and mesh. If it works, you should be able to see the brain segmented mask and brain mesh as :

/path/to/data/macapype_CI_v2.1/cerimed_marmo/results/derivatives/macapype_ants/sub-Tresor/ses-01/anat/sub-Tresor_ses-01_space-stereo_desc-brain_desc-desg_mask.nii.gz

Testing from docker image

For testing the docker installation, the beginning of the commands should be replaced by docker run -v /path/to/data:/data macatools/macapype:v0.6, e.g.

$ docker run -v /path/to/data:/data macatools/macapype:v0.6 segment_pnh -data /data/macapype_CI_v2.1/cerimed_marmo -out /data/macapype_CI_v2.1/cerimed_marmo/results -soft ANTS_robustreg -species marmo -sub Tresor -ses 01 -deriv -padback -dt T1 T2

Testing from python package install

From pip install

$ segment_pnh -data /path/to/data/macapype_CI_v2.1/cerimed_marmo -out /path/to/data/macapype_CI_v2.1/cerimed_marmo/results -soft ANTS_robustreg -species marmo -sub Tresor -ses 01 -deriv -padback -dt T1 T2

From github install

$ python workflows/segment_pnh.py -data /path/to/data/macapype_CI_v2.1/cerimed_marmo -out /path/to/data/macapype_CI_v2.1/cerimed_marmo/results -soft ANTS_robustreg -species marmo -sub Tresor -ses 01 -deriv -padback -dt T1 T2

Note the /path/to/data instead of /data (as in the container install) in the arguments

Testing the macaque and baboon datasets

Two other datasets, corresponding to one macaque and one baboon, are available in the test dataset. Please not that due to higher image resolution, the preprocessing will take a longer time.

baboon is for adult template

$ singularity run -B /path/to/data/:/data /path/to/containers/macapype_v0.6.sif segment_pnh -data /data/macapype_CI_v2.1/cerimed_baboon -out /data/macapype_CI_v2.1/cerimed_baboon/results_adult -soft ANTS -species baboon -sub Prune -ses 3 -deriv -padback -dt T1 T2  -indiv /data/cerimed_baboon/indiv_params_segment_baboon.json

baboon0, baboon1, baboon2 baboon3 can be used for template Baba21 and matching ages

$ singularity run -B /path/to/data/:/data /path/to/containers/macapype_v0.6.sif segment_pnh -data /data/macapype_CI_v2.1/cerimed_baboon -out /data/macapype_CI_v2.1/cerimed_baboon/results_all_ages -soft ANTS -species baboon3 -sub Prune -ses 3 -deriv -padback -dt T1 T2  -indiv /data/cerimed_baboon/indiv_params_segment_baboon.json

$ singularity run -B /path/to/data/:/data /path/to/containers/macapype_v0.6.sif segment_pnh -data /data/macapype_CI_v2.1/cerimed_baboon -out /data/macapype_CI_v2.1/cerimed_baboon/results_all_ages -soft ANTS -species baboon2 -sub Prune -ses 2 -deriv -padback -dt T1 T2  -indiv /data/cerimed_baboon/indiv_params_segment_baboon.json

$ singularity run -B /path/to/data/:/data /path/to/containers/macapype_v0.6.sif segment_pnh -data /data/macapype_CI_v2.1/cerimed_baboon -out /data/macapype_CI_v2.1/cerimed_baboon/results_all_ages -soft ANTS -species baboon1 -sub Prune -ses 1 -deriv -padback -dt T1 T2  -indiv /data/cerimed_baboon/indiv_params_segment_baboon.json

$ singularity run -B /path/to/data/:/data /path/to/containers/macapype_v0.6.sif segment_pnh -data /data/macapype_CI_v2.1/cerimed_baboon -out /data/macapype_CI_v2.1/cerimed_baboon/results_all_ages -soft ANTS -species baboon0 -sub Prune -ses 0 -deriv -padback -dt T1 T2  -indiv /data/cerimed_baboon/indiv_params_segment_baboon.json
$ singularity run -B /path/to/data/:/data /path/to/containers/macapype_v0.6.sif segment_pnh -data segment_pnh -data /data/macapype_CI_v2.1/cerimed_macaque -out /data/macapype_CI_v2.1/cerimed_macaque/results -soft ANTS_robustreg -sub Stevie -ses 01 -deriv -padback -dt T1 T2 -species macaque

Testing different pipelines and options

Some options can be added to -soft and/or -species for faster and less precise computations, like -soft ANTS_4animal for a faster version of brain extraction using FSL bet4animal, or -species macaque_0p5 to use donwsampled version of the template, or a combination of both options:

$ singularity run -B /path/to/data/:/data /path/to/containers/macapype_v0.6.sif segment_pnh -data segment_pnh -data /data/macapype_CI_v2.1/cerimed_macaque -out /data/macapype_CI_v2.1/cerimed_macaque/results_0p5 -soft ANTS_robustreg -sub Stevie -ses 01 -deriv -padback -dt T1 T2 -species macaque_0p5
$ singularity run -B /path/to/data/:/data /path/to/containers/macapype_v0.6.sif segment_pnh -data segment_pnh -data /data/macapype_CI_v2.1/cerimed_macaque -out /data/macapype_CI_v2.1/cerimed_macaque/results -soft ANTS_4animal_robustreg -sub Stevie -ses 01 -deriv -padback -dt T1 T2 -species macaque
$ singularity run -B /path/to/data/:/data /path/to/containers/macapype_v0.6.sif segment_pnh -data segment_pnh -data /data/macapype_CI_v2.1/cerimed_macaque -out /data/macapype_CI_v2.1/cerimed_macaque/results_0p5 -soft ANTS_4animal_robustreg -sub Stevie -ses 01 -deriv -padback -dt T1 T2 -species macaque_0p5

It is also possible to run the pipeline with only T1w available with -dt T1 (instead of -dt T1 T2 previously).

$ singularity run -B /path/to/data/:/data /path/to/containers/macapype_v0.6.sif segment_pnh -data segment_pnh -data /data/macapype_CI_v2.1/cerimed_macaque -out /data/macapype_CI_v2.1/cerimed_macaque/results -soft ANTS_robustreg -sub Stevie -ses 01 -deriv -padback -dt T1 -species macaque

Please see Commands for further information on the parameters available for command line