PolarizedLightFieldMicroscopy / napari-LF

Light field imaging plugin for napari
BSD 3-Clause "New" or "Revised" License
9 stars 3 forks source link

Allow calibration without a dark frame #52

Open gschlafly opened 10 months ago

gschlafly commented 10 months ago

Often a calibration process is desired even when a dark frame image was not acquired or is not available, https://github.com/PolarizedLightFieldMicroscopy/napari-LF/issues/49.

Solution

Preferred solution

Make the inclusion of the dark frame optional in the calibration process. It is optional in the lfa code, just not in the widget. One way to make this optional in the widget could be to make an empty option available in addition to the list of img_files. Selecting the empty option would need to correspond to the variable being stored as None. https://github.com/PolarizedLightFieldMicroscopy/napari-LF/blob/eb2f5871e22b08a109e3ffd05ce4e29f9575d226/src/napari_lf/_widgetLF_gui.py#L1694-L1708 The PLUGIN_ARGS["calibrate"]["dark_frame_file"] properties may need to be altered. The default value should correspond to no dark frame being used. Perhaps the dark frame field should also be moved from the Required tab to the Optional tab.

https://github.com/PolarizedLightFieldMicroscopy/napari-LF/blob/eb2f5871e22b08a109e3ffd05ce4e29f9575d226/src/napari_lf/_widgetLF_vals.py#L133-L134

Alternative solutions considered

A synthetic dark frame image can be generated to be used in the calibration process. This image should be a black image with the same pixel dimensions as the radiometry image. An option to generate the synthetic dark frame would need to be added to the widget.

Additional context

The dark frame is used to apply a background correction in the calibration process: https://github.com/PolarizedLightFieldMicroscopy/napari-LF/blob/eb2f5871e22b08a109e3ffd05ce4e29f9575d226/src/napari_lf/lfa/lflib/calibration/__init__.py#L555-L560

How the dark frame is included in the calibration

The following lines of code is shows how the dark frame is included. https://github.com/PolarizedLightFieldMicroscopy/napari-LF/blob/eb2f5871e22b08a109e3ffd05ce4e29f9575d226/src/napari_lf/lfa/lfcalibrate.py#L58-L59 Slices of the dark frame are averaged if necessary. https://github.com/PolarizedLightFieldMicroscopy/napari-LF/blob/eb2f5871e22b08a109e3ffd05ce4e29f9575d226/src/napari_lf/lfa/lfcalibrate.py#L189-L193 The dark frame is called in the process of calibrating the radiometry image. https://github.com/PolarizedLightFieldMicroscopy/napari-LF/blob/eb2f5871e22b08a109e3ffd05ce4e29f9575d226/src/napari_lf/lfa/lfcalibrate.py#L272-L274