Skip to content

A preprocessed freesurfer result plugin for MOC and HPC Clusters

License

Notifications You must be signed in to change notification settings

arashnh11/pl-freesurfer_pp_moc

 
 

Repository files navigation

pl-freesurfer_pp_moc

https://travis-ci.org/FNNDSC/freesurfer_pp_moc.svg?branch=master

freesurfer_pp_moc.py is a dummy FreeSurfer plugin / container that is prepopulated with the results of several a priori FreeSurfer runs. For a given run, this script will simply copy elements of one of these prior runs to the output directory.

python freesurfer_pp_moc.py                                         \
    [-v <level>] [--verbosity <level>]                          \
    [--version]                                                 \
    [--man]                                                     \
    [--meta]                                                    \
    [--copySpec <copySpec>]                                     \
    [--ageSpec <ageSpec>]                                       \
    <inputDir>                                                  \
    <outputDir>

This plugin can be run in three modes: 1. natively as a python package, suitable for standalone workstations 2. as a containerized docker image, suitable for openshift/kubernetes environments with relaxed sudo privillages 3. or as a containerized singularity image, suitable for HPC clusters/supercomputing centers with standard-user privillages

The PyPI mode is largely included for completeness sake and only useful if run against some pre-processed tree that exists in the filesystem.

You probably do not want to run the PyPI version unless you are a developer! Mostly likely you want the docker containerized run -- see the next section.

To run from PyPI, simply do a

pip install freesurfer_pp_moc

and run with

freesurfer.py --man /tmp /tmp

The real utility of this package is to run it containerized against bundled data that is packed into the container.

Assign an "input" directory to /incoming and an "output" directory to /outgoing. Note that the "input" directory is effectively ignored by this plugin, but is required. Make sure that the host $(pwd)/out directory is world writable!

In the simplest sense, the plugin can be run with

mkdir in out && chmod 777 out
docker run --rm -v $(pwd)/in:/incoming -v $(pwd)/out:/outgoing      \
        fnndsc/pl-freesurfer_pp_moc freesurfer_pp_moc.py                    \
        /incoming /outgoing

which will copy only the internal stats directory from a 10-yr/06-mo/01-da subject to the output. By specifying a --copySpec stats,3D,sag,cor,tra several additional directories containing png image frames through parcellated sagittal, coronal, and transverse (axial) planes as well as multiple 3D images are also copied.

This package can now run on multi-users HPC clusters and Supercomputing Centers using singularity (https://sylabs.io/). This will allow standard users to scale up the utility on HPC computing resources without the need for root/sudo privillages.

mkdir in out && chmod 777 out
singularity exec -C -B in:/incoming,out:/outgoing --pwd /usr/src/freesurfer_pp_moc \
        docker://fnndsc/pl-freesurfer_pp_moc python freesurfer_pp_moc.py \
        /incoming /outgoing

To get a listing of the internal tree of already processed and available FreeSurfer choices:

docker run --rm -v $(pwd)/in:/incoming -v $(pwd)/out:/outgoing      \
        fnndsc/pl-freesurfer_pp_moc freesurfer_pp_moc.py            \
        -T ../preprocessed                                          \
        /incoming /outgoing
singularity exec -C -B in:/incoming,out:/outgoing --pwd /usr/src/freesurfer_pp_moc \
        docker://fnndsc/pl-freesurfer_pp_moc python freesurfer_pp_moc.py        \
        -T ../preprocessed                                                      \
        /incoming /outgoing

This will print a tree of the available choices of preprocessed data in a directory tree.

Select one run, say the 08-yr/07-mo/16-da and specify that to copy:

docker run --rm -v $(pwd)/in:/incoming -v $(pwd)/out:/outgoing      \
        fnndsc/pl-freesurfer_pp_moc freesurfer_pp_moc.py            \
        -a 08-07-16 \
        /incoming /outgoing
singularity exec -C -B in:/incoming,out:/outgoing --pwd /usr/src/freesurfer_pp_moc \
        docker://fnndsc/pl-freesurfer_pp_moc python freesurfer_pp_moc.py \
        -a 08-07-16 \
        /incoming /outgoing

To simulate a processing delay, specify some time in seconds:

docker run --rm -v $(pwd)/in:/incoming -v $(pwd)/out:/outgoing      \
        fnndsc/pl-freesurfer_pp_moc freesurfer_pp_moc.py            \
        -a 08-07-16                                                 \
        -P 20                                                       \
        /incoming /outgoing
singularity exec -C -B in:/incoming,out:/outgoing --pwd /usr/src/freesurfer_pp_moc \
        docker://fnndsc/pl-freesurfer_pp_moc python freesurfer_pp_moc.py \
        -a 08-07-16 \
        -P 20 \
        /incoming /outgoing

To copy all the image directories from the 10-yr/06-mo/01-da subject,

docker run --rm -v $(pwd)/in:/incoming -v $(pwd)/out:/outgoing      \
        fnndsc/pl-freesurfer_pp_moc freesurfer_pp_moc.py            \
        -a 10-06-01                                                 \
        -c stats,sag,cor,tra,3D                                     \
        /incoming /outgoing
singularity exec -C -B in:/incoming,out:/outgoing --pwd /usr/src/freesurfer_pp_moc \
        docker://fnndsc/pl-freesurfer_pp_moc python freesurfer_pp_moc.py \
        -a 10-06-01 \
        -c stats,sag,cor,tra,3D \
        /incoming /outgoing

Sochat V, Prybol CJ, Kurtzer GM (2017) Enhancing reproducibility in scientific computing: Metrics and registry for Singularity containers. PLoS ONE 12(11): e0188511. https://doi.org/10.1371/journal.pone.0188511

About

A preprocessed freesurfer result plugin for MOC and HPC Clusters

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 84.9%
  • Shell 8.0%
  • Dockerfile 7.1%