An apparatus for virtually staining a tissue sample, the apparatus comprising a computer system comprising: an initial image generation module configured to receive, from a hyperspectral detector, electromagnetic radiation reflected or transmitted by the tissue sample and generate an electronic image of the tissue sample based on the electromagnetic radiation reflected or transmitted by the tissue sample, wherein the electronic image comprises a plurality of pixels, each pixel or group of pixels associated with a waveform signature; wherein the computer system is configured to: identify the waveform signatures associated with each pixel or group of pixels; identify that a first waveform signature associated with a first pixel of the plurality of pixels forming the electronic image comprises one or more waveforms (902, 904) corresponding to multiple substances in the tissue sample at a location associated with the first pixel; and identify each of the one or more waveforms that are comprised in the first waveform signature; the computer system further comprising: a virtual staining module configured to: apply a virtual stain transform to each pixel or group of pixels of the electronic image, such that each pixel or group of pixels associated with an identified waveform is transformed to one output pixel according to the virtual stain transform, wherein the virtual stain transform is developed for a particular stain and applying the virtual stain transform comprises: transforming each of the one or more waveforms that are comprised in the first waveform signature into one or more output waveforms according to the virtual stain transform; combining the one or more output waveforms to determine a single output waveform for the first waveform signature; and identifying a first output pixel associated with the single output waveform; and wherein the computer system is configured to generate a virtually stained image of the tissue sample, wherein the virtually stained image comprises the output pixels including the first output pixel. an initial image generation module configured to receive, from a hyperspectral detector, electromagnetic radiation reflected or transmitted by the tissue sample and generate an electronic image of the tissue sample based on the electromagnetic radiation reflected or transmitted by the tissue sample, wherein the electronic image comprises a plurality of pixels, each pixel or group of pixels associated with a waveform signature; wherein the computer system is configured to: identify the waveform signatures associated with each pixel or group of pixels; identify that a first waveform signature associated with a first pixel of the plurality of pixels forming the electronic image comprises one or more waveforms (902, 904) corresponding to multiple substances in the tissue sample identify the waveform signatures associated with each pixel or group of pixels; identify that a first waveform signature associated with a first pixel of the plurality of pixels forming the electronic image comprises one or more waveforms (902, 904) corresponding to multiple substances in the tissue sample at a location associated with the first pixel; and identify each of the one or more waveforms that are comprised in the first waveform signature; the computer system further comprising: a virtual staining module configured to: apply a virtual stain transform to each pixel or group of pixels of the electronic image, such that each pixel or group of pixels associated with an identified waveform is transformed to one output pixel according to the virtual stain transform, wherein the virtual stain transform is developed for a particular stain and applying the virtual stain transform comprises: transforming each of the one or more waveforms that are comprised in the first waveform signature into one or more output waveforms according to the virtual stain transform; combining the one or more output waveforms to determine a single output waveform for the first waveform signature; and identifying a first output pixel associated with the single output waveform; and wherein the computer system is configured to generate a virtually stained image of the tissue sample, wherein the virtually stained image comprises the output pixels including the first output pixel. apply a virtual stain transform to each pixel or group of pixels of the electronic image, such that each pixel or group of pixels associated with an identified waveform is transformed to one output pixel according to the virtual stain transform, wherein the virtual stain transform is developed for a particular stain and applying the virtual stain transform comprises: transforming each of the one or more waveforms that are comprised in the first waveform signature into one or more output waveforms according to the virtual stain transform; combining the one or more output waveforms to determine a single output waveform for the first waveform signature; and identifying a first output pixel associated with the single output waveform; transforming each of the one or more waveforms that are comprised in the first waveform signature into one or more output waveforms according to the virtual stain transform; combining the one or more output waveforms to determine a single output waveform for the first waveform signature; and identifying a first output pixel associated with the single output waveform; and wherein the computer system is configured to generate a virtually stained image of the tissue sample, wherein the virtually stained image comprises the output pixels including the first output pixel.