Views
No views yet
AI-Guided Inference of Morphodynamic Attractors-Like States in Glioblastoma
Authors: Simona Ruxandra Volovăț, Călin Gheorghe Buzea, Dragos Teodor Iancu, Maricel Agop, Lăcrămioara Ochiuz, Dragoș Ioan Rusu, Diana Ioana Panaite, Mădălina Raluca Ostafe and Cristian Constantin Volovăț
2024–2025
We do not redistribute BraTS MRI data in this repository.
.nii.gz files using the script in src/preprocess_brats2020.py./src.1git clone https://huggingface.co/alinc66/gbm-latent-attractors-brats2020
2cd <repo-name>
3pip install -r requirements.txt
4
5Requirements include:
6
7torch>=2.0
8torchvision
9torchio>=0.18
10numpy
11pandas
12scikit-learn
13nibabel
14tqdm
15umap-learn
16matplotlib
17joblib
18torchdiffeq
19
20Repository Structure
21
22repo/
23│
24├── README.md
25├── requirements.txt
26├── LICENSE
27│
28├── weights/
29│ ├── ae3d_final.pth
30│ ├── neural_ode_field.pth (optional)
31│ └── encoder_small.pth (optional)
32│
33└── src/
34 ├── preprocess_brats2020.py
35 ├── train_autoencoder.py
36 ├── embed_cases.py
37 ├── compute_stability.py
38 ├── compute_attractors.py
39 ├── saliency_maps.py
40 ├── train_neural_ode.py
41 ├── models_ae3d.py
42 ├── datasets_npz.py
43 └── utils_*.py
44
45
46Step-by-Step Instructions
47
481. Preprocess BraTS into .npz format
49
50python src/preprocess_brats2020.py \
51 --root /path/to/BraTS2020_raw \
52 --out /path/to/preprocessed \
53 --cube 128
54
55Outputs:
56
57/preprocessed/npz/*.npz
58
59metadata_final.csv
60
612. Train the 3-D Autoencoder (or use provided weights)
62
63python src/train_autoencoder.py \
64 --base_dir /path/to/preprocessed \
65 --epochs 80
66
67Outputs:
68
69models/ae3d_final.pth
70
71You may skip this if using our pretrained weights.
72
733. Compute case-level latent embeddings (z̄)
74
75python src/embed_cases.py \
76 --base_dir /path/to/preprocessed
77
78Outputs:
79
80embeddings_caselevel.csv
81
824. Compute latent stability
83
84python src/compute_stability.py \
85 --base_dir /path/to/preprocessed
86
87Outputs:
88
89embeddings_caselevel_with_stability.csv
90
915. Compute static attractors (K = 3)
92
93python src/compute_attractors.py \
94 --base_dir /path/to/preprocessed
95
96Outputs:
97
98embeddings_with_attractor.csv
99(contains attractor label for each subject)
100
1016. (Optional) Voxel-level attractor saliency maps
102
103python src/saliency_maps.py \
104 --preprocessed_dir /path/to/preprocessed \
105 --split train \
106 --case_ids 1 2 3 \
107 --n_perturbs 1200
108
109Outputs per case:
110
111flip_heat.npy
112
113shift_heat.npy
114
115meta.npy
116
117Saved under:
118/preprocessed/saliency_maps/
119
120
1217. (Optional) Neural ODE latent dynamics + dynamic attractors
122
123python src/train_neural_ode.py \
124 --embeddings_csv /path/to/preprocessed/embeddings_caselevel_with_stability.csv \
125 --output_dir /path/to/preprocessed/neural_ode
126
127Outputs:
128
129neural_ode_field.pth
130embeddings_with_dynamic_attractors.csv
131neural_ode_trajectories_pca2d.png (optional visualization)
132
133📄 Mathematical Formulation
134
135The complete mathematical derivation of the framework
136(latent AE mapping, stability metric, basin geometry, saliency perturbations,
137neural ODE field, and control objective) is provided in:
138
139📘 Supplementary Section S6
140📘 Algorithm S1
141
142which correspond exactly to the implementation in this repository.
143
144
145🔒 License and Data Usage
146
147Code is released under MIT.
148
149BraTS 2020 images are not included and must be downloaded separately from TCIA or Kaggle.
150
151Any redistribution of MRI data must follow TCIA/BraTS licensing terms.
152
153🙋 Support
154
155If you have questions or find issues, please open an Issue on the repo or contact:
156
157Calin Buzea
158National Institute of Research and Development for Technical Physics
159Email: calinb2003@yahoo.com
160
161🎉 Acknowledgments
162
163We thank the BraTS 2020 organizers for providing a high-quality multimodal MRI dataset,
164and the open-source ML/PyTorch community for enabling reproducible research.
165