Repository of code for experiments in the paper "Detection of Esophageal Varices and Prediction of Liver Decompensation in Unresectable Hepatocellular Carcinoma using AI" (DOI: 10.1016/j.jhep.2026.01.021) and the implementation of the HepatoSageCT model as well as weights for EV and hepatic decompensation for ML models.
The repo contains the scripts used for training the HepatoSageCT model as well as the ML models described on the paper. The repository is split between the DL part (with an environment in python 3.9 for feature extraction and another in python 3.13 for the model training and deployment) and the ML part (environment in python 3.13). This is necessary due to the different pieces required by the FM and the MLP and ML parts.
HepatoSageCT is a model that takes in arterial-phase thorax-abdomen-pelvis region CECTs, which are processed through the MERLIN abdominal CT model (https://github.com/StanfordMIMI/Merlin, Blankemeier et al. 2024, version 0.2.0), the features are then passed through an MLP that has been trained on unresectable HCC patients scheduled for AtezoBev treatment. The model shows promising results for EV and hepatic decompensation in external validation in Paris liver centres.
You need NIFTI files that you pass through the MERLIN foundation model (DICOMs also work, just change the reader). Each patient´s CT scan should be in its distinct folder. The resulting features (one per scan) should be encoded as .npy files. Then you also need a .csv file with the ID of the patients and the absolute paths to the feature files produced by MERLIN. DICOM files could also work with the MONAI reader but we used NIFTIs. We used arterial scans, mostly late-arterial.
HepatoSageCT is NOT designed to be, does not claim to be nor is it at the stage to be considered any sort of medical device. It does not claim to be a substitute for EGD or HVPG for portal-hypertension or the presence of EVs. Intended use is for academic studies at the present to improve it and retrian or finetune if necessary as indicated in the Discussion of the paper.
The model(s) is/are designed for cirrhotic patients with HCC that are scheduled to go for AtezoBev treatment. Training data and external validation comes from French liver centers. Training data does not include patients with TIPS or a history of liver transplants. For the EV prediction model, patients with prior clinical history of acute variceal bleeding were not included in the analysis or training of the models. Validation of results in cohorts from other patients with different underlying population-level drivers of cirrhoses is pending. CTs are taken at most 3 months before the first infusion of AtezoBev. Effectiveness on in-treatment patients is unknown.