Skip to main content

CRASHS: Cortical Reconstruction for Automated Segmentation of Hippocampal Subfields (ASHS)

Project description

CRASHS: Cortical Reconstruction for Automatic Segmentation of Hippocampal Subfields (ASHS)

CRASHS is a surface-based modeling and groupwise registration pipeline for the human medial temporal lobe (MTL). It can be used to perform groupwise analysis of pointwise measures in the MTL, such as cortical thickness, longitudinal volume change, functional MRI activation, microstructure, etc. It uses similar principles to whole-brain surface-based analysis pipelines like FreeSurfer and CRUISE, but restricted to the MTL region. CRASHS is used to postprocess the results of ASHS segmentation with certain ASHS atlases.

Some of the newer ASHS atlases include the white matter label, which is used by CRASHS. For other ASHS atlases, CRASHS can paint in the white matter label using nnU-Net. CRASHS uses the CRUISE technique implemented in the NighRes software to fit the white matter segmentation with a surface of spherical topology, and find a series of surfaces spanning between the gray/white boundary and the pial surface. The middle surface is inflated and registered to a population template, allowing surface-based analysis of MTL cortical thickness and other measures such as functional MRI and diffusion MRI.

The CRASHS pipeline is described in the supplemental material to our paper in the special issue of Alzheimer's and Dementia on the 20th anniversary of ADNI.

Installation using pip

CRASHS requires the nighres package, which cannot be installed with pip. To install nighres, please follow the installation instructions. To our knowledge, the ARM64 architecture (newer Macs) is currently not supported.

Once nighres is installed, you can install CRASHS:

pip install crashs
python3 -m crashs fit --help

Or, if you want to use the latest development code and install in "editable" mode:

git clone https://github.com/pyushkevich/crashs
pip install -e ./crashs

Installation using Docker

The CRASHS Docker container is available on DockerHub as pyushkevich/crashs:latest. Use the command below to download the container.

docker pull pyushkevich/crashs:latest

If you are using newer Mac with the ARM processor, you may need to use the -platform flag to download the container:

docker pull --platform linux/amd64 pyushkevich/crashs:latest

Downloading CRASHS Templates and Models

Before using CRASHS, you will need to download the templates and pretrained models from this link:

Download and extract the archive and set the environment variable CRASHS_DATA to point to the folder in which you extract the archive.

cp ~/Downloads/crashs_template_package_20240830.tgz /my/crashs/folder
cd /my/crashs/folder
tar -zxvf crashs_template_package_20240830.tgz
export CRASHS_DATA=/my/crashs/folder/crashs_template_package_20240830

We recommend adding the line above that sets the CRASHS_DATA environment variable to your .bashrc, .bash_profile or .zshrc file, depending on what shell you use. Alternatively, you can invoke CRASHS below with the -C switch to provide the path to the templates and models directory.

Inputs to CRASHS

The main input to the package is the ASHS output folder. Before running CRASHS, you will need to run ASHS on your MRI scans using one of the atlases for which a CRASHS template is available.

CRASHS offers different templates for different ASHS versions. Currently, the following templates are provided:

  • ashs_pmc_t1: Template for the T1-weighted MRI version of ASHS T1-ASHS using the ASHS-PMC-T1 atlas. We recommend using the 2023 ASHS-PMC-T1 atlas with the white matter label. However, you can also provide segmentations created using the original ASHS-PMC-T1 atlas and the white matter label will be added to the existing segmentation automatically, using nnUNet.

  • ashs_pmc_alveus: Template for the high-resolution oblique coronal T2-weighted MRI version of ASHS. This template should be used with the ASHS PMC atlas. The white matter label will be added to the existing segmentation and extended synthetically over the alveus/fimbria, as described in our ADNI 20th anniversary paper.

Running CRASHS on a sample dataset

A sample dataset is included in the sample_data folder in the repository. Download it to some folder on your system (we will use /my/crashs/folder/sample_data for this tutorial).

Instructions for Docker

If using Docker, run the following command to open a command prompt on the container (change /my/crashs/folder to the right folder).

docker run \
    -v your_output_directory:/data \
    -v /my/crashs/folder/crashs_template_package_20240830:/package \
    -v /my/crashs/folder/sample_data:/data \
    -it pyushkevich/crashs:latest /bin/bash

Run this command inside of the container to run CRASHS on the example T1-ASHS segmentation.

python3 -m crashs fit \
    -C /package -s right -c corr_usegray \
    /sample_data/ashs_pmc_t1/subj01/ashs ashs_pmc_t1 /sample_data/ashs_pmc_t1/subj01/crashs

You should find the output from running CRASHS in folder /my/crashs/folder/sample_data/ashs_pmc_t1/subj01 on your system.

Instructions for pip install

If using CRASHS installed with pip and the CRASHS_DATA environment variable has been set as explained above, use the command below to run CRASHS on the on the example T1-ASHS segmentation:

python3 -m crashs fit \
    -s right -c corr_usegray \
    /my/crashs/folder/sample_data/ashs_pmc_t1/subj01/ashs \
    ashs_pmc_t1 \
    /my/crashs/folder/sample_data/ashs_pmc_t1/subj01/crashs

You should find the output from running CRASHS in folder /my/crashs/folder/sample_data/ashs_pmc_t1/subj01/crashs.

Outputs from CRASHS

The program generates many outputs, but the most useful ones are:

  • fitting/[ID]_fitted_omt_hw_target.vtk: the grey/white and grey/csf boundaries estimated by the cruise_cortex_extraction module of NighRes. These meshes are in physical (RAS) coordinate space, not in voxel (IJK) space output by Nighres. If you extract meshes from the T1-ASHS segmentation in ITK-SNAP, those should line up with these meshes.

  • fitting/[ID]_fitted_omt_hw_target.vtk: the mid-surface of the gray matter estimated by the volumetric_layering module of NighRes. Also in RAS space.

  • fitting/[ID]_fitted_omt_match_to_hw.vtk: the template mesh projected onto the mid-surface surface, also in RAS space. This should have the same geometry as the mid-surface, but the same number of vertices/faces as the template. This mesh will also have scalar arrays for the anatomical label and other features from the template, such as template curvature (useful for visualization). This mesh can be used to map data from subject space (thickness, fMRI, NODDI, etc) into template space for group analysis

  • thickness/[ID]_template_thickness.vtk: a mesh with same geometry as the template that has a point array VoronoiRadius containing half-thickness of the gray matter at each vertex.

  • thickness/[ID]_thickness_roi_summary.csv: Mean and median half-thickness across gray matter ROIs.

The following files can be used to check how well the fitting between the inflated template mid-surface and the inflated subject mid-surface worked.

  • fitting/[ID]_fit_target_reduced.vtk: this is the inflated and sub-sampled mid-surface mesh of the subject, affine transformed into the space of the inflated template. Each triangle is associated with an anatomical label.

  • fitting/[ID]_fitted_lddmm_template.vtk: this is the inflated template warped to optimally match the mesh above. The fit is not perfect but should be close.

  • fitting/[ID]_fitted_dist_stat.json: distance statistics of the fitting, including average, max, and 95th percentile of the distance. Useful to check for poor fitting results.

Citation

  • PA Yushkevich, L Xie, LEM Wisse, M Dong, S Ravikumar, R Ittyerah, R de Flores, SR Das, DA Wolk for the Alzheimer’s Disease Neuroimaging Initiative (ADNI), Mapping Medial Temporal Lobe Longitudinal Change in Preclinical Alzheimer’s Disease, 2023 Alzheimer's Association International Conference (AAIC 2023).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crashs-0.2.7.tar.gz (720.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crashs-0.2.7-py3-none-any.whl (58.5 kB view details)

Uploaded Python 3

File details

Details for the file crashs-0.2.7.tar.gz.

File metadata

  • Download URL: crashs-0.2.7.tar.gz
  • Upload date:
  • Size: 720.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for crashs-0.2.7.tar.gz
Algorithm Hash digest
SHA256 8d957dddbc448bdc28c6bdccc263263ea90997e7777d0f5e6faf88d9d2f13983
MD5 aafd9d05b851adf6d42415de346a47a7
BLAKE2b-256 b631cefd130d55d75f6e5fafc8d14f3f3d28217f87c6ab080058c06958ed57f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for crashs-0.2.7.tar.gz:

Publisher: python-publish.yml on pyushkevich/crashs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file crashs-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: crashs-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 58.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for crashs-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f7898b268510a1ae912de08eeaaad46f43bd2a9f6861372ffc05dbecd053a53c
MD5 51430fae8052aa4216eaf3373d4c9057
BLAKE2b-256 9e2b6b71b6a5b6d50663bb351a37bba97f4c2c2d55e78e0705019e3bd08b7f5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for crashs-0.2.7-py3-none-any.whl:

Publisher: python-publish.yml on pyushkevich/crashs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page