Currently, the forward projection resulting in the intensity images can only be done with a numpy backend. It would be great if the images could also be generated using pytorch, because then they could be used in the reconstruction process. In fact, by using a loss function based solely on the intensity images (ground truth and current), we should be able to reconstruct the birefringence and optic axis.
Big picture todos
[x] run forward_intensity.py with BackEnds.PyTorch selected
[x] verify that the gradients do not break
[x] write test to verify that the numpy and pytorch (with and without all_ray_at_once) methods generate the same resulting intensity images
Currently, the forward projection resulting in the intensity images can only be done with a numpy backend. It would be great if the images could also be generated using pytorch, because then they could be used in the reconstruction process. In fact, by using a loss function based solely on the intensity images (ground truth and current), we should be able to reconstruct the birefringence and optic axis.
Big picture todos
forward_intensity.py
with BackEnds.PyTorch selectedIntensity calculation method
We call the same function that we use to calculate the retardance and azimuth images, just with the parameter
intensity=True
. The function returns a list of intensity images instead of a list of the retardance image and azimuth image. https://github.com/PolarizedLightFieldMicroscopy/forward-model/blob/a019a295dfc8b1d114c7cab103b17baf0afbe35d/VolumeRaytraceLFM/birefringence_implementations.py#L760-L761Functions which need pytorch versions
https://github.com/PolarizedLightFieldMicroscopy/forward-model/blob/a019a295dfc8b1d114c7cab103b17baf0afbe35d/VolumeRaytraceLFM/birefringence_implementations.py#L1058-L1065 https://github.com/PolarizedLightFieldMicroscopy/forward-model/blob/a019a295dfc8b1d114c7cab103b17baf0afbe35d/VolumeRaytraceLFM/birefringence_implementations.py#L760-L776 A function similar to the one below may need to be made for computing all the rays at once. https://github.com/PolarizedLightFieldMicroscopy/forward-model/blob/a019a295dfc8b1d114c7cab103b17baf0afbe35d/VolumeRaytraceLFM/birefringence_implementations.py#L994-L1023
Experimental consideration
With the PolScope, the retardance and azimuth images are actually calculated from intensity images, as shown in the schematic below.