tlambert03 / microsim

http://www.talleylambert.com/microsim/
BSD 3-Clause "New" or "Revised" License
14 stars 6 forks source link

Integrate fluorophore into the simulation. #22

Closed ashesh-0 closed 3 months ago

ashesh-0 commented 4 months ago

Overview of the tentative approach

The broad goal here is to integrate fluorophore and their excitation and emmision spectra into the simulation pipeline.

  1. The top level class which needs to change is Sample.
  2. Currently optical image is of shape ZxHxW but it might help if it is made to have shape FxZxHxW, where F represents the frequency/wavelength dimension. The index in this dimension will represent a wavelength interval. The values in this dimension will represent the emission spectra photon count probablity or something equivalent for that wavelength interval.
  3. For compute efficiency, we can bin the frequencies for every fluorophore, possibly using quantiles. So, this dimension will have small size. This could also mean that the same index will mean different frequency intervals for different fluorophores.
  4. We should then ideally have multiple psfs, one for each frequency interval. Later we may as well try to adjust for the shift in the focal plane of these different frequency intervals. Initial version may ignore the out of plane artefact.
  5. For fluorophore excitation, we can have a probablistic model using the excitation spectra information. In case we have multiple monocromatic lasers as excitation sources, we can do a weighted average to obtain the probablity of excitation. Something similar can be done for light with a continuous frequency range.
  6. Finally, the optical image can then be ‘truncated’ with the use of emmision filters.

The general objective could be to pre-compute as much as possible in the init methods for run time efficiency.

tlambert03 commented 4 months ago

hell yes 😍.

Currently optical image is of shape ZxHxW but it might help if it is made to have shape FxZxHxW

definitely

For compute efficiency, we can bin the frequencies for every fluorophore, possibly using quantiles. So, this dimension will have small size.

Yeah, and it would be nice to allow the user to parametrize this binning. In many cases, we will likely also want it to be affected by the emission waveband(s) (i.e. the truncation step that you mentioned at the end). That is, if we know we're only going to collect 500-550nm on the emission side, there's no point in calculating anything outside that waveband. For cases where we're measuring multiple channels and want realistic bleedthrough, we'll want that band to be the union of all emission bands.

It would be nice to keep spectral imaging simulations in mind: for example (if we're simulating a spectral detector in the emission path)

We should then ideally have multiple psfs, one for each frequency interval.

absolutely, love that you're thinking about that :)

For fluorophore excitation, we can have a probablistic model using the excitation spectra information.

👍

Finally, the optical image can then be ‘truncated’ with the use of emmision filters.

Yep.

I love all of this! Let me know if it would be helpful to have a quick zoom about any of it before or while you play around with it

tlambert03 commented 3 months ago

closed by #35