Lesion Count
The Lesion Count pipeline provides two options to count the number of lesions present in MRI images using the "DworCount" method, developed by Dr. Jordan Dworkin and the connected components method.
Usage
The pipeline allows for three count options: DworCount (set --method dworcount), connected components (set --method cc), or both (default; set --method both).
This pipeline contains three stages: 1) Preparation: preprocesses and prepares data for lesion counting, 2) Count: counts number of lesions using specified method, 3) Consolidation: consolidates all participants’ results into a single .csv file.
This pipeline can be run with or without a container. For containerized usage, Singularity can be used on a cluster or Docker 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.
These examples will run the pipeline in batch mode on the cluster. To run individually or locally/with a container, set --mode individual, or -c local/-c singularity/-c docker, respectively.
Step 1. Preparation
This step processes raw T1 and T2-FLAIR images to prepare for lesion counting. By default, it runs bias correction, registration to FLAIR space, WhiteStripe normalization, and MIMoSA. For the DworCount method, confluent lesions are split and labeled. 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
--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
--method: cc, dworcount, both. Default is both
--step: step of pipeline - preparation, count, consolidation. Default is preparation
--mode: run pipeline individually or batch. Default is batch
-c or --container: which container to use: singularity, docker, local, cluster. Default is cluster
--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/lesion_count/code/bash/lesion_count.sh -m /path/to/data -t "*T1w*.nii.gz" -f "*FLAIR*.nii.gz" -s TRUE --toolpath /path/to/PennSIVE_neuro_pip
Step 2. Count
This step counts lesions based on connected components or DworCount method.
Required flags:
-m or --mainpath: path to parent data folder
--step: step of pipeline - preparation, count, consolidation. Default is preparation. This step is count
--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)
--method: cc, dworcount, both. Default is both
--mode: run pipeline individually or batch. Default is batch
-c or --container: which container to use: singularity, docker, local, cluster. Default is cluster
--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/lesion_count/code/bash/lesion_count.sh -m /path/to/data --step count --toolpath /path/to/PennSIVE_neuro_pip
Step 3. Consolidation
This step consolidates the lesion counts for all participants and sessions.
Required flags:
-m or --mainpath: path to parent data folder
--step: step of pipeline - preparation, count, consolidation. Default is preparation. This step is consolidation
--toolpath: path to pipeline folder
Other flags:
--method: cc, dworcount, both. Default is both
-c or --container: which container to use: singularity, docker, local, cluster. Default is cluster
--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/lesion_count/code/bash/lesion_count.sh -m /path/to/data --step consolidation --toolpath /path/to/PennSIVE_neuro_pip