New Colors for Histology: Optimized Bivariate Color Maps Increase Perceptual Contrast in Histological Images

Background Accurate evaluation of immunostained histological images is required for reproducible research in many different areas and forms the basis of many clinical decisions. The quality and efficiency of histopathological evaluation is limited by the information content of a histological image, which is primarily encoded as perceivable contrast differences between objects in the image. However, the colors of chromogen and counterstain used for histological samples are not always optimally distinguishable, even under optimal conditions. Methods and Results In this study, we present a method to extract the bivariate color map inherent in a given histological image and to retrospectively optimize this color map. We use a novel, unsupervised approach based on color deconvolution and principal component analysis to show that the commonly used blue and brown color hues in Hematoxylin—3,3’-Diaminobenzidine (DAB) images are poorly suited for human observers. We then demonstrate that it is possible to construct improved color maps according to objective criteria and that these color maps can be used to digitally re-stain histological images. Validation To validate whether this procedure improves distinguishability of objects and background in histological images, we re-stain phantom images and N = 596 large histological images of immunostained samples of human solid tumors. We show that perceptual contrast is improved by a factor of 2.56 in phantom images and up to a factor of 2.17 in sets of histological tumor images. Context Thus, we provide an objective and reliable approach to measure object distinguishability in a given histological image and to maximize visual information available to a human observer. This method could easily be incorporated in digital pathology image viewing systems to improve accuracy and efficiency in research and diagnostics.


Visual perception of histological images
The diagnosis of many, especially of malignant, diseases, relies on the evaluation of histological sections by a pathologist. Also, in basic and translational research, interpretation of histological sections is the basis for scientific conclusions. Accuracy and efficiency of this visual diagnostic process is determined by a number of factors. Four of these factors are commonly considered: first, the original tissue sample must comply with certain standards, then, the fixation and staining procedures should be standardized and optimized [1][2][3][4]. Third, the optical properties of the diagnostic microscope or digital scanner, the characteristics of the image acquisition (e.g. CCD-chip) and data storage should be calibrated to achieve capture a maximum amount of information present in the sample [5,6]. Lastly, for digital pathology, display calibration can have an effect on diagnostic efficacy [7]. However, there is an additional information bottleneck in the diagnostic cascade of tissue samples: in order to be interpreted, the histological image information has to be processed by the visual system of the evaluating pathologist [8,9]. Even if all sample preparation steps are fully optimized, it is conceivable that the resulting image is not optimally suited for the visual system of an observer and that therefore, a proportion of the available information is lost.

Information transfer through the human visual system
The actual information that has to pass the visual system of the human observer is encoded as distinct-i.e. visually distinguishable-objects in the images perceived against a background. More generally, both inter-class-difference (i.e. contrast of objects against background) and intra-class-difference (i.e. contrast between different objects or even within a given object) are the actual basic entities of the encoded information. In a very simple view, these perceivable differences between objects are intensity differences and dark objects on a bright background are optimally distinguishable. However, the human visual system can differentiate approximately 10 million colors [10], as opposed to 720 gray scale intensity steps [11]. It follows that color differences are a much more powerful carrier of visual information than mere intensity differences.

Image optimization in medical imaging
Some diagnostic imaging modalities such as computed tomography (CT) or magnetic resonance (MR) imaging produce data that is commonly encoded as intensity differences [11]. Just in the last few years, there have been structured approaches of digitally coloring radiological images to enhance diagnostic accuracy [12][13][14][15]. In contrast, histopathology has always offered a wider channel for transmission of visual information because images are colored due to the stain dyes. Yet, in most histopathological settings, the effectiveness of visual information transmission by different color hues is not actively measured or optimized. For example, the bluebrown colors in Hematoxylin-DAB (H-DAB) double-staining (a commonly used immunohistochemical (IHC) method) are not derived from considerations about the human visual system. Instead, these colors result from the chemical composition of the used dyes that are optimized for their binding properties. Based on our experience with histopathological images, we hypothesized that perceptual contrast in H-DAB images are not optimal for human visual perception, i.e. that the stain dye colors do not optimally fit the properties of the human visual system. Therefore, in the present study, we cast a closer look on the colors histological images are composed of and strived to find a way to retrospectively optimize these colors without chemical modifications of the stain dyes.

Color optimization methods in digital pathology
Some authors have presented methods to retrospectively optimize the colors of histological, Hematoxylin & Eosin (H&E)-stained images. For example, Khan et al. combined a variant of color deconvolution with mapping to a new color space to achieve a standardized aspect of different histological images [16]. Similarly, Bautista et al. recently presented a method to optimize H&E-stained images to achieve a comparable color scheme in different images [17]. Another image optimization approach has been presented by Reyes-Aldasoro, who suggested an approach to correct unequal shading in a given image [18]. However, while in these studies, the authors optimized the red-blue color scheme of H&E-stained images, they still restricted the resulting colors to the original color hues, e.g. red and blue. Also, in digital pathology systems, overall image contrast, brightness and gamma of the resulting images is optimized, but the color hues themselves are not [7]. One study tested whether changing the hues of H&E-stained images could make these images more aesthetically pleasing for observers with impaired color vision [19]. However, in this study, the authors did not systematically investigate whether a new color scheme changes perceptual contrast or which color choices are optimal.
To the best of our knowledge, it has never been investigated whether by optimizing the colors of a given image, this image could yield more visually perceivable information to a human observer. Furthermore, little is known about color optimization in Hematoxylin (H)-3,3'-Diaminobenzidine (DAB) IHC images, although these images are important for qualitative and quantitative evaluation of tissue samples in a number of diseases, especially solid tumors [4].

Aim of this study
In the present study, we strived to close a conceptual gap in color optimization of histological images. We investigated whether perceptual contrast of different objects in H-DAB immunostained images could be enhanced by optimally transforming the color scheme of a given image. In particular, we investigated which combination of hues are optimally suited for this task, and how the perceptual contrast could be optimized for these hues.
To answer these questions, we applied and validated self-developed methods for optimized stain unmixing, for measuring the bivariate color map inherent in a given histological image and replacing it with a better color map. Our aim was to examine properties of native color maps by a fully objective and reproducible approach and likewise examine the properties of perceptually improved color maps. In particular, we strived to find an optimal solution for color selection in immunostained histological images by using optimization methods for digital re-staining.

Ethics Statement
In this study, we used anonymized images of tissue samples of patients. One sample image is derived from our previous publication [20]. One image is a Creative Commons image (see List B in S1 File). Three H&E sample images derived from our local pathology archive and were already fully anonymized at the time of the experiments. All other images are published in the ProteinAtlas database (see http://www.proteinatlas.org/about/datausage).
Digital re-staining of histological images IHC images can be thought of as bivariate datasets: In each image pixel, the affinity of the antibody and the counterstain dye is measured (both are non-linear processes). Then, both measurements are combined to a color information at this given pixel. All possibly achievable colors in a given image are part of the set of available colors, which can be thought of as a bivariate color map. In native images, this bivariate color map is determined by the light absorption properties of the color pigment. Normally, an observer can only see the resulting image but does not know the exact bivariate color map the image is based on. In the present study, we developed a novel method to extract the color map that is inherent in a given image and replace them with an optimized set of colors (i.e. a new color map). To this end, we developed, employed and validated a novel method of several successive steps: 1. Retrieve an immunostained image as an RGB file (no further knowledge about the image is needed).
2. Extract the intensity information for the two stain channels by using an optimized variant of color deconvolution.
3. Use intensity information from both channels to extract the original color map. Missing parts are linearly interpolated.
4. Create an optimized color map of identical size as the original color map. Unlike the original color map, the new color map is perceptually linear.
5. For each item in the old color map, extract the image pixels that use this color value and replace their color with the corresponding item from the new color map.
The exact methods used in these steps will be explained in the following paragraphs.

Optimized unsupervised color deconvolution
To extract the intensity information for each stain color separately, we developed and validated an optimized variant of Ruifrok's color deconvolution [21]. In their original publication, Ruifrok et al. propose a standard matrix M Rui for Hematoxylin-DAB-Eosin stainings. This standard matrix is widely used, e.g. for H-DAB staining and yields reasonable results for stain separation of three-channel and two-channel images. M Rui is a 3 by 3 matrix and its row vectors are the basis vectors for three color channels (or two channels and a residual). In twochannel IHC images, the row vectors of M Rui areH Rui (for Hematoxylin),D Rui (for DAB) and Rui (for the residual). The widely used ImageJ/Fiji software includes a scaled version of Ruifrok's standard values.
M Rui is widely used for two-channel IHC images. However, image colors in histology depend on the dye chemical, sample preprocessing, staining protocol and scanning device. Considering this, it seems unlikely that M Rui is the best choice for all H-DAB images. Consequently, we hypothesized that the result of color deconvolution can be improved by using the values in M Rui and adjusting them to the image of interest. The standard deconvolution vectors H Rui andD Rui are part of a plane P Rui that is shown as the 'standard plane' in Fig 1A. This plane does not optimally capture image pixel variability of a sample image, because it does not necessarily contain the first two principle component vectors of the image pixel data. By using The commonly used standard color deconvolution vectors define a plane that roughly, but not optimally, approximates the data set (darker plane). The brighter principal component analysis (PCA), we constructed a plane that optimally approximates image pixel variability ('optimal plane' in Fig 1A). In Fig 1A P opt is different from P Rui . P opt is spanned by the two first principal component vectors of the image pixel color data (C 1 and C 2 ). For an image composed of two colors (Hematoxylin (H) and DAB (D)), it follows that optimal color deconvolution vectors of these two colorsH opt andD opt should be part of P opt to minimize deconvolution error, i.e.H opt 2 P opt ð1Þ The third basis vector defines the residual information that cannot be expressed as linear combinations of the two stain vectors. Therefore, we definẽ Consequently, an optimal color deconvolution matrix M opt for an image composed of two colors is composed of the row vectorsH opt ;D opt ; opt .
On the plane P opt , the orientation ofH opt andD opt is constrained by the color they represent: H opt represents a bluish hue andD opt a brown hue. The actual hues for a given image depend on many different parameters including chemical composition of the stain, incubation times of the stains and modalities of the scanning procedure. Because these parameters cannot be estimated from a given image, we use the following approach: For the data in a given image, we take the standard Hematoxylin (blue) and DAB (brown) vectors used by Ruifrok et al. (H Rui ;D Rui ) and defineH opt andD opt as the projection of these vectors on the plane P opt . Thus, we ensure that the residual opt is minimal while the hue represented by the stain vectors stays as close as possible to the commonly used standard values.
Other groups have presented different optimization approaches for color deconvolution [22][23][24][25]. However, these methods rely on assumptions that are not applicable to IHC images and/or do not consider the commonly used-and well validated-standard values and no validation in large data sets is available for these alternative approaches.

Measuring bivariate color maps in IHC images
After color deconvolution, we plotted all image pixels in the space defined by the stain contributions. This is shown in Fig 2B. As can be seen, all image pixels are part of a fixed two-dimensional set of colors, i.e. a bivariate color map. Only small parts of this set of colors are not defined but they can be reconstructed by interpolation (Fig 2C).

Contrast metric defined in the CIELAB space
To quantify perceptual difference (i.e. contrast) between two colors, we made use of the CIE-LAB color space (CIE International Commission on Illumination 1976 L Ã a Ã b Ã ) [26,27]. Images plane shows the optimal plane containing the first and the second principal component vector of the actual image pixel dataset. B) Quantification of mean square error of the residual channel after color deconvolution with different deconvolution vectors. Boxes = 25th to 75th percentile, line = median, whiskers = most extreme data points except outliers, '+' = outliers.
doi:10.1371/journal.pone.0145572.g001 are usually digitally stored in the RGB color space but can be transformed to the CIELAB space by a non-linear transfer function T for red, green, blue color values [R, G, B]. The MATLAB documentation provides a definition of T. The CIELAB color space is perceptually uniform, which means that euclidean distances between colors in this space correspond to the color difference an average human observer perceives. The CIELAB color space is an established concept in science of human perception and is based on experimental data from human subjects [26,27]. Its nonlinearity reflects the nonlinearity of the human visual system. The metric for color difference ΔC (i.e. perceived contrast) between an object of color for When comparing the ratio R of object-to-background contrast in two images, we calculated the contrast C 1 for image 1 and C 2 for image 2 and Thus, if C 1 > C 2 , then R represents the fold increase of object-to-background contrast. In the figures in the present paper, 'L', 'a', 'b' refer to the color space dimensions L Ã , a Ã , b Ã .

Design and validation of perceptually improved color maps
To design a perceptually optimal bivariate color map, we extended established concepts on the optimal design of univariate color maps [28][29][30][31].
First, we examined the standard blue-brown color map in CIELAB space as shown in Fig  3A. It can be seen that compared to the full RGB gamut, this color map is small, i.e. contains only a small subset of colors. We strived to create an improved color map. We created alternative color maps as contiguous 2D planes in the 3D CIELAB space (Fig 3B). Our aim was to create a color map that was larger than the original color map, i.e. contained more visually distinct colors. Apart from the color map size, we defined the following criteria for an optimized color map:

A color map was defined by four corner points and a linearly interpolated plane in between.
This restricted the shape of the color map and ensured that the resulting color map was perceptually linear.
2. Two diagonally opposing corners of the color map were set to black (#000000) and white (#FFFFFF), the two remaining corners were varied.
3. The color map should not contain more than two basic hues. This effectively limited the curvature of the color map because a highly curved plane tended to cross several distinct hues in CIELAB space (some of these highly curved color maps are included in S1 Fig).
4. Green and red hues should not be present in the same color map because of the high prevalence of red-green color vision deficiency (deuteranomaly).
We followed these rules and, in an iterative process, found that the criteria were only fulfilled by color maps containing a red-orange and a blue color. The result of this procedure can be seen in Fig 3B: the new color maps occupy a much larger proportion of the RGB gamut.

Phantom images
Next, we measured the achievable contrast with all possible combination of the five red/ orange-blue color maps. Also, we included the standard blue and brown colors commonly used in H-DAB images and black, gray and white as controls. We created a phantom image of 6 Ã 6 circles of different colors on a homogeneous background and applied the bivariate color maps to this image (Fig 4A-4E). We then evaluated perceptual contrast for each of these bivariate color maps in a phantom image (Fig 4G).

Image source
For initial development of the method, we used a Hematoxylin (H)-3,3'-Diaminobenzidine (DAB) IHC image of CD31-positive blood vessels in a detail of an anonymized tumor image from our recent publication [20]. This image is included in the data we provide along with this paper. For validation of the method, we used a large dataset of publicly accessible, H-DAB IHC images from ProteinAtlas [32,33]. To validate the proposed method, we chose eight commonly used cancer entities and commonly used IHC biomarkers: alpha-fetoprotein (AFP) in liver cancer, B-Raf proto-oncogene (BRAF) in melanoma, erb-b2 receptor tyrosine kinase 2 (ERBB2, HER2/neu) in breast cancer, estrogen receptor (ESR1) and progesterone receptor (PGR) in breast cancer, antigen KI-67 (MKI67, Ki67) in colorectal cancer and urothelial cancer and S100 calcium binding protein A1 (S100A1) in ovarial cancer. We then automatically retrieved all corresponding images URLs by a script via regular expressions and downloaded the images using a MATLAB script. In the code files associated with this study, we provide image URLs that were used. In total, we retrieved and analyzed N = 596 images without further preselection. In order to cut the margin around the actual tissue, the images were cropped before analysis. The license of the images allows use for non-profit research as long as the original citations are provided [32,33].
For automatic measurement of foreground-to-background contrast in these images, we applied color deconvolution and thresholded the resulting DAB channel using Otsu's automatic thresholding method [34]. Representative results of this procedure are shown in S2 Fig. Lastly, we demonstrated that our proposed method can also be used to re-stain H&E or Giemsa stained images. For this purpose, we used fully anonymized images from our institution's pathology archive (see ethics statement above).

Color representation and figure preparation
Colors throughout this manuscript are represented by their hexadecimal codes, starting with "#". For simulation of deuteranopia and tritanopia, we used the built-in plugin in Fiji / ImageJ [35]. All images in this paper were printed without any further modification of contrast, brightness, gamma value or colors.

Computational implementation and licensing
We implemented all novel methods described in this paper in MATLAB (Mathworks, Natick, MA, USA). All source codes, image meta information and the sample image are publicly available on GitHub (DOI: 10.5281/zenodo.35083) under the MIT license (http://opensource.org/ licenses/MIT). This repository contains an easily usable source code and example images and raw data used in our study. All other images are publicly available on ProteinAtlas (http:// www.proteinatlas.org). All statistical analyses were performed using MATLAB and we used student's t-test for evaluation of statistical significance.
More information on the computational procedures is available in List A in S1 File. Raw data are available in S2 File.

Results
The proposed optimized stain unmixing method minimizes deconvolution error The first step of the method we developed for this study was to optimally unmix stain channels of blue-brown IHC images by a novel approach (Fig 1A). We validated this method in N = 596 histological images and found that the quality of stain unmixing significantly increased, as evident by a decrease in mean square error (MSE) of the residual channel. As shown in Fig 1B,

The standard color map in blue-brown images are poorly suited for human visual perception
To find an optimal color map, we created 225 color maps and measured perceptual contrast in a phantom image as shown in Fig 4A and 4B. We found that among all combinations of different hues, the standard brown (#B58C70) on blue (#5C5FA1) color map offered low perceptual contrast (only 39% ± 7% perceptual contrast of the best color map). The best hue combinations in terms of perceptual contrast was blue (#FFAD00) on orange (#006EFF) (set as 100% [±18%], see Fig 4G). Consequently, the new color map improved perceptual contrast by a factor of 2.56 (1/0.39). To visualize in which way the new hue combinations were superior to the standard hue combinations, we analyzed these maps in the CIELAB color space. In Fig 3, a blue-brown color map of a sample image (Fig 3A) is compared to five improved color maps (Fig 3B). It can be seen that the surface of the new color maps is larger than the surface of the original map, i.e. occupies more space in the CIELAB color space. This means that the new color maps can be used to encode more perceptionally distinct colors than the original one.

Images can be digitally re-stained with arbitrary color maps
After determining the optimal combination of colors for bivariate color maps, we applied these color maps to a sample image of a blood vessel in human colorectal cancer (Fig 5). In Fig 5A, we show a sample histological image which is re-stained in 5B and 5C. The corresponding color maps are shown in Fig 5A.1-C.1.
Furthermore, we quantified the perceptual contrast in each color map. This contrast can be measured as the perceptual distance of each color contained in the color map to a neutral element. We set the center point of the color map as neutral and computed perceptual contrast as described in the 'Materials and Methods' section. For example, for the blue (#006EFF) on orange (#FFAD00) color map, the result can be seen Fig 5C.2 as a gray scale coded plot. For the original brown (#B58C70) on blue (#5C5FA1) color map, the contrast of most colors was low (CIELAB maximum distance: 51.7, mean 22.9 ± 10.1). For the new color map blue (#006EFF) on orange (#FFAD00), the contrast was much higher in almost all regions, especially in the high-intensity regions of one of the two colors (CIELAB maximum distance: 82.6, mean 37.4 ± 16). For the other color combinations from Fig 4A-4E, maximum contrast and mean contrast are also higher than for the original blue-brown color map (see Table A in S1 File).
Finally, we used the described method to re-stain 8 sets of histological images of different human solid tumors stained for clinically relevant markers. In Fig 6, two examples from the set 'MKI67-uro' (Ki67 in urothelial cancer) are shown. Foreground-background contrast in phantom images can be markedly increased by applying a new color map. A-F) A phantom image was colored in one of six bivariate color maps, the panel title indicate the hexadecimal codes of the foreground and background color (F represents a typical blue-brown standard color map while A-E represent new color combinations). G) 225 combinations of 15 distinct colors were pairwisely compared. The grayscale intensity and overlayed number indicate the perceptual contrast of phantom images that were digitally stained with the respective color map (numbers: mean ± standard deviation). All measurements were normalized to the maximum contrast. Reading example: The standard brown (#B58C70) on blue (#5C5FA1) color map resulted in a perceptual contrast that was 39% ± 7% of the maximally achieved contrast. Digital re-staining increases perceptual contrast in real histological images To clarify how digital re-staining of N = 596 actual histological images affects perceptual contrast, we measured object-to-background contrast in each of these images before and after the procedure. A representative result of this procedure is shown in S2 Fig. We found that contrast was increased in all datasets (Fig 7). Perceptual contrast of the new images was increased by 116.99% (AFP-liver), 78.7% (BRAF-mela), 82.22% (ERBB2-brst), 30.66% (ESR1-brst), 60.69% (MKI67-crc), 63.3% (MKI67-uro), 62% (PGR-brst) and 92.71% (S100A1-ova). The increases were highly significant (all t-test p-values <0.001, see Table B in S1 File for detailed measurements).

Digital re-staining increases perceptual contrast for observers with impaired color vision
In a last step, we created simulations of the color map appearance to dichromatic observers. Dichromacy is the complete lack of one type of retinal cones, i.e. red, green or blue. Most persons with impaired color vision do not have a complete lack of one cone type, but rather a partial impairment. However, it is difficult to simulate partial color-vision deficiencies due to the wide variety, therefore we decided to use a well-established simulation of the most extreme case of complete dichromacy. We found that some of the proposed color maps were by far superior to the original blue-brown color map in this setting (e.g. see S3 Fig). Especially the most contrasted blue (#006EFF) on orange (#FFAD00) color map preserved perceptual contrast after dichromacy simulation.

Generalization of the method and application to other types of staining
The focus of our work was to enhance perceptual foreground-to-background contrast in H-DAB IHC images. However, the method we present can also be applied to other types of staining. As a proof of principle, we have arbitrarily chosen four sample H&E images and restained them using a orange-blue color map (Fig 8). Unlike in H-DAB IHC images, foreground and background are not clearly defined in these H&E images. Yet, it can be appreciated that some structures in the image are more clearly visible after re-staining (e.g. aspergillus in Fig 8I and 8J) and that virtual re-staining corrects discontinuities in the original color maps (e.g. Fig 8C, 8K and 8O). Also, virtual re-staining inherently corrects for illumination: While the original images in Fig 8A, 8E, 8I and 8M are not equally bright, these differences are removed after virtual re-staining (Fig 8B, 8F, 8J and 8N). Furthermore, we found that virtual re-staining can be successfully applied to Giemsa-stained images of bone marrow biopsies. In  Fig 9, it can be seen that contrast between cytoplasm and cell nucleus is markedly increased by re-staining Giemsa stained images of human bone marrow. Discussion Digital re-staining improves perceptual contrast in IHC images By using the method we describe in this study, pathologists can be enabled to visually perceive more information about the microscopic structures in an image. The main reason is that the bivariate color maps presented in this study are optimized for human visual perception so that a human observer is enabled to extract more information from looking at a processed image. Using our method, the object-to-background contrast can be markedly increased by a factor of 2.56 in phantom images and up to a factor of 2.17 (equals an improvement of approx. 117%) in eight sets of real images.

New Colors for Histology
It is important to note that this method does not alter objective information content of images: The information content of a histological image is determined by sample processing, staining methods and optical properties of the digitization system. However, as shown above, the way of displaying histological images to human observers is not well suited for transmitting a maximal amount of the available information. The reason for this shortcoming is that of all colors distinguishable by the human visual system, histological images use only a very small subset. Using the method we present in this study, the numbers of distinct colors in a given image can be retrospectively optimized so that a higher percentage of the available contrast information can be perceived by an observer.

Compliance with digital image ethics and comparison to other medical imaging methods
Scientific data in general, and digital images in particular, should not be arbitrarily 'beautified'. Strict standards are necessary to ensure that images are not changed in any way that changes the underlying data. Cromey et al. have proposed a widely accepted set of rules for handling digital images [37]. One of the guidelines they give is that the use of software filters to improve image quality is usually not recommended. Yet, digital image enhancement according to objective protocols is widely used in medical imaging. Diagnostic imaging technologies such as CT and MR imaging produce data that is heavily edited by smoothing kernels and windowing to make most of the information visible to human observers. Furthermore, CT and MR imaging data are routinely digitally colored using a determined color map [13][14][15]. This has been shown to increase diagnostic accuracy in some settings [12].
Also, as explained above, immunostained histological images are in fact bivariate data sets where two stain intensities are displayed as a color that derives from a determined mixture of the two stain contributions. Normally, this bivariate color map cannot be explicitly viewed by an observer but is implicitly represented in the image. We employ a novel technique to extract the inherent bivariate color map from a given image. Having taken this abstraction step, the image can be treated as any two-dimensional dataset displayed with a bivariate color map. For this general case, there is a lot of experience in the literature [38,39]. Several authors have shown how to optimally display bivariate color sets and there are a number of practical instructions on how to design bivariate color maps for scientific data [40,41]. We employ this knowledge on datasets from histological images to re-create a digitally re-stained image.
Furthermore, we encourage users of our technique to keep the original data as pointed out by Cromey et al. [37]. If users are in doubt whether structures in the enhanced image are of diagnostic relevance, an enhanced and an original image could be viewed side by side to arrive at an accurate diagnostic decision.
In summary, we offer a strictly deterministic and reproducible way of automatically extracting the implicit color map and applying a new bivariate color map to a given data set, i.e. an image. Our method does not arbitrarily 'beautify' a given image but is a way of making a larger percentage of the existing information available to the visual system of a human observer. These procedures are already standard approaches in other medical imaging entities but have never been applied and validated in the context of histopathological imaging.

Digital re-staining mitigates handicap of pathologists with impaired color vision
Approximately 8% of all males and 0.4% of all females are affected by anomalous color vision [42,43]. Most of them suffer from red-green deficiency (deuteranomaly) that is X-chromosomally linked [42,44]. To our knowledge, it is presently unclear whether diagnoses made by deuteranomalous pathologists differ from those made by fully trichromatic pathologists [45]. However, it is conceivable that deuteranomalous observers might evaluate a colored image differently than the trichromatic population. We show that while some color maps are preserved after dichromacy simulation, other color maps lose most of their perceptual contrast. This is especially true for the standard blue-brown color maps used in immunohistology (S3 Fig,  panel A). Other color maps, such as the proposed blue-yellow or red-blue maps are more robust with respect to color blindness simulation (S3 Fig, panels B and C). Thus, digital restaining of histological images offers the possibility to apply color maps that mitigate the handicap of pathologists with impaired color vision by using color coding that can be separated by the individual cone dysfunction. One color in the blue area of the color space for the background-as in H-DAB-histological images-and the other color in the orange or red area improves discrimination of stained cells and assists observers with color deficiency in their image perception.

Limitations and perspectives
In the present study, we developed and evaluated a method to digitally re-stain histological images. We showed that our improved color maps markedly increase perceptual contrast in clinically relevant images. However, our approach does not guarantee a global optimum for a new color map. In further studies, it would be worthwhile to combine our approach with a sophisticated multi-parameter optimizer (such as the one described by Hutter et al., see [46]). Also, as a perspective, it would be interesting to quantify the diagnostic accuracy for different color maps in different common tasks in histopathology in future studies. Apart from histology, it is conceivable to apply the described method to other imaging modalities, such as MR imaging or MR microscopy [47].

Application in a typical diagnostic setting
We envision that the presented method can be incorporated in digital pathology image viewing systems. For example, in a typical histopathological diagnostic setting, a pathologist might want to view and count Ki67 positive cells in a Hematoxylin-DAB stained section of tumor tissue. For some cells, the decision whether or not they are Ki67 positive is usually easy. However, there might be some cells for which the decision is not clear because the pathologist cannot exactly visually discriminate the color hues. This scenario is possible even if the staining procedure and optical properties of the microscope are optimal and even if the pathologist has a perfectly normal color vision (trichromacy). In this case, one reason why the pathologist in this scenario cannot exactly discriminate the Ki67 status of a cell is that his or her visual system physiologically cannot discriminate the colors in the image.
In a digital pathology environment, the pathologist could then make use of alternative color maps and digitally re-stain the image in real time. As common in radiology, the source image and the modified image could be viewed side-by-side. In this situation, the pathologist could choose a color map that maximizes his or her ability to recognize objects in the image. Therefore, his or her diagnostic ability to discriminate Ki67 positive from Ki67 negative cells would be increased. In the end, this would potentially reduce ambiguities in visual evaluation of histopathological samples, increase diagnostic accuracy and in the end benefit the patient. A) Original image, B) Digitally re-stained image, C) segmented DAB intensity channel, D-E) Foreground-to-background contrast for the original colors and the colors of the re-stained images. F) The cleaned foreground was created by removing small objects from the raw foreground mask. (TIFF) S3 Fig. Color blindness simulation. A) Original image, B) and C) show digitally re-stained images. Below, the three images are shown after deuteranopia simulation and after tritanopia simulation (same order as top row). It can be seen that contrast in B and C is largely preserved after simulation, while contrast in A is largely lost after simulation. (TIFF) S1 File. Additional experimental data and parameters.