T1 PREProcessing Pipeline (aka PyCAT)
Project description
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
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
- ~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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file t1prep-0.4.3.tar.gz.
File metadata
- Download URL: t1prep-0.4.3.tar.gz
- Upload date:
- Size: 34.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e01f5d4752a8e8b7661fffdf4391a0c7225c4ec31649cdcd1dbcf155decdb772
|
|
| MD5 |
4c53d81d57254aeaf87ef9f86e58b679
|
|
| BLAKE2b-256 |
c898d148c40199a292a18b08ba904aec3acd716350a5c92670328ae08fdb4f07
|
Provenance
The following attestation bundles were made for t1prep-0.4.3.tar.gz:
Publisher:
publish-pypi.yml on ChristianGaser/T1Prep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
t1prep-0.4.3.tar.gz -
Subject digest:
e01f5d4752a8e8b7661fffdf4391a0c7225c4ec31649cdcd1dbcf155decdb772 - Sigstore transparency entry: 1569193381
- Sigstore integration time:
-
Permalink:
ChristianGaser/T1Prep@4188e96899c596f0912e6e11f83c2f1333f88e40 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ChristianGaser
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@4188e96899c596f0912e6e11f83c2f1333f88e40 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file t1prep-0.4.3-py3-none-any.whl.
File metadata
- Download URL: t1prep-0.4.3-py3-none-any.whl
- Upload date:
- Size: 34.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac09b11817d3a56d142fdade2ef31e8e85f3c5c38d77f935e4c8af4ddc9522a7
|
|
| MD5 |
a33625681a4a1713ac319a3c901d2a24
|
|
| BLAKE2b-256 |
fedca72cf9661ad84dcc8cce5c4c53dd1638195ba5db35168c4f4e2ad0377b5a
|
Provenance
The following attestation bundles were made for t1prep-0.4.3-py3-none-any.whl:
Publisher:
publish-pypi.yml on ChristianGaser/T1Prep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
t1prep-0.4.3-py3-none-any.whl -
Subject digest:
ac09b11817d3a56d142fdade2ef31e8e85f3c5c38d77f935e4c8af4ddc9522a7 - Sigstore transparency entry: 1569193386
- Sigstore integration time:
-
Permalink:
ChristianGaser/T1Prep@4188e96899c596f0912e6e11f83c2f1333f88e40 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ChristianGaser
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@4188e96899c596f0912e6e11f83c2f1333f88e40 -
Trigger Event:
workflow_dispatch
-
Statement type: