Skip to main content

Python 3.9 - 3.12 License: Apache 2.0 Release

Note: This project is still in development and may contain bugs. Please report issues if you encounter problems.

T1Prep: T1 PREProcessing Pipeline (aka PyCAT)

T1Prep is a Python pipeline for preprocessing and segmenting T1-weighted MRI data. It supports:

  • Bias-field correction and denoising
  • Brain extraction (skull stripping)
  • Tissue segmentation (GM, WM, CSF)
  • Cortical surface reconstruction and thickness estimation
  • Non-linear spatial registration to MNI152 space
  • Atlas-based ROI extraction
  • White matter hyperintensity (WMH/lesion) detection
  • BIDS derivatives output naming

Cortical surface reconstruction uses the cat-surf Python package (pure Python bindings to the CAT-Surface C library — no compiled binaries required).

For full documentation, CLI usage, Docker instructions, and helper scripts see the GitHub repository.


Installation

pip install T1Prep

Multiple Python versions? Install with the exact interpreter you will run T1Prep with, e.g. python3.12 -m pip install T1Prep (requires Python 3.9–3.12; on macOS prefer 3.10+, since a 3.9 install is pinned to PyTorch 2.8 and runs slower). If the wrong interpreter is auto-detected, point T1Prep at the right one with T1Prep --python /path/to/python … or export T1PREP_PYTHON=/path/to/python. pipx install T1Prep or a dedicated venv avoids the ambiguity.

pip install places every entry point into the active environment's bin/ directory. With that directory on your PATH (e.g. an activated venv) the following commands are available:

Command Role
T1Prep main CLI — batch + parallel processing (--multi)
t1prep-ui browser-based web UI
t1prep-run single-subject Python entry
CAT_SurfView surface viewer
t1prep-download-models fetch model weights

Download model weights

Model weights are not bundled in the wheel (they are ~500 MB). Download them after installation:

t1prep-download-models

Models are stored alongside the deepmriprep package data and are downloaded automatically on first pipeline use if this step is skipped.


Requirements

  • Python 3.9–3.12 (3.10+ recommended). PyTorch 2.9+ (Python 3.10+) adds MPS kernels that give a measurable speed-up on Apple Silicon (2:39 min vs 3:02 min per subject); a Python 3.9 install is pinned to PyTorch 2.8 and falls back to the CPU for those kernels. On Linux/CUDA/CPU both stacks perform the same.
  • ~2 GB disk space for model weights (downloaded separately, see above)
  • For GPU acceleration: CUDA-capable GPU or Apple Silicon (MPS)

Python API

from t1prep import run_t1prep

# Single file — results saved next to input
run_t1prep("/data/sub-01_T1w.nii.gz")

# Single file, BIDS-compatible output
run_t1prep("/data/sub-01/ses-1/anat/sub-01_ses-1_T1w.nii.gz", bids=True)

# Batch processing with options
run_t1prep(
    ["/data/T1/sub-01.nii.gz", "/data/T1/sub-02.nii.gz"],
    out_dir="/results",
    atlas=["neuromorphometrics", "suit"],
    multi=-1,          # auto-detect parallelism
    wp=True,           # save warped segmentations
    p=True,            # save native segmentations
    csf=True,          # save CSF segmentation
    lesions=True,      # save WMH lesion map
    gz=True,           # compress outputs (.nii.gz)
    stream_output=True,
    log_file="/results/T1Prep_run.log",
)

Key parameters

Parameter Type Description
files str or list[str] Input NIfTI file(s)
out_dir str Output directory (default: same as input)
atlas list[str] Atlas names for ROI extraction
surf bool Run cortical surface estimation (default: True)
multi int Parallel workers; -1 = auto (default: 1)
bids bool Use BIDS derivatives naming
gz bool Save compressed NIfTI (.nii.gz)
wp bool Save warped (MNI space) segmentations
p bool Save native space segmentations
csf bool Save CSF segmentation
lesions bool Save WMH/lesion map
amap bool Use AMAP segmentation (CAT12-style)
skullstrip_only bool Only run skull stripping then exit
skip_skullstrip bool Skip skull stripping (pre-stripped input)

Output structure

Non-BIDS (default): subfolders mri/, surf/, report/, label/ in the output directory, with CAT12-compatible filenames (e.g., mwp1sub-01.nii, lh.thickness.sub-01).

BIDS (with bids=True): BIDS derivatives layout <out_dir>/derivatives/T1Prep-v<version>/sub-XX/ses-YY/anat/.


License

Distributed under the Apache License 2.0.

Download files

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

Source Distribution

t1prep-0.5.6.tar.gz (34.8 MB view details)

Uploaded Source

Built Distribution

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

t1prep-0.5.6-py3-none-any.whl (34.7 MB view details)

Uploaded Python 3

File details

Details for the file t1prep-0.5.6.tar.gz.

File metadata

  • Download URL: t1prep-0.5.6.tar.gz
  • Upload date:
  • Size: 34.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for t1prep-0.5.6.tar.gz
Algorithm Hash digest
SHA256 d25e94f850f06f15336194965f5c8db537a00ec2027fd2de8f62d8d4a5311f2c
MD5 adc1968d524d096349c99c0593702930
BLAKE2b-256 f6c36269a75d562691ce5e7194f230f4ef7f662d954f4f51006f22728322f4b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for t1prep-0.5.6.tar.gz:

Publisher: publish-pypi.yml on ChristianGaser/T1Prep

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

File details

Details for the file t1prep-0.5.6-py3-none-any.whl.

File metadata

  • Download URL: t1prep-0.5.6-py3-none-any.whl
  • Upload date:
  • Size: 34.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for t1prep-0.5.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9a44e1ddb79be7ca7faa3e54d503bafa00ac8d97c343944caa22ceb09f103032
MD5 de76e830175c5297cf62079564184d9d
BLAKE2b-256 b5e9ebed837d813335c4f00a2e220427777044064ade64d977a1adfe1bc448be

See more details on using hashes here.

Provenance

The following attestation bundles were made for t1prep-0.5.6-py3-none-any.whl:

Publisher: publish-pypi.yml on ChristianGaser/T1Prep

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

Release history Release notifications | RSS feed

0.7.1

2 files

0.7.0

2 files

0.6.2

2 files

0.6.0

2 files

0.5.9

2 files

0.5.7

2 files

This release

0.5.6 This release

2 files

0.5.5

2 files

0.5.4

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.4.7

2 files

0.4.6

2 files

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.9

2 files

0.3.8

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page