PolarizedLightFieldMicroscopy / BirTomo

Geometrical Birefringence Tomography
BSD 3-Clause "New" or "Revised" License
4 stars 2 forks source link

python versions Run Pytest

BirTomo: Birefringence Tomography

Polarized light field microscopy forward model and inverse model using geometrical optics and Jones Calculus.

Installation

Run the following code to create a virtual environment will all the necessary and relevant packages:

conda create --name bir-tomo python=3.11 --yes
conda activate bir-tomo
pip install -e .

If you have a CUDA on your computer, or having issues with pytorch, try following the instructions here for installing pytorch.

To download an editable installation in developer mode:

pip install -e .[dev]

Requirements

See pyproject.toml for the dependencies.

Necessary packages:

Birefringence tomography

To be updated soon...

For the forward model, the main script is run_simulations.py. The workflow within that script is the following:

  1. Create a birefringent raytracer.
  2. Compute the ray geometry.
  3. Create a volume to image.
  4. Raytrace through the volume.

For the iterative reconstruction, the main script is run_recon.py. The workflow within that script is the following:

  1. Generate birefringence and retardance images with forward model that will serve as the ground truth (measurement) images.
    1. Create a birefringent raytracer.
    2. Compute the ray geometry.
    3. Create a volume to image.
    4. Raytrace through the volume.
  2. Make an initial guess of the volume.
  3. Create an optimizer.
    1. Choose to optimize for the birefringence $\Delta n$ and optic axis $\hat{a}$
    2. Choose an optimization method, such as gradient descent.
  4. Define a loss function to be minimized.
  5. Perform many iterations of the estimated volume being updated from the gradients of the loss function with respect to the estimated volume.

Open the streamlit page locally with

streamlit run User_Interface.py

You can also use our streamlit app that runs on the streamlit cloud and uses the code in the stream branch: https://polarizedlightfieldmicroscopy-forward-mo-user-interface-dc1r85.streamlit.app/

Testing