{'fraction_non_alphanumeric': 0.03247995862425653, 'fraction_numerical': 0.010240496508921644, 'mean_word_length': 5.15404201145767, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
METGAN: Generative Tumour Inpainting and Modality Synthesis in Light Sheet Microscopy

Novel multimodal imaging methods are capable of generating extensive, super high resolution datasets for preclinical research. Yet, a massive lack of annotations prevents the broad use of deep learning to analyze such data. So far, existing generative models fail to mitigate this problem because of frequent labeling errors. In this paper, we introduce a novel generative method which leverages real anatomical information to generate realistic image-label pairs of tumours. We construct a dual-pathway generator, for the anatomical image and label, trained in a cycle-consistent setup, constrained by an independent, pretrained segmentor. The generated images yield significant quantitative improvement compared to existing methods. To validate the quality of synthesis, we train segmentation networks on a dataset augmented with the synthetic data, substantially improving the segmentation over baseline.


Introduction
Recently, the combination of fluorescence microscopy and tissue clearing has enabled the generation of single-cell resolution, terabyte sized 3D datasets of whole specimens and organs [1,2,3]. These datasets facilitate the quantitative study of disease or age-induced anatomical alterations, as well as drug targeting, in human organs or animal models. An intriguing feature of such datasets is the multi-channel nature of the data. An autofluorescence channel, denoted as "anatomical channel", images general tissue, and a pathology channel marks objects of interest such as tumours ("tumour channel") using fluorescence dyes. The sheer size and multi-channel characteristics of these data require the use of high throughput deep learning methods to analyze and segment them [4,5,6]. However, data volume and complexity increase the manual annotation cost, as the timeframe required for manual labeling of a single scan of a whole mice can span up to two months. This evidently motivates the development of new approaches for synthetic image-label pair generation and data augmentation [7]. Nevertheless, existing methods often fail to generate semantically correct images when underlying annotations used for training are noisy. Moreover, current applications that focus on the semantics fail at taking advantage of existing prior anatomical information, generating semantically correct, but often trivial images.

Anatomical channel
Tumour Channel Annotation Fig. 1. Motivation: the characteristic dim metastases can only be identified by multiple adjustments of contrast, and only from certain angles. Such properties lead to inconsistent annotations, even from experts. First, these inconsistencies make the labeling very expensive. Second, training segmentation networks on these datasets is only stable for large numbers of annotated samples. Both of these aspects motivate the need for our generative tumour inpainting to create labeled datasets.
This paper presents a novel generative adversarial network (GAN) based approach, which leverages the advantages of fluorescence microscopic datasets, namely a high SNR and multiple channels, to generate realistic data. Our application focuses on a dataset pertaining metastatic spread in a whole mouse organism. Based on information in the anatomical channel, we generate synthetic images in the pathology (cancer) domain, with objects of interest (tumours) placed in user-defined locations. Thus, we derive the generated samples from existent and distinctive priors, without the additional burden on the generator of having to synthesise both diverse backgrounds and foreground. Additionally, our method solves characteristic inconsistencies in foreground data and labels (see Figure 1).
The use of generative adversarial networks for synthetic data generation and augmentation [8] is a current topic of interest for improvements in segmentation and classification tasks. Goodfellow et al. introduced the concept of GANs [9], which was successfully improved and extended towards image-to-image translation [10,11,12], among other applications in medical imaging [13,14,15]. For medical images, label-based conditional GANs have been used for data infill [16] and augmentation for underrepresented classes [17], to improve segmentation, [18] as well as classification [19,20,21]. Semantic image synthesis has been enhanced with spatially-adaptive normalization [22]. Related to our oncology application in lesion segmentation, Qasimet al. introduced a third player in the generative game, which improved performance of the downstream segmentation task [23]. Cohen et al. showed that using distribution matching losses can lead to hallucinating tumours, which translated to medical misdiagnosis [24], clearly showing the need for advanced image synthesis techniques, trained with losses that punish the generation of unwanted structures.
Contributions: 1) We develop a novel generative model, MetGAN, to synthesize realistic microscopic images of tumour metastases, based on real autofluorescence image information and arbitrarily placed tumour labels. Our model consists of a dual-pathway generator, MetGen, trained in a cycle-consistent setup, and further constrained by an independent, pretrained segmentor. Our novelty lies in: the generator architecture, the addition of a passive segmentor in the cycle-consistent training setup, and the further constraint with a pairwise loss for improved domain adaptation. 2) We present qualitative results of our generated microscopic tumour images, and we quantitatively evaluate the error comparative to the real ground truth images. This shows the superiority of our model over existing state of the art methods. 3) We extensively validate our method in a downstream segmentation task, where we use our generated tumour images to train a segmentation network. We show that training solely on generated image-label pairs achieves identical performance as training on a large set of real data. Furthermore, augmentation of the real dataset with synthtetic data improves lesion detection.

Methods
Architecture In this work, we propose a cycle-consistent 2D framework for domain adaptation and semantic tumour inpainting using a customized GAN, whose architecture is depicted in Figure 2. Our setup is inspired by CycleGAN, a proven model in domain translation tasks [11].
It has been shown that networks which employ simple batch normalization layers tend to lose semantic information when it comes to label-based generation [22]. This aspect motivated us to construct proposed generator network, MetGen, with an additional pathway, tailored for semantic synthesis. Thus, we delimit two paths: one following a traditional U-net architecture [25], that receives the anatomy channel as input; and a second path composed of 7 Spade ResNet Blocks [22], which process the label-input to the network. We then merge the resulting features of the two paths in the upconvolutional layers of the U-net decoder (see Supplementary). This separation better preserves the flow of semantic information and results in a more accurate label-based inpainting compared to a naive channel-wise concatenation of the input image and the annotation.
Furthermore, we want to ensure that the generated output is consistent with the desired label -a constraint we enforce through a pre-trained and frozen segmentor network, employed as a passive player in the training process. Its role is twofold: not only does it enforce the placement of metastases at the desired locations, but it also helps to suppress hyperintensities in the anatomy channel which are preserved in the case of CycleGAN, creating semantic ambiguities.
Proposed conditional GAN training setup: The generator F learns the mapping from the anatomical to the tumour channel, conditioned on the imposed label, through the discriminator DX . Because we train in a cycle consistent manner, G learns the inverse mapping, through DY . A fixed pretrained segmentor is used to enforce the desired semantics by punishing F for incorrect tumour placement.
Training Losses As presented in Figure 2, our final loss consists of four terms. Firstly, we define the discriminator and cycle consistency losses similar to [11]: where we denote: X -the anatomical domain, Y -the tumour domain, Lthe binary domain marking the presence or absence of a tumour; x,l ∼ p (x,l) and y,l∼ p (y,l) are samples from domain X and Y; F (x, l) is a mapping from X × L → Y; and G(y, l) a mapping from Y × L → X, with D X and D Y as corresponding discriminator functions.
Secondly, in order to ensure the desired segmentation map is respected, and that the setup is robust against artefacts and hyperintesities in the autofluorescence channel, we use a weighted binary cross-entropy loss L Segm (F, L), given by the predictions of the segmentor network, penalizing the discrepancy between the real and segmented label. Lastly, to leverage the paired nature of our data and to facilitate feature translation achieved in the domain adaptation task, we also use a pair-wise loss between real and generated images in each domain: The final loss is a weighted linear combination of these components, where the parameters α 1−4 are hyperparameters adjustable per dataset.

Experiments
Dataset: In our evaluation, we use a publicly available light sheet microscopy dataset [5,26]. The dataset contains 3528, 300x300 pixel images, with their corresponding ground truth annotations. We selected 1602 samples depicting areas within the bodies and resized them to 256x256 pixels. We put aside 20 % of the data as a test set that is unseen by any network. The test set includes cases with and without metastases, with a balanced organ-based distribution. Normalization to [-1,1] and random rotations are used at train time.
We compare our proposed solution to established baseline methods such as Pix2Pix and CycleGAN, as well as mixture models: Pix2Pix and CycleGAN trained with an additional segmentation loss (referred to as "Pix2PixSeg" and "CycleGanSeg"). As our generator is agnostic to the discriminator achitecture and training method, we set out to train MetGen with a conditional discriminator, as in [10], and with a cycle-consistent setup, as in [11] (denoted "MetGen-CondSeg+" and "MetGAN-", respectively). The difference between "MetGAN-" and "MetGAN" stands in the use of the pair-wise loss L P air . We compare the generated images from a qualitative and a quantitative point of view, based on the unseen test set. For this, we use 414 real pairs of anatomical channel, real label, and tumour channel. Lastly, we implement a downstream study, where we train segmentation networks on synthetic, real and mixed data.
Implementation details: We train our models using Pytorch, on an NVIDIA GeForce RTX 2080, for 200 epochs, with batch size=1, using Adam optimizer with β 1 = 0.5, β 2 = 0.999, initial learning rate = 0.0002 and linear learning rate decay after 100 epochs. The pre-trained segmentor network (U-net) developed by Pan et al. in [5] is loaded, and not modified during training. As a discriminator, we use PatchGAN with 3 layers and a field of view of 70x70 pixels, in a simple or conditional setup (with its vote based on the generator's output for the cycle consistent setup, or concatenation of output and input, otherwise). Training our final method takes approximately 24 hours. For the final loss function, we use α 1 = 1, α 2 = 10, α 3 = 100, and α 4 = 10, obtained empirically. The baseline methods were trained using default parameters proposed by [11].

Results
Quantitative Results: In Table 1, we compare the generated "tumour channel" images to the corresponding ground truth using three image similarity metrics.
Our first implementation, Pix2PixSeg, learns to produce structures at the desired locations (see Figure 3), improving image similarity compared to the basic Pix2Pix and CycleGAN. However, using MetGen as a here generator decreases the performance in regards to MAE, MSD and SSIM. In the cycle consistent setup, CycleGAN produces good similarity scores, but fails to respect the semantic map. Here, adding the segmentor (CycleGANSeg) weakens the performance substantially. MetGAN-improves MAE and MSD over CycleGAN; however, the SSIM is worse than in CycleGAN. Finally, our method leads to a consistent improvement of the generated images compared to the state of the art according to the three metrics. Qualitative Results: Figure 3 shows examples of qualitative results obtained for our method and baselines. We observe the following common features: while standalone Pix2Pix and CycleGAN obtain good image similarity and domain adaptation, they either fail to create the desired tumours, or the networks hallucinate features in undesired places. Adding a segmentor network helps to ensure that the new structures are inpainted at the desired location, but still leads to additional unwanted tumours (Pix2PixSeg), or fails on the domain adaptation task (CycleGANSeg). The use of our generator improves the synthesis in both conditional (MetGenCondSeg) and cycle-consistent setups (MetGAN-). Nevertheless, MetGenCondSeg often fails to maintain features from the anatomical channel, producing dark images with bright metastases, which is a simple, but only occasionally correct solution to the task. On the other hand, MetGANkeeps too many of the original features. An optimal balance is reached with our proposed solution, MetGAN, which consistently places tumor at the imposed label location, whilst adapting features from the anatomical domain.
Downstream segmentation task analysis: We analyze how MetGAN images can be used to augment real data for training segmentation networks. We train segmentation models on sets of synthetic, real or mixed data, with a varying number of samples from each set. For generating synthetic data, we use random-ized unpaired combinations of real anatomical channel images, and real non-zero labels or combinations thereof (e.g. 2 non-zero labels merged together, in order to create more objects of interest in one image). As a segmentor network, we use the U-net developed in [5]. We perform 5-fold cross-validation for all experiments. We evaluate the segmentation performance using lesion-wise Dice, precision, recall and Jaccard Index, on an unseen test dataset (which is not used in GAN training or image generation either), see Figure 4.
Purely synthetic data: By training a segmentation network only with synthetically generated data, we observe that we achieve a similar performance (78.8% Dice) as by using real data (79.8% Dice). Moreover, for a low number of samples, we not only outperform the model trained with real data, but also offer better training stability with decrease in dataset size. We attribute this to the fact that our approach can generate images with an increased number of objects of interest, allowing us to have a more representative depiction of the data distribution, even in a low sample regime. Nevertheless, increasing the amount of training images past a certain point (≈1000 samples, in our case) results in a slight decrease of performance, as the network overfits on synthetic data.
Mixed data: Compared to training the segmentor purely on real images, we observe that our augmentation can increase the performance. Our experiments highlight that, by using as little as 25% of the available real data, together with synthetically generated samples, we can outperform the real data baseline. Adding our synthetic data improves the performance up to a plateau point, where we speculate that the limitations are caused by the inherent variability in annotation quality, see Figure 1. Past this point, adding more generated samples leads to overfitting and a slight decrease in performance. On a per tumour basis, our data augmentation increases the mean number of detected metastases (true positives) from 83 to 95, whilst simultaneously decreasing the number of false positives from 41 to 21. The detection is especially improved for small-sized or dim tumours located in the lungs, showing that our network can produce diverse objects that can be used to improve difficult cases. Table 2. Mean segmentation performance of models trained on real (R), synthetic (S), and mixed data. We see that training based on synthetic data reaches a performance similar to the real data, even outperforming real data at low numbers of training samples. The best segmentation scores can be obtained by combining real and synthetic data.  Table), and minimum and maximum achieved during 5-fold cross validation as delimiters of the areas. We can observe that the inclusion of synthetic data makes training the segmentation network more stable; especially in the case of small datasets, where training on real data is unstable and volatile. On the other hand the performance obtained with purely synthetic or mixed data is more stable.

Conclusions
In this paper, we introduce a novel generative method, which is able to leverage real anatomical information to generate realistic image-label pairs of tumours. We achieve this by implementing a dual-pathway generator, for the anatomical image and label, trained in a cycle-consistent fashion, which is constrained by an independent, pretrained segmentor. We generate images which are substantially more realistic in terms of quantitative and qualitative results, compared to 5 different state of the art models. Moreover, we train segmentation networks on real, generated and mixed data. We find that data synthesized with our method improves segmentation; both from a training stability point of view, observable at low data regimes; as well as from a lesion-detection point of view. Using our method leads to higher segmentation scores when used to augment real data, and can potentially be further exploited by focusing on underrepresented or low-performance cases. . Robustness testing of our method. We train MetGAN, Pix2Pix and CycleGAN with data containing 25% shuffled labels. We can observe that MetGAN is robust to label inconsistency, and produces realistic images that are in line with the input to the network. Table 3. Qunatitative validation of our generator, MetGen, (without a segmentor) versus the state of the art, on a second, proprietary dataset pertaining a mouse peripheral nervous system (as described above). Mean absolute error (MAE), mean sum of squared differences (MSD), structural similarity index measure (SSIM), and crosscorrelation coefficient (CCoeff) are used for comparing generated images vs ground truth. Best scores are indicated in bold digits and are statistically significant with a t-test based p-value < 0.005.  Fig. 7. Validation of our generator, MetGEN (no segmentor) on a second proprietary fluorescence microscopy dataset of the mouse peripheral nervous system. The anatomy channel is translated to contrast-enhanced nerve channel, with semantics based on the imposed annotation. We trained MetGen in a Cycle-consistent setup (MetGen-Cycle) or with a conditional discriminator (MetGen Cond). We compare with CycleGAN and Pix2Pix. 10500 images were used for training, and the networks were tested on 2000 images. We can observe that the best similarity between generated and ground truth image is obtained by our setup.