keywords: Medical Image Registration, Longitudinal Analysis, Brain MRI, Deep Learning, PyTorch
This is a PyTorch implementation of our paper:
- Python >= 3.10
- PyTorch >= 2.1
- MONAI >= 1.3
- mmengine
- nibabel, scipy, pandas, numpy
- wandb (for experiment logging)
- ConfigArgParse
git clone https://github.com/BailiangJ/TimeFlow.git
cd TimeFlow
pip install -r requirements.txtTimeFlow assumes longitudinal brain MRI data preprocessed using the FreeSurfer v7.2 longitudinal pipeline. The data should be structurally aligned and intensity normalized before passing to TimeFlow.
Your dataset information should be provided in:
- A flat directory containing all preprocessed images (e.g.,
.mgzor.nii.gzformat). - A
.csvfile detailing subject IDs, scan visits (e.g., ADNI dataframe). - (Optional) a
.jsonlisting of subject IDs subsets to use.
See scripts/train_cfg.py for variables mapping to the data structures.
All hyperparameters and model settings reside in scripts/train_cfg.py. Key parameters include:
interp_flow_weight: the weight of the proposed interpolation flow consistency constraint.ext_sim_weight: the weight of extrapolation consistency constraint.ext_flow_weight: the weight of extrapolation flow consistency constraint.
To launch training with tracking, point to the configuration file:
python scripts/train.py --train-config scripts/train_cfg.py --random-seed 42To use a trained TimeFlow model to predict deformed brain scans or deformation fields:
python scripts/infer.py -m output_model_folder -exp <exp_id> -epoch <epoch_id>In scripts/infer_cfg.py, you can change prediction settings, including the source and target evaluation times.
TBD
We would like to acknowledge the following excellent repositories that our codebase builds upon:
If you use TimeFlow in your research, please consider citing our work:
@article{jian2026temporal,
title={Temporal Conditioning for Longitudinal Brain MRI Registration and Aging Analysis},
author={Jian, Bailiang and Pan, Jiazhen and Li, Yitong and Bongratz, Fabian and Li, Ruochen and Rueckert, Daniel and Wiestler, Benedikt and Wachinger, Christian},
journal={IEEE Transactions on Medical Imaging},
year={2026},
publisher={IEEE}
}© Bailiang Jian Licensed under the MIT Licensce
