Skip to content
By Elizabeth Horwath · Last updated 2026-08-27

ALPaCA

The ALPaCA pipeline (Automated Lesion, PRL, and CVS Analysis) applies an deep learning method for white matter lesion, PRL, and CVS segmentation, developed by Dr. Fengling Hu. It provides processed T1-weighted, T2-FLAIR, T2star-magnitude, and T2star-phase images, as well lesion, CVS, and PRL masks and lesion-level probabilities.

Usage

This pipeline contains two stages: 1) Estimation: preprocesses images and calculates lesion-level lesion, CVS, and PRL probabilities, and 2) Consolidation: consolidates all participants' results.

This pipeline can only be run with a container. Singularity/Apptainer can be used on a cluster or Docker can be used locally. This pipeline can be run in individual or batch mode, meaning you can specify a certain subject and session or run the pipeline for all subjects in the folder, respectively. Please pull the container below corresponding to your system requirements:

AMD, CPU: russellshinohara/pennsive_amd64_cputorch:v1.2
AMD, GPU: russellshinohara/pennsive_amd64_gputorch:v1.2
ARM, CPU: russellshinohara/pennsive_arm64_cputorch:v1.2

These examples will run the pipeline in batch mode on with Singularity/Apptainer. To run individually or with docker, set --mode individual, or -c docker, respectively. Only Step 1 has the option of individual or batch; Step 2 will always run in batch mode.


Step 1. Estimation

This step processes raw T1, T2-FLAIR, T2star-magnitude, and T2star-phase images images to prepare for CVS probability calculation. By default, it runs bias correction, registration to EPI space, WhiteStripe normalization, MIMoSA, splitting confluent lesions, and a 3D patch convolutional neural network (CNN) to compute lesion, PRL, and CVS probabilities. Skullstripping can be turned on if input images contain non-brain tissue.


Required flags:

-m or --mainpath: path to parent data folder
-t or --t1: T1 sequence name
-f or --flair: FLAIR sequence name
-ema or --epimag: EPI magnitude image name
-eph or --epiphase: unwrapped EPI phase image name
-c or --container: which container to use: singularity or docker
--toolpath: path to pipeline folder

Other flags:

-p or --participant: participant ID (only needed for individual mode)
--ses: session ID (only needed for individual mode)
-n or --n4: run N4 bias correction. Default is TRUE
-s or --skullstripping: run skullstripping. Default is FALSE
-r or --registration: run registration. Default is TRUE
-w or --whitestripe: run WhiteStripe normalization. Default is TRUE
--mimosa: run MIMoSA segmentation. Default is TRUE
--threshold: threshold for generating MIMoSA mask. Default is 0.2
--step: step of pipeline - estimation, consolidation. Default is estimation
--mode: run pipeline individually or batch. Default is batch
--sinpath: path to singularity image (only needed if using singularity container - don't need to specify if using takim cluster)
--dockerpath: path to docker image (only needed if using docker container)
--dockermem: memory and swap allocated to docker image (optional if using docker container)
--hdbetpath: path to HD-BET binary (default: /opt/fsl-6.0.7.19/bin/hd-bet)
-h or --help: show help message

bash /path/to/PennSIVE_neuro_pip/pipelines/alpaca/alpaca.sh -m /path/to/data -t "*_T1w.nii.gz" -f "*_FLAIR.nii.gz" -ema "*_part-mag_T2star.nii.gz" -eph "*_part-phase_T2star_UNWRAPPED.nii.gz" -s TRUE -c singularity --toolpath /path/to/PennSIVE_neuro_pip

Step 2. Consolidation

This step consolidates the lesion, CVS, and PRL probability results for all participants and sessions.


Required flags:

-m or --mainpath: path to parent data folder
--step: step of pipeline - estimation, consolidation. Default is estimation. This step is consolidation
-c or --container: which container to use: singularity or docker
--toolpath: path to pipeline folder

Other flags:

--sinpath: path to singularity image (only needed if using singularity container - don't need to specify if using takim cluster)
--dockerpath: path to docker image (only needed if using docker container)
-h or --help: show help message

bash /path/to/PennSIVE_neuro_pip/pipelines/alpaca/alpaca.sh -m /path/to/data --step consolidation -c singularity --toolpath /path/to/PennSIVE_neuro_pip