Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC: GUI layout for recOrder v1.0.0 #442

Draft
wants to merge 57 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
f84063d
draft new main widget layout
ziw-liu Sep 28, 2023
b515d86
remove redundant slider
ziw-liu Sep 29, 2023
954d12c
hack: semi-automated config magicgui
ziw-liu Sep 29, 2023
c95533b
replace typing.List with the builtin generic
ziw-liu Oct 6, 2023
9165057
potential fix for python 3.9
ziw-liu Oct 9, 2023
eecbd6c
watch zarr poc
ziw-liu Oct 9, 2023
f5ed6d5
test watching when writing larger images
ziw-liu Oct 10, 2023
0dbf946
Dynamic layout of reconstruction wizard (#448)
talonchandler Oct 10, 2023
dd0f030
generate example settings with revised model
talonchandler Oct 10, 2023
4f8e24f
skip `reconstruction_settings` during GUI generation
talonchandler Oct 10, 2023
5ce8f82
fix settings tests
talonchandler Oct 10, 2023
194be02
fix roundtrip io tests
talonchandler Oct 10, 2023
278c274
update comput-tf tests and logic
talonchandler Oct 10, 2023
a0759ce
update compute-tf tests
talonchandler Oct 10, 2023
8490c96
update reconstruction
talonchandler Oct 10, 2023
2842834
final tests passing
talonchandler Oct 11, 2023
ef3a4d1
Merge pull request #449 from mehta-lab/revise-settings
talonchandler Oct 11, 2023
8c19e15
unused import
talonchandler Oct 11, 2023
1f8c52a
first steps towards reconstruction button
talonchandler Oct 11, 2023
d16b34f
minimally working GUI -> CLI
talonchandler Oct 11, 2023
6f6c6ae
display results in viewer
talonchandler Oct 11, 2023
2cb8093
annotate types
ziw-liu Oct 11, 2023
0f915a3
save output to a new file path
ziw-liu Oct 11, 2023
f739cc7
Merge pull request #450 from mehta-lab/reconstruct-button
talonchandler Oct 11, 2023
483de87
add in-progress cb
talonchandler Oct 11, 2023
0c6c045
tmp inputs
talonchandler Oct 11, 2023
8124d1e
basic listener
talonchandler Oct 11, 2023
cbe5b25
checkpoint create-then-fill strategy
talonchandler Oct 12, 2023
ffb6c0b
assume finite time points
talonchandler Oct 12, 2023
723957d
setup reconstruction queue
ziw-liu Oct 12, 2023
b82e69c
put tasks in the queue
ziw-liu Oct 12, 2023
2d038ff
Merge branch 'main' into listen-to-zarr
ziw-liu Oct 12, 2023
3cf7b92
fix the queue
ziw-liu Oct 12, 2023
2a0ba12
T and Z sweep acquisition script
talonchandler Oct 12, 2023
025d3f1
integrate with the demo writer
ziw-liu Oct 12, 2023
4976c37
qt slot for callback
ziw-liu Oct 12, 2023
3fd1017
Merge pull request #451 from mehta-lab/listen-to-zarr
talonchandler Oct 12, 2023
81882ac
Merge branch 'v1-gui-layout' into acquire-z-stack
talonchandler Oct 13, 2023
c76b8d0
move the viewing flag forward
ziw-liu Oct 13, 2023
a57d2e9
slow down and acquire from camera
talonchandler Oct 13, 2023
abac294
Merge branch 'v1-gui-layout' into acquire-z-stack
edyoshikun Oct 13, 2023
2fcfa86
quit worker after finished
ziw-liu Oct 13, 2023
1f55613
in-progress testing
edyoshikun Oct 13, 2023
b3b3c16
Merge branch 'acquire-z-stack' of https://github.com/mehta-lab/recOrd…
edyoshikun Oct 13, 2023
feb628e
add pyqtslot
ziw-liu Oct 13, 2023
30b02b1
create array before acquisition
ziw-liu Oct 13, 2023
5241569
fix bug
edyoshikun Oct 13, 2023
96c575e
fix shape
ziw-liu Oct 13, 2023
4bc51ab
xy bug
edyoshikun Oct 13, 2023
8eba361
typo fix
edyoshikun Oct 13, 2023
4f3cb53
put into queue in a separate thread
ziw-liu Oct 13, 2023
984da22
Merge remote-tracking branch 'origin/acquire-z-stack' into acquire-z-…
ziw-liu Oct 13, 2023
f4eab25
attempt to quit worker thread upon close
ziw-liu Oct 13, 2023
629ddc4
quit first
ziw-liu Oct 13, 2023
89686ca
changes during final push to demo
edyoshikun Oct 13, 2023
28b13b2
Merge branch 'acquire-z-stack' of https://github.com/mehta-lab/recOrd…
edyoshikun Oct 13, 2023
160d413
Merge pull request #453 from mehta-lab/acquire-z-stack
talonchandler Nov 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
generate example settings with revised model
  • Loading branch information
talonchandler committed Oct 10, 2023
commit dd0f030bd81ae06f32b418c30418412a975db111
50 changes: 26 additions & 24 deletions examples/birefringence-and-phase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,29 @@ input_channel_names:
- State3
time_indices: all
reconstruction_dimension: 3
birefringence:
transfer_function:
swing: 0.1
apply_inverse:
wavelength_illumination: 0.532
background_path: ''
remove_estimated_background: false
flip_orientation: false
rotate_orientation: false
phase:
transfer_function:
wavelength_illumination: 0.532
yx_pixel_size: 0.325
z_pixel_size: 2.0
z_padding: 0
index_of_refraction_media: 1.3
numerical_aperture_detection: 1.2
numerical_aperture_illumination: 0.5
invert_phase_contrast: false
apply_inverse:
reconstruction_algorithm: Tikhonov
regularization_strength: 0.001
TV_rho_strength: 0.001
TV_iterations: 1
reconstruction_type: Birefringence and Phase
reconstruction_settings:
birefringence_settings:
transfer_function:
swing: 0.1
apply_inverse:
wavelength_illumination: 0.532
background_path: ''
remove_estimated_background: false
flip_orientation: false
rotate_orientation: false
phase_settings:
transfer_function:
wavelength_illumination: 0.532
yx_pixel_size: 0.325
z_pixel_size: 2.0
z_padding: 0
index_of_refraction_media: 1.3
numerical_aperture_detection: 1.2
numerical_aperture_illumination: 0.5
invert_phase_contrast: false
apply_inverse:
reconstruction_algorithm: Tikhonov
regularization_strength: 0.001
TV_rho_strength: 0.001
TV_iterations: 1
3 changes: 2 additions & 1 deletion examples/birefringence.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ input_channel_names:
- State3
time_indices: all
reconstruction_dimension: 3
birefringence:
reconstruction_type: Birefringence
reconstruction_settings:
transfer_function:
swing: 0.1
apply_inverse:
Expand Down
3 changes: 2 additions & 1 deletion examples/fluorescence.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ input_channel_names:
- GFP
time_indices: all
reconstruction_dimension: 3
fluorescence:
reconstruction_type: Fluorescence
reconstruction_settings:
transfer_function:
yx_pixel_size: 0.325
z_pixel_size: 2.0
Expand Down
3 changes: 2 additions & 1 deletion examples/phase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ input_channel_names:
- BF
time_indices: all
reconstruction_dimension: 3
phase:
reconstruction_type: Phase
reconstruction_settings:
transfer_function:
wavelength_illumination: 0.532
yx_pixel_size: 0.325
Expand Down
29 changes: 24 additions & 5 deletions recOrder/cli/settings.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import os
from typing import Literal, Optional, Union
from typing import Literal, Union
from pydantic import (
BaseModel,
Extra,
NonNegativeFloat,
NonNegativeInt,
PositiveFloat,
root_validator,
validator,
)

Expand Down Expand Up @@ -138,8 +137,8 @@ class PhaseSettings(MyBaseModel):


class BirefringenceAndPhaseSettings(MyBaseModel):
birefringence_settings: BirefringenceSettings
phase_settings: PhaseSettings
birefringence_settings: BirefringenceSettings = BirefringenceSettings()
phase_settings: PhaseSettings = PhaseSettings()


class FluorescenceSettings(MyBaseModel):
Expand All @@ -149,16 +148,36 @@ class FluorescenceSettings(MyBaseModel):
apply_inverse: FourierApplyInverseSettings = FourierApplyInverseSettings()


OPTION_TO_MODEL_DICT = {
"Birefringence": BirefringenceSettings,
"Phase": PhaseSettings,
"Birefringence and Phase": BirefringenceAndPhaseSettings,
"Fluorescence": FluorescenceSettings,
}

RECONSTRUCTION_TYPES = Literal[tuple(OPTION_TO_MODEL_DICT.keys())]


# Top level settings
class ReconstructionSettings(MyBaseModel):
input_channel_names: list[str] = [f"State{i}" for i in range(4)]
time_indices: Union[
NonNegativeInt, list[NonNegativeInt], Literal["all"]
] = "all"
reconstruction_dimension: Literal[2, 3] = 3
reconstruction_type: Union[
reconstruction_type: RECONSTRUCTION_TYPES = "Birefringence"
reconstruction_settings: Union[
BirefringenceSettings,
PhaseSettings,
BirefringenceAndPhaseSettings,
FluorescenceSettings,
] = BirefringenceSettings()

@validator("reconstruction_settings")
def validate_reconstruction_settings(cls, v, values):
recon_type = values.get("reconstruction_type")
if OPTION_TO_MODEL_DICT[recon_type] != type(v):
raise ValueError(
f"reconstruction_type = {recon_type} needs to match reconstruction_settings = {type(v)}"
)
return v
10 changes: 1 addition & 9 deletions recOrder/plugin/_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,11 @@
from superqt import QCollapsible, QLabeledSlider

from recOrder.cli import settings
from recOrder.cli.settings import OPTION_TO_MODEL_DICT, RECONSTRUCTION_TYPES

if TYPE_CHECKING:
from napari import Viewer

OPTION_TO_MODEL_DICT = {
"Birefringence": settings.BirefringenceSettings,
"Phase": settings.PhaseSettings,
"Birefringence and Phase": settings.BirefringenceAndPhaseSettings,
"Fluorescence": settings.FluorescenceSettings,
}

RECONSTRUCTION_TYPES = Literal[tuple(OPTION_TO_MODEL_DICT.keys())]


class QHLine(QFrame):
def __init__(self):
Expand Down
13 changes: 8 additions & 5 deletions recOrder/tests/cli_tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,22 @@ def test_generate_example_settings():
example_path = "./examples/"

s0 = settings.ReconstructionSettings(
birefringence=settings.BirefringenceSettings(),
phase=settings.PhaseSettings(),
reconstruction_type="Birefringence and Phase",
reconstruction_settings=settings.BirefringenceAndPhaseSettings(),
)
s1 = settings.ReconstructionSettings(
input_channel_names=["BF"],
phase=settings.PhaseSettings(),
reconstruction_type="Phase",
reconstruction_settings=settings.PhaseSettings(),
)
s2 = settings.ReconstructionSettings(
birefringence=settings.BirefringenceSettings(),
reconstruction_type="Birefringence",
reconstruction_settings=settings.BirefringenceSettings(),
)
s3 = settings.ReconstructionSettings(
input_channel_names=["GFP"],
fluorescence=settings.FluorescenceSettings(),
reconstruction_type="Fluorescence",
reconstruction_settings=settings.FluorescenceSettings(),
)
file_names = [
"birefringence-and-phase.yml",
Expand Down