{
 "id": "ep1z6zqhbk",
 "slug": "virtual-staining",
 "title": "Virtual staining",
 "updated": "2026-10-15",
 "topic_path": [
  {
   "id": "life",
   "label": "Life and health",
   "api_url": "https://www.edgepedia.org/api/v1/topics/life"
  },
  {
   "id": "life.health",
   "label": "Human health and medicine",
   "api_url": "https://www.edgepedia.org/api/v1/topics/life.health"
  }
 ],
 "geo": [
  {
   "id": "geo.nongeo.t2001.life.health",
   "label": "Non-geographic · 2001 to 2020: Human health and medicine",
   "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t2001.life.health",
   "path": [
    {
     "id": "geo.nongeo",
     "label": "Non-geographic",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo"
    },
    {
     "id": "geo.nongeo.t2001",
     "label": "Non-geographic · 2001 to 2020",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t2001"
    },
    {
     "id": "geo.nongeo.t2001.life",
     "label": "Life and health",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t2001.life"
    },
    {
     "id": "geo.nongeo.t2001.life.health",
     "label": "Human health and medicine",
     "api_url": "https://www.edgepedia.org/api/v1/geo/geo.nongeo.t2001.life.health"
    }
   ]
  }
 ],
 "excerpt": "Virtual staining is a deep-learning technique in computational microscopy that generates stained-appearing images of tissue from label-free inputs such as autofluorescence, replacing chemical staining with an image-to-image translation network.",
 "snippet": "Virtual staining is a deep-learning technique in computational microscopy that generates stained-appearing images of tissue from label-free inputs such as autofluorescence, replacing chemical staining with an image-to-image translation network.",
 "node": "life.health",
 "markdown": "# Virtual staining\n\nVirtual staining is a deep-learning technique in computational microscopy that generates stained-appearing images of tissue or cells from label-free inputs such as autofluorescence, replacing chemical staining with an image-to-image translation network. In the founding demonstration, a convolutional neural network trained with a generative adversarial network (GAN) transformed wide-field autofluorescence images of unlabelled tissue sections into images equivalent to bright-field images of histologically stained versions of the same samples.<sup>[1](https://doi.org/10.1038/s41551-019-0362-y)</sup> The approach bypasses labor-intensive and costly staining procedures and serves as a blueprint for virtual staining with other label-free imaging modalities.<sup>[1](https://doi.org/10.1038/s41551-019-0362-y)</sup>\n\n| Key fact | Detail |\n|---|---|\n| Input modalities | Wide-field autofluorescence (founding work), bright field, quantitative phase, reflectance confocal microscopy, Fourier ptychographic microscopy<sup>[1](https://doi.org/10.1038/s41551-019-0362-y)</sup><sup> • </sup><sup>[2](https://link.springer.com/article/10.1007/s11307-020-01508-6)</sup><sup> • </sup><sup>[3](https://pmc.ncbi.nlm.nih.gov/articles/PMC12904525/)</sup> |\n| Dominant architecture | GAN with a U-Net generator and a discriminator<sup>[4](https://escholarship.org/content/qt6sr2k90m/qt6sr2k90m.pdf)</sup> |\n| Typical image quality | SSIM above 0.8 and PSNR above 20 for well-preserved autopsy samples (RegiStain)<sup>[5](https://www.nature.com/articles/s41467-024-46077-2)</sup> |\n| Training data | More than 16,000 paired microscopic images (>0.7 TB) in one 2024 study<sup>[5](https://www.nature.com/articles/s41467-024-46077-2)</sup> |\n| Inference speed | A few minutes per whole-slide image on a standard computer; 3 s per image in one carotid-artery study<sup>[4](https://escholarship.org/content/qt6sr2k90m/qt6sr2k90m.pdf)</sup><sup> • </sup><sup>[2](https://link.springer.com/article/10.1007/s11307-020-01508-6)</sup> |\n| Clinical status | No accepted algorithms for clinical use and no known ongoing clinical trials as of 2024<sup>[6](https://doi.org/10.1016/j.tibtech.2024.02.009)</sup> |\n\n## How it works\n\nVirtual staining rests on the premise that label-free contrast carries morphological and biochemical information predictive of where a stain will bind. Autofluorescence, phase, and reflectance signals all encode tissue composition, so a network can learn the mapping from that contrast to the color and texture pattern a histological stain would produce. The task is framed as image-to-image translation.<sup>[7](https://www.sciencedirect.com/science/article/pii/S0023683723000132?via%3Dihub)</sup>\n\nTwo training formulations exist. Supervised models train on pixel-wise registered pairs of label-free and truly stained images of the same section, which constrains the output to the ground truth. Unsupervised models use unpaired images and cycle-consistency loss; [CycleGAN](https://www.edgepedia.org/cyclegan), the most commonly used unsupervised method, employs two generator-discriminator pairs for two-way translation.<sup>[7](https://www.sciencedirect.com/science/article/pii/S0023683723000132?via%3Dihub)</sup> Unsupervised training is attractive because adjacent tissue sections are not fully aligned due to the three-dimensional structure of tissue, but it carries a cost: supervised models reproduced basal cells in mouse prostate epithelium that the unsupervised CycleGAN model did not accurately represent.<sup>[7](https://www.sciencedirect.com/science/article/pii/S0023683723000132?via%3Dihub)</sup>\n\n## How it is done\n\nThe workflow consists of image data collection, image preprocessing, network training, computational validation, histological validation, and task-specific validation.<sup>[6](https://doi.org/10.1016/j.tibtech.2024.02.009)</sup> Collection means acquiring label-free images and truly stained counterparts of the same tissue, then registering them; exact registration of input and target pixels is essential for accurate image-to-image regression, and all implementations require paired images for truthful validation because of the hallucination-gap.<sup>[8](https://link.springer.com/article/10.1186/s43074-023-00113-4)</sup>\n\nGANs are the most commonly used framework, with generators typically built on the U-Net encoder-decoder architecture introduced by Ronneberger, Fischer, and Brox in 2015 for biomedical image segmentation, and discriminators trained to distinguish virtually stained from truly stained images.<sup>[4](https://escholarship.org/content/qt6sr2k90m/qt6sr2k90m.pdf)</sup><sup> • </sup><sup>[9](https://doi.org/10.48550/arxiv.1505.04597)</sup> Pixel-wise losses regularize the generator against hallucination: mean absolute error, mean square error, SSIM, Huber loss, reversed Huber (BerHu) loss, color distance metrics, and total variation regularization.<sup>[4](https://escholarship.org/content/qt6sr2k90m/qt6sr2k90m.pdf)</sup> In RegiStain, the generator loss combines a BerHu loss on the registered image pair, a total-variation term, and an adversarial term.<sup>[5](https://www.nature.com/articles/s41467-024-46077-2)</sup>\n\nRegistration itself can dominate the effort. RegiStain trains a registration network that outputs a displacement vector field concurrently with the staining network, removing the need for pixel-level pre-registered pairs and reducing training from months to a couple of days.<sup>[5](https://www.nature.com/articles/s41467-024-46077-2)</sup> Validation compares virtual output against true stains computationally (SSIM, PSNR) and through blinded pathologist reading.<sup>[6](https://doi.org/10.1016/j.tibtech.2024.02.009)</sup>\n\n## Origin\n\nThe founding paper, \"Virtual histological staining of unlabelled tissue-autofluorescence images via deep learning\" by Yair Rivenson and colleagues in the group of [Aydogan Ozcan](https://www.edgepedia.org/aydogan-ozcan), was published in Nature Biomedical Engineering in 2019.<sup>[1](https://doi.org/10.1038/s41551-019-0362-y)</sup> A blind comparison by board-certified pathologists of virtual versus standard staining, on human salivary gland, thyroid, kidney, liver, and lung sections with different stain types, showed no major discordances.<sup>[1](https://doi.org/10.1038/s41551-019-0362-y)</sup> Earlier work the field built on includes digital staining of live cell cultures with immunofluorescence dyes from phase microscopy using a U-Net model, which enabled extensions into 3D digital staining and virtual labeling of mitochondria.<sup>[8](https://link.springer.com/article/10.1186/s43074-023-00113-4)</sup>\n\n## Variants\n\n**Virtual H&E** is generated from autofluorescence, bright field, or phase inputs.<sup>[1](https://doi.org/10.1038/s41551-019-0362-y)</sup><sup> • </sup><sup>[2](https://link.springer.com/article/10.1007/s11307-020-01508-6)</sup><sup> • </sup><sup>[10](https://pmc.ncbi.nlm.nih.gov/articles/PMC12532334/)</sup> **Virtual special stains** extend the same framework: the founding work released trained models for Masson's [trichrome stain](https://www.edgepedia.org/trichrome-stain) (liver) and Jones stain (kidney) through a Fiji-based plugin,<sup>[1](https://doi.org/10.1038/s41551-019-0362-y)</sup> and a carotid-artery study generated H&E, picrosirius red, and orcein from bright-field inputs.<sup>[2](https://link.springer.com/article/10.1007/s11307-020-01508-6)</sup>\n\n**Stain-to-stain transformation** generates one stain from another; it is hard for supervised learning because a tissue section is typically stained only once, making paired images of different stains practically impossible to acquire.<sup>[4](https://escholarship.org/content/qt6sr2k90m/qt6sr2k90m.pdf)</sup> A 2025 method addressed this with a single shared H&E encoder and multiple stain decoders, generating eight different virtual stains from a single H&E slide.<sup>[11](https://journals.plos.org/ploscompbiol/article?id=10.1371%2Fjournal.pcbi.1013516)</sup> **In vivo virtual staining** uses reflectance confocal microscopy to create virtual H&E of human skin tissue, described as a \"virtual biopsy\".<sup>[4](https://escholarship.org/content/qt6sr2k90m/qt6sr2k90m.pdf)</sup>\n\n## Applications\n\nRegiStain applied virtual staining to unlabeled autopsy tissue, reaching mean SSIM 0.82 and PSNR 20.32 for well-preserved samples.<sup>[5](https://www.nature.com/articles/s41467-024-46077-2)</sup> FPM2Stain Net (2025) combines physics-guided [Fourier ptychographic microscopy](https://www.edgepedia.org/fourier-ptychographic-microscopy) reconstruction with a multi-task conditional GAN to synthesize H&E, DAPI, LAP2, and panCK stains at greater than 10× pixel-level upsampling from 4× inputs, and its full pipeline needs over five times less inference time than the diffusion-based DiffuStain on identical hardware.<sup>[3](https://pmc.ncbi.nlm.nih.gov/articles/PMC12904525/)</sup> A 2024 self-supervised GAN based on contrastive learning performs virtual staining of single-channel FPM grayscale images from unpaired data, cutting color FPM collection time by 2/3.<sup>[12](https://www.mdpi.com/2076-3417/14/4/1662)</sup>\n\n## Limitations and alternatives\n\n**Hallucination and validation.** Pixel-based metrics such as PCC, SSIM, PSNR, and MSE dominate quality assessment, but they may not indicate utility for downstream clinical or biological tasks.<sup>[10](https://pmc.ncbi.nlm.nih.gov/articles/PMC12532334/)</sup> All implementations require paired images for truthful validation because of the hallucination-gap.<sup>[8](https://link.springer.com/article/10.1186/s43074-023-00113-4)</sup>\n\n**Registration and domain shift.** Registration errors measurably degrade output: removing RegiStain's registration network dropped SSIM and PSNR to 0.78 and 18.25 and significantly shifted nuclei number and size distributions (\\( P < 0.05 \\)).<sup>[5](https://www.nature.com/articles/s41467-024-46077-2)</sup> Sample preparation matters: FID scores worsened with thicker sections (peaking at 12 μm, with 5 μm best), deparaffinized samples scored lowest, and coverslipped samples showed vignetting that overpowered virtual staining.<sup>[7](https://www.sciencedirect.com/science/article/pii/S0023683723000132?via%3Dihub)</sup> Scanner-related domain shift can be flagged by discriminator confidence maps but is not eliminated.<sup>[11](https://journals.plos.org/ploscompbiol/article?id=10.1371%2Fjournal.pcbi.1013516)</sup>\n\n**When not to stain virtually.** When the downstream task network's capacity is sufficiently high, virtual staining provided no improvement and in some cases degraded segmentation or classification performance compared with label-free inputs, so task network capacity should be considered when deciding whether to perform virtual staining.<sup>[10](https://pmc.ncbi.nlm.nih.gov/articles/PMC12532334/)</sup>\n\n**Clinical status.** As of a 2024 review, the technique remains in the development phase, with no accepted algorithms for clinical use and no known ongoing clinical trials; adoption would require retrospective validation and prospective testing for each task separately, followed by product licensing, and standardization is the key challenge to replacing standard H&E and other stains.<sup>[6](https://doi.org/10.1016/j.tibtech.2024.02.009)</sup>\n\n## References\n\n1. [Yair Rivenson and colleagues (2019). Virtual histological staining of unlabelled tissue-autofluorescence images via deep learning. Nature Biomedical Engineering.](https://doi.org/10.1038/s41551-019-0362-y)\n2. [Deep Learning for Virtual Histological Staining of Bright-Field Microscopic Images of Unlabeled Carotid Artery Tissue (Molecular Imaging and Biology)](https://link.springer.com/article/10.1007/s11307-020-01508-6)\n3. [FPM2Stain Net: physics-guided super-resolution and multi-modal virtual staining for digital histopathology](https://pmc.ncbi.nlm.nih.gov/articles/PMC12904525/)\n4. [Deep learning-enabled virtual histological staining of biological samples (review, author manuscript)](https://escholarship.org/content/qt6sr2k90m/qt6sr2k90m.pdf)\n5. [Virtual histological staining of unlabeled autopsy tissue (RegiStain)](https://www.nature.com/articles/s41467-024-46077-2)\n6. [Virtual staining for histology by deep learning (Trends in Biotechnology, 2024)](https://doi.org/10.1016/j.tibtech.2024.02.009)\n7. [Unstained Tissue Imaging and Virtual Hematoxylin and Eosin Staining of Histologic Whole Slide Images](https://www.sciencedirect.com/science/article/pii/S0023683723000132?via%3Dihub)\n8. [Digital staining in optical microscopy using deep learning - a review (PhotoniX)](https://link.springer.com/article/10.1186/s43074-023-00113-4)\n9. [Ronneberger, Olaf, Fischer, Philipp, Brox, Thomas (2015). U-Net: Convolutional Networks for Biomedical Image Segmentation. arXiv (Cornell University).](https://doi.org/10.48550/arxiv.1505.04597)\n10. [On the utility of virtual staining for downstream applications as it relates to task network capacity](https://pmc.ncbi.nlm.nih.gov/articles/PMC12532334/)\n11. [Scalable, trustworthy generative model for virtual multi-staining from H&E whole slide images (PLOS Computational Biology)](https://journals.plos.org/ploscompbiol/article?id=10.1371%2Fjournal.pcbi.1013516)\n12. [A Virtual Staining Method Based on Self-Supervised GAN for Fourier Ptychographic Microscopy Colorful Imaging (Applied Sciences, 2024)](https://www.mdpi.com/2076-3417/14/4/1662)\n\n---\n*Topic: Encyclopedia › Life and health › Human health and medicine*\n\n*Initially written Sep 29, 2026 · Edited: Oct 15, 2026*\n\n*Copyright 2026 EdgeChat AI, a subsidiary of Biostate AI.*\n\nLicense: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license\n",
 "same_as": [],
 "url": "https://www.edgepedia.org/virtual-staining",
 "markdown_url": "https://www.edgepedia.org/virtual-staining.md",
 "license": {
  "name": "Edgepedia Community License 1.0",
  "url": "https://www.edgepedia.org/edgepedia/license",
  "summary": "Free with credit, commercial use included. AI training is open to everyone. For other uses, organizations over USD 100M in revenue or 100M monthly users license separately.",
  "spdx": "LicenseRef-Edgepedia-Community-1.0"
 },
 "credit": "\"Virtual staining\", Edgepedia (EdgeChat), https://www.edgepedia.org/virtual-staining. Edgepedia Community License 1.0.",
 "credit_md": "\"[Virtual staining](https://www.edgepedia.org/virtual-staining)\", Edgepedia (EdgeChat), [https://www.edgepedia.org/virtual-staining](https://www.edgepedia.org/virtual-staining). [Edgepedia Community License 1.0](https://www.edgepedia.org/edgepedia/license).",
 "credit_html": "\"<a href=\"https://www.edgepedia.org/virtual-staining\">Virtual staining</a>\", Edgepedia (EdgeChat), <a href=\"https://www.edgepedia.org/virtual-staining\">https://www.edgepedia.org/virtual-staining</a>. <a href=\"https://www.edgepedia.org/edgepedia/license\">Edgepedia Community License 1.0</a>.",
 "speakable": "Virtual staining is a deep-learning technique in computational microscopy that generates stained-appearing images of tissue from label-free inputs such as autofluorescence, replacing chemical staining with an image-to-image translation network."
}
