Languages: English | 日本語 (Japanese)
RCLM: Region / ROI Change-conditioned Longitudinal Morphing
Subject-specific simulation of future brain MRI from a baseline T1 scan.
RCLM is an inference-only package. Given a skull-stripped baseline T1 and clinical conditions (sex, age, elapsed years, and optionally ROI volume change ratios), it predicts a future brain MRI via a latent deformation field.
Typical workflow:
- Skull-strip the T1 (recommended: OpenMAP-T1)
- Register to MNI (
template/MNI_FULL.nii.gz) withsrc/register.pyor--registerif needed - Place weights under
model/(rclm.pth,args.json) - Run
src/inference.pywith--sex,--age,--years(and optional--vcr-*) - Find the simulated future MRI under the output folder
RCLM expects skull-stripped T1-weighted MRI. We recommend running OpenMAP-T1 for skull stripping (and related preprocessing) before RCLM.
Images must also be aligned to the MNI template (template/MNI_FULL.nii.gz). Registration is required for native-space inputs; this repository provides ANTsPy TRSAA registration via src/register.py and the --register flag.
- Python 3.11+
- PyTorch 2.2+ (installed by
uv sync; install separately when using pip) - nibabel, numpy, scipy, tqdm
- Optional: ANTsPy (
antspyx) for MNI registration
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
cd RCLM
uv syncFor MNI registration (ANTsPy):
uv sync --extra registerpython -m venv .venv
source .venv/bin/activate
# https://pytorch.org/
pip install -r requirements.txt
pip install torch
pip install "antspyx>=0.6.3" # optional, for registrationmodel/
rclm.pth # pretrained weights
args.json # inference hyperparameters
template/
MNI_FULL.nii.gz # MNI template (required for registration)
--sex, --age, and --years are required. If no --vcr-* options are set, RCLM runs without VCR conditioning (rates = 0, flag = 0). To enable VCR, set all four --vcr-* options.
uv run python src/inference.py -i input -o output -m model \
--sex F --age 70 --years 5| Index | Content |
|---|---|
| 0 | Sex (F=0 / M=1) |
| 1 | Age / 100 |
| 2 | Elapsed years / max_delta_years (≈ 14.54 from training) |
| 3–6 | ICV-relative volume change rates for LateralVentricle, Amyg, Hippo, SylvianFissureExt |
| 7 | VCR availability flag (1 when used, 0 otherwise) |
Volume change ratio (VCR):
where --vcr-* values are total change over --years (not annual rates). All four --vcr-* options must be set to enable VCR conditioning; omitting all of them runs without VCR.
Set all ROIs (required for VCR-on):
uv run python src/inference.py -i input -o output -m model \
--sex F --age 70 --years 5 \
--vcr-lateral-ventricle 0.2 \
--vcr-amyg -0.05 \
--vcr-hippo -0.04 \
--vcr-sylvian 0.15Disable VCR (omit all --vcr-*, or use --no-roi-change):
uv run python src/inference.py -i input -o output -m model \
--sex F --age 70 --years 5 --no-roi-changetrsaa corresponds to ANTsPy type_of_transform="TRSAA"
(Translation → Rigid → Similarity → Affine → Affine).
uv sync --extra register
# Registration only
uv run python src/register.py -i input_native -o output
# Register, then run RCLM
uv run python src/inference.py -i input_native -o output -m model \
--sex F --age 70 --years 5 --registerOptional registration flags: -t / --mni, --reg-iterations, --save-transforms, --verbose.
| Argument | Description |
|---|---|
-i |
Input folder or a single NIfTI |
-o |
Output folder |
-m |
Model folder (rclm.pth, args.json) |
--sex |
Sex F/M or 0/1 (required) |
--age |
Baseline age in years (required) |
--years |
Elapsed years to the simulated target (required) |
--vcr-lateral-ventricle |
Total VCR for LateralVentricle (all four --vcr-* required for VCR-on) |
--vcr-amyg |
Total VCR for Amyg |
--vcr-hippo |
Total VCR for Hippo |
--vcr-sylvian |
Total VCR for SylvianFissureExt |
--no-roi-change |
Disable VCR conditioning |
--register |
TRSAA-register to MNI before inference |
--mni |
Template path for --register (default: template/MNI_FULL.nii.gz) |
--save-disp |
Also save *_disp.npy |
--device |
cuda / mps / cpu (default: auto) |
--output-voxel-size X Y Z |
Output spacing in mm (default: 1 1 1) |
| Argument | Description |
|---|---|
-i |
Input folder or a single NIfTI |
-o |
Output folder |
-t / --mni |
Explicit MNI template path (default: template/MNI_FULL.nii.gz) |
--template-dir |
Folder containing MNI_FULL.nii.gz (default: template/) |
--reg-iterations A B C |
TRSAA reg_iterations (default: 40 20 0) |
--save-transforms |
Copy ANTs forward transforms next to the output |
--verbose |
Verbose ANTs logging |