arXiv:2608.23024cs.CVAug 2026

Manuscript Offprint

arXiv:2608.23024

When the Edit Changes the Patient: Measuring Identity Preservation in Counterfactual Retinal Images

Andrea Posada, Wenke Karbole, Bach Ngoc Doan, Alexander Weers, Solmaz Abdolrahimzadeh, Maria Patsiamanidi, Kahkashan Haider, Vaishali Khare, Daniel Rueckert, Andrew Lotery, Sobha Sivaprasad, Martin J. Menten

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.

Andrea Posada1,2∗^{1,2*}[0009-0005-3021-5525], Wenke Karbole1,3∗^{1,3*}, Bach Ngoc Doan1∗^{1*}, Alexander Weers1,2^{1,2}, Solmaz Abdolrahimzadeh4^{4}, Maria Patsiamanidi5^{5}, Kahkashan Haider6^{6}, Vaishali Khare6^{6}, Daniel Rueckert1,2,7^{1,2,7}, Andrew Lotery5^{5}, Sobha Sivaprasad6^{6}, and Martin J. Menten1,2,7^{1,2,7}

1^{1} Technical University of Munich and TUM University Hospital, Germany

wenke.karbole@tum.de

2^{2} Munich Center of Machine Learning (MCML), Munich, Germany

3^{3} Munich Data Science Institute (MDSI), Munich, Germany

4^{4} Sapienza University of Rome, Rome, Italy

5^{5} Faculty of Medicine, University of Southampton, Southampton, United Kingdom

6^{6} Moorfields Eye Hospital NHS Foundation Trust, London, United Kingdom

7^{7} Imperial College London, UK

∗^{*} Equal contribution.

Abstract. Counterfactual medical image generation aims to modify an existing image to reflect a hypothetical scenario in which certain characteristics of the imaged subject are altered, while keeping their identity fixed. Most existing works repurpose established image editing methods, which do not directly supervise identity preservation. Instead, they assume that identity is implicitly preserved by anchoring generation to the source image. This assumption is rarely tested and may fail in domains where biometric cues are subtle, such as retinal optical coherence tomography (OCT). In this work, we explicitly measure identity preservation for three groups of text-conditioned editing methods – source-anchored, structured-prompt, and paired-training – using referee classifiers, embedding alignment scores, and a blind reader study. We find that all methods produce high-quality OCT images with comparable editing success, yet their identity preservation differs markedly. Source-anchored editing frequently alters the depicted subject, while paired-training preserves it best. We argue that future work on medical counterfactual generation must explicitly measure and report identity preservation alongside image realism and editing success.

Keywords: Counterfactual image generation · Text-conditioned image editing · Identity preservation · Retina · OCT imaging

1 Introduction

Counterfactual medical image generation aims to answer the question: “What would this subject’s image look like if a given attribute were changed?” In order

Posada, Karbole, Doan et al.

COUNTERFACTUAL GENERATION

EVALUATION

Figure

Fig. 1. In OCT counterfactual generation, changing global age-related macular degeneration (AMD) biomarkers requires strong edits that can disrupt the subtle cues linked to patient identity. As a result, the generated samples often fail to preserve the subject's identity even when the edits appear faithful and realistic.

to be useful for applications such as visualizing disease progression and simulating treatment effects [33,9,18], the resulting synthetic images must not only be realistic and anatomically accurate, but also preserve the subject's identity.

Most existing text-conditioned counterfactual methods repurpose established diffusion-based image editing techniques, which do not directly supervise identity preservation. Instead, they assume it is preserved implicitly, by anchoring generation to the source image or by training on image pairs. This assumption has largely held because most medical counterfactual work has been developed and evaluated on chest X-rays [9,28,3], where the subject's identity is strongly linked to salient biometric features: skeletal structure, body habitus, heart outlines and lung shape vary markedly between subjects and enable near-perfect patient re-identification [27]. Conversely, in retinal optical coherence tomography (OCT), identity cues are encoded by more subtle features such as retinal-layer thickness and blood vessels [17]. We hypothesize that, for OCT images, even small edits can substantially alter a subject's biometric features and thus produce implausible counterfactuals. Consequently, the assumption of identity preservation as an automatic by-product of current text-conditioned editing methods may not hold in retinal imaging (Figure 1).

To test this hypothesis, we conduct experiments using a longitudinal OCT dataset of subjects with age-related macular degeneration (AMD). Global AMD-related changes often superimpose subtle identity cues, making counterfactual editing challenging. We compare three text-conditioned image editing groups – source-anchored, structured-prompt, and paired-training – that have not been optimized for identity preservation. In addition to realism and editing success, we assess identity preservation using three complementary approaches: referee classifiers for the subject sex and eye identity, an alignment score between the generated edit and the subject's real longitudinal change, and a blind reader study in which clinically trained readers judge whether image pairs depict the same eye.

Our findings show that identity preservation cannot be taken for granted: even small edits that appear realistic and achieve the intended change can alter the depicted subject's identity. Moreover, accounting for it during model development informs hyperparameter selection at little cost to realism or editing success. We therefore argue that identity preservation in medical counterfactual generation must be explicitly measured rather than assumed, particularly for imaging modalities with subtle identity cues such as retinal OCT.

References (36)