## 4 Discussion  
Having features that capture the textural/morphological aspects independent of the staining would allow learning models across different immune stainings. Such models can be applied to image registration or image retrieval problems as well as to more explorative scenarios such as characterization of tissue heterogeneity. In the proof-of-concept applications we presented here we used pathology sections from colon cancer cases. However, the method is by no means bound to any specific pathology.  
We trained an autoencoder to produce a disentangled representation in the latent space with the purpose of separating the colour/stain information from the structure information. The obtained representation was tested in scenarios inspired by real-world applications: cross-stain registration of images and comparison of intra-tumour heterogeneity. We stress the fact that these are proof-of-concept analyses with the purpose of studying the possibility of achieving stain invariant feature extraction.  
In the first scenario, the results indicate that the newly proposed approach is able to extract relevant information for comparing patches across stains with similar performance as the mutual information distance. The novel method has several advantages over mutual information. The use of probability-based similarity measures (SKLD, BD) makes the approach invariant to identical perturbations of the compared datasets. Further, the model uses data driven features for similarity estimation, explicitly separating feature selection and similarity estimation. Finally, the inference step is computationally efficient.  
In the second scenario, we used the same latent representation as before for learning a visual codebook. Since the latent representation is parametrized as a multivariate Gaussian distribution, there is a need for careful selection of the metric to be used in clustering such representations. In our case, we used the SKLD with diagonal Gaussians and a clustering algorithm able to accommodate non-Euclidean distances (DBSCAN). The resulting codebook was used for summarizing the images in terms of histograms (of codewords), as simple descriptors of intra-tumoral heterogeneity. Then, using hierarchical clustering, we showed that most of the series (consecutive sections from the same block) cluster together. There were also some cases which appeared to be distant in the hierarchical clustering. Technical issues, such as tissue tearing and fragmentation, are definitely contributing to these results (Figure 10). A further application of this approach, not detailed here, is semantic image retrieval: retrieving slide images with similar tissue morphology mix, across different immune stains. At the core, this would application could have an image summarization based on multi-stain visual dictionaries, an extended version of the one developed here.  
Figure 10: Example of sections with poorly matching histograms of codewords.  
The latent representation was learned from a set of images in an application-agnostic manner, with no tuning for the latter usage. In a more realistic case, the representation and the latter distance (or visual codebook) would need to be adapted and optimized. Comparing pathology sections across stains is feasible with the approach described above, however better summarization would be needed for capturing the tissue heterogeneity. The results presented here were obtained on a rather limited data set. Clearly, scaling up both the training set and the test set(s) is needed for achieving high confidence in the novel representation.