Code for Surface-Conditioned Implicit Reconstruction of Internal Anatomy for Automated Patient Positioning.
This repository implements a surface-conditioned implicit neural representation for reconstructing dense internal anatomical labels from an external body-surface point cloud. The model combines a hierarchical Point Transformer body encoder with a modulated SIREN decoder. At inference time, volumetric segmentations are generated by querying 3D coordinates and predicting anatomical class logits.
main.py: entry point for preprocessing, training, volume generation, and evaluation.data/: dataset loading and batching utilities.models/: body encoder, modulated SIREN decoder, and segmentation network wrapper.steps/segmentation/processing/: label mapping, query sampling, and volume generation.steps/segmentation/evaluation/: segmentation metrics and HTML report generation.steps/training/: training loop utilities.lib/pointops/: custom CUDA point operations used by the Point Transformer layers.common/andutil/: shared helpers for scoring, coordinate handling, I/O, and losses.
The environment can be created with the provided setup script:
bash env_setup.sh iaThe dataset is not included due to privacy restrictions. The code expects preprocessed body-surface point clouds, volumetric segmentation masks, label metadata, and train/test subject lists.
Input paths are configured via command-line arguments. If your local file names differ from the defaults, use the optional path overrides listed below.
Preprocess labels and sample training queries:
python main.py --preprocess \
--data_root /path/to/data \
--save_path /path/to/experiments \
--gpu=0Train the model:
python main.py --train \
--data_root /path/to/data \
--save_path /path/to/experiments \
--gpu=0Generate segmentation volumes:
python main.py --generate \
--data_root /path/to/data \
--save_path /path/to/experiments \
--gpu=0Evaluate generated segmentations:
python main.py --evaluate \
--data_root /path/to/data \
--save_path /path/to/experimentsUse --gpu=auto to select the least-used GPU according to available memory.
Optional path overrides:
--training_list_file_path /path/to/training_patient_list.txt
--testing_list_file_path /path/to/test_patient_list.txt
--raw_label_json_file_path /path/to/organ_label_list.json
--label_json_file_path /path/to/label_organs.json
--body_data_path /path/to/data_1k_python37.npz
--mask_dir /path/to/masks_volumetric_preprocessed_v2
--metadata_csv /path/to/masks_volumetric_metadata.csv
--gt_dir /path/to/mapped_masksBy default, experiment outputs are written below save_path:
<save_path>/implicit-anatomy/
1_preprocess/
2_train/
3_generate/
4_evaluate/
The generated volumes are stored as NIfTI files, and evaluation produces a CSV table together with an HTML segmentation report.
This repository builds upon the original Point Transformer implementation by Zhao et al. (2021): https://github.com/POSTECH-CVLab/point-transformer
If you use this code, please cite:
@inproceedings{krnjacasurface,
title={Surface-Conditioned Implicit Reconstruction of Internal Anatomy for Automated Patient Positioning},
author={Krnjaca, Denis and Heinrich, Mattias P},
booktitle={Off-Grid: 1st Workshop on Continuous Representations and Grid-Free Methods in Medical Imaging},
year={2026}
}The official Springer LNCS citation will be added once the proceedings are published.