Virtual Histopathological Stain Transformation Improves Detection and Quantification of Liver Fibrosis

by Christos Evangelou, MSc, PhD – Medical Writer and Editor

Liver fibrosis is characterized by the accumulation of collagen and other extracellular matrix proteins in the liver, causing scar tissue formation. This histopathological condition is common in patients with chronic liver disease and liver inflammation. Therefore, determining the extent of liver fibrosis can aid the management of patients with liver disease and liver transplant recipients. Histopathologic evaluation using Masson’s trichrome stain or hematoxylin and eosin (H&E) is the preferred method for determining the degree of fibrosis in liver specimens.

In a recent study, researchers from the University of Louisville developed an artificial intelligence (AI)-assisted virtual histopathological stain transformation system that detects and quantifies fibrosis in liver tissues by generating virtual Masson’s trichrome and H&E stains.1 The system enabled highly accurate histopathological evaluation of liver fibrosis by producing realistic trichrome images with high similarity to trichrome-stained slides.

“By improving the accuracy of histopathological evaluation of liver fibrosis, the proposed system can aid in the early diagnosis of liver failure in chronic liver disease and improve the outcomes and viability of liver transplants,” said Ayman El-Baz, PhD, Professor of Bioengineering at the University of Louisville and corresponding author of the study.

“Our findings support that the adoption of digital pathology technologies in laboratories and healthcare centers can help improve the time and cost efficiencies in pathology laboratories,” he added.

The study was published as a journal pre-proof for Medical Image Analysis.

Study Rationale: Improving the Diagnostic Accuracy of Trichrome Staining

H&E staining has multiple advantages over Masson’s trichrome staining, including lower costs and faster turnaround times. However, staining standardization and reproducibility remain challenges when using H&E staining to determine the degree of liver fibrosis.

“Trichrome slides can be regarded as the gold standard for assessing fibrosis in the liver; however, the processing and availability of trichrome slides can be limited in certain clinical settings or during liver transplantations,” Dr El-Baz said.

To improve the ability of trichrome staining to detect and quantify fibrous tissue in H&E whole slide images (WSIs), the team developed a novel AI model to generate virtual trichrome slides to be used in lieu of the real slides. The training pipeline uses conditional generative adversarial networks (cGAN) to learn texture features associated with collagen fibers in H&E images. By transforming pixel-level information, the proposed model generates virtual trichrome slides using texture patterns from H&E images.1

“Our comprehensive training pipeline features an automatic WSI registration algorithm, which qualifies the training slides stained with H&E and Masson’s trichrome for the cGAN model,” Dr El-Baz explained.

“We hypothesized that creating a virtual trichrome slide will enhance the diagnostic accuracy of trichrome staining in assessing liver fibrosis, not only because it will make virtual trichrome slides available in the clinical settings, but also it will enable the assessment of the same tissue section at two staining domains simultaneously,” he noted.

cGAN-based System for Fibrosis Detection and Quantification in H&E WSIs

The training pipeline for the proposed virtual staining system uses digital H&E-stained WSIs, destained tissue slides, and Masson’s trichrome-stained WSIs. Paired H&E- and Masson’s trichrome-stained images are aligned, and a cGAN architecture is used to train the transformation model, which transforms H&E images into virtual Masson’s trichrome images.1

“Our training pipeline features a protocol to destain and restain the tissue sections to have paired slides,” said Dr El-Baz. “This allowed us to assess both H&E and Masson’s trichrome stains on the same tissue slide, improving the accuracy of histopathological evaluation.”

By using pixel-level image blending, the cGAN architecture can generate enhanced Masson’s trichrome virtual images. Multiple iterations of adversarial training ensure that the generated virtual images closely resemble real Masson’s trichrome-stained slides.1

Instead of using U-Net-based segmentation or other segmentation methods, the proposed framework uses color thresholding to detect and quantify fibrotic tissue in the generated virtual Masson’s trichrome images.

cGANs-based Stain Transformation Generates Realistic Virtual Trichrome Images

To assess the performance of the proposed cGAN-based model, the team applied the model to liver tissues collected during liver transplantation to generate virtual Masson’s trichrome images and detect liver fibrosis.

The use of pixel-level image blending in the registration algorithm resulted in accurate registration and alignment of virtual Masson’s trichrome images and their corresponding H&E-stained images. The resulting mean target registration error was 0.84 μm (95% CI, 0.76 to 0.92 μm), which is considered to be low.1

Ablation studies to assess how different algorithm parameters affect its performance showed that using eight layers at a patch size of 256 achieved the best performance.1

 cGAN-based Stain Transformation Accurately Segments Fibrosis in Liver Tissue

The proposed cGAN-based learning model was superior to the state-of-the-art CycleGAN learning algorithm in fibrosis segmentation directly in H&E images or in virtual Masson’s trichrome images, suggesting that the proposed model accurately segments fibrosis in liver tissue. Vein branches, artery walls, and the bile duct could also be easily identified in the generated Masson’s trichrome images.

The ability of cGAN-based stain transformation to identify and quantify fibrotic tissue in liver specimens was validated in two independent sets of samples, confirming the generalizability and reproducibility of the proposed pipeline.

“By using cGAN-based training, our model can learn direct image-to-image translation functions between the histology stains,” Dr El-Baz explained. “This, in combination with training the model perfectly paired patches generated by our developed rigid-body WSI alignment algorithm, enabled us to improve fibrosis segmentation in liver tissue,” he added.

 Looking Ahead

Although validation of the AI training model confirmed the ability of the system to produce virtual Masson’s trichrome images from H&E WSIs and detect fibrous tissue in virtual images, the model was tested on only two stains.

“In our future work, we will extend the usage of our system to include other stains,” Dr El-Baz noted. He added that the model could be improved to learn how to exclude defective patches from the training set.


  1. Naglah A, Khalifa F, El-Baz A, Gondim D. Conditional GANs based system for fibrosis detection and quantification in Hematoxylin and Eosin whole slide images. Med Image Anal. 2022:102537. doi:


Share This Post

Leave a Reply