Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
7169c03
initial test of the multiotsu
edyoshikun Aug 9, 2024
ca341bd
adding working pcc, template matching and multiotsu. borrowing funcs …
edyoshikun Aug 9, 2024
321b76e
adding autotracker shrimpy backbone and tracking methods
edyoshikun Aug 13, 2024
6b1eafa
Merge branch 'main' into autotracker
edyoshikun Aug 13, 2024
841dccf
Merge branch 'autotracker' of https://github.com/czbiohub-sf/shrimPy …
edyoshikun Aug 13, 2024
1b0f208
this runs on demo mode without updating the events for the stage. Ass…
edyoshikun Aug 14, 2024
52574ed
autotracker with demo mode working
edyoshikun Aug 16, 2024
161643f
adding autotracker parameters to the mantis config
edyoshikun Sep 24, 2024
328634d
Merge branch 'main' into autotracker
ieivanov Feb 19, 2025
b536b1f
add notes
ieivanov Feb 19, 2025
b9b9a99
add back isort on/off
ieivanov Feb 19, 2025
c4d33eb
implement shift limits
tayllatheodoro Feb 19, 2025
b7fe0f0
fix bug in template matching validator
tayllatheodoro Feb 19, 2025
f71f6be
debug autotracker
tayllatheodoro Feb 19, 2025
87fa6b8
change from tuple to list
tayllatheodoro Feb 20, 2025
a4afa1b
adding normalization flag
tayllatheodoro Feb 28, 2025
9c55df1
Merge branch 'autotracker' of https://github.com/czbiohub-sf/shrimPy …
tayllatheodoro Mar 25, 2025
46a833b
Update autotracker.py
tayllatheodoro Mar 25, 2025
0ce2d40
Update autotracker.py
tayllatheodoro Mar 25, 2025
d5f8b7d
Update autotracker.py
tayllatheodoro Mar 25, 2025
f31a1b0
Update acq_engine.py
tayllatheodoro Mar 25, 2025
18bfb22
Update autotracker.py
tayllatheodoro Mar 25, 2025
d4e7b83
update O3 refocus to use new piezo stage
ieivanov Mar 26, 2025
1526811
style
ieivanov Mar 26, 2025
ed15a3e
Merge branch 'new_o3_refocus_piezo' into autotracker
ieivanov Mar 26, 2025
f9f8b3a
Merge branch 'main' into autotracker
ieivanov Apr 18, 2025
ccc3af7
add autotracker stall debugging
ieivanov May 9, 2025
9e566d0
Update author metadata labeling in CITATION.cff (#188)
picaq Jun 25, 2025
9b39e26
Add CLI to stir plate before acquisition (#189)
ieivanov Jun 26, 2025
6e6cb1c
Autoexposure safety checks (#190)
ieivanov Jul 31, 2025
531fa49
move autotracker logs to /logs (#176)
ieivanov Jul 31, 2025
f0778df
Merge branch 'main' into autotracker
ieivanov Jul 31, 2025
b70f952
Update MM position list when using autotracker (#197)
ieivanov Aug 20, 2025
f70199c
add autotracker stall debugging
ieivanov May 9, 2025
3ba7bfa
abort stalled O3 autofocus
ieivanov Aug 21, 2025
5d972e3
add phase reconstruction
tayllatheodoro Aug 22, 2025
d6540b9
update pcc removing padding
tayllatheodoro Aug 22, 2025
d0e427a
bug fix
tayllatheodoro Aug 22, 2025
476d268
clean gpu
tayllatheodoro Aug 22, 2025
38bcfb2
keep track of gpu vars
ieivanov Aug 22, 2025
ecafe20
Merge branch 'abort_stalled_o3_refocus_acq' into autotracker_phase
ieivanov Aug 22, 2025
0bdc193
autotracker debug
ieivanov Aug 23, 2025
411bb10
clip shift_zyx
ieivanov Aug 23, 2025
3ee5342
update limits
ieivanov Aug 23, 2025
8ccab08
remove log transform from PCC and adding max shift
ieivanov Aug 23, 2025
292cec8
add vs to autotracker
tayllatheodoro Aug 28, 2025
16be24a
adding viscy and correcting bugs
tayllatheodoro Aug 29, 2025
bc862de
Merge branch 'autotracker_phase' into autotracker_vs
ieivanov Aug 29, 2025
2b6e928
correct config indentation
ieivanov Aug 29, 2025
19f8c74
add vs to pydantic acquisition settings model
ieivanov Aug 29, 2025
92e9cd3
debug
ieivanov Aug 29, 2025
85f06a0
remove device log and tif file writes
ieivanov Aug 29, 2025
d295f36
Autotracker based on phase reconstruction (#198)
ieivanov Sep 4, 2025
7e71048
Revert "Autotracker based on phase reconstruction" (#201)
ieivanov Sep 4, 2025
73a076d
abort stalled O3 autofocus
ieivanov Aug 21, 2025
a4533a0
add phase reconstruction
tayllatheodoro Aug 22, 2025
84e12e5
update pcc removing padding
tayllatheodoro Aug 22, 2025
34b7270
bug fix
tayllatheodoro Aug 22, 2025
ca79f51
clean gpu
tayllatheodoro Aug 22, 2025
172314f
keep track of gpu vars
ieivanov Aug 22, 2025
4f8f444
autotracker debug
ieivanov Aug 23, 2025
6c7ceb2
clip shift_zyx
ieivanov Aug 23, 2025
b7ccba0
update limits
ieivanov Aug 23, 2025
7932006
remove log transform from PCC and adding max shift
ieivanov Aug 23, 2025
1edc3fc
Merge branch 'autotracker' into autotracker_vs
ieivanov Sep 4, 2025
21050dd
Abort stalled o3 autofocus (#203)
ieivanov Sep 4, 2025
47da1dd
Merge branch 'main' into autotracker
ieivanov Sep 4, 2025
bbe5281
O3 autofocus improvements (#204)
ieivanov Sep 5, 2025
bdf1f59
Merge branch 'main' into autotracker
ieivanov Sep 5, 2025
2254154
debug - don't use PM for O3 autofocus
ieivanov Sep 10, 2025
26153e6
if shift reaches the max value, use max
ieivanov Sep 29, 2025
053be5e
Don't use PM for O3 autofocus (#205)
ieivanov Oct 23, 2025
6766476
Merge branch 'main' into autotracker
ieivanov Oct 23, 2025
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
3 changes: 2 additions & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ authors:
orcid: 'https://orcid.org/0000-0002-3033-674X'
- given-names: 'Shalin B.'
family-names: Mehta
affiliation: [email protected]
email: [email protected]
affiliation: Chan Zuckerberg Biohub San Francisco
orcid: 'https://orcid.org/0000-0002-2542-3582'
repository-code: 'https://github.com/czbiohub-sf/shrimPy'
abstract: >-
Expand Down
15 changes: 14 additions & 1 deletion examples/acquisition_settings/demo_acquisition_settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ time_settings:
time_interval_s: 5

lf_channel_settings:
default_exposure_times_ms: [10, 10]
default_exposure_times_ms: [5, 5]
channel_group: 'Channel-Multiband'
channels: ['DAPI', 'FITC']
use_sequencing: True
Expand All @@ -30,6 +30,8 @@ lf_microscope_settings:
channel_sequencing_settings:
- ['LED', 'Sequence', 'On']
use_autofocus: False
autotracker_config: ['Channel-Multiband', 'DAPI']


ls_channel_settings:
default_exposure_times_ms: [20, 30]
Expand All @@ -56,3 +58,14 @@ ls_microscope_settings:
- ['Camera', 'BitDepth', '11']
z_sequencing_settings:
- ['Z', 'UseSequences', 'Yes']

ls_autoexposure_settings:
autoexposure_method: 'manual'
rerun_each_timepoint: True

autotracker_settings:
tracking_method: 'phase_cross_correlation'
tracking_interval: 1
shift_limit: [30,200,200]
device: 'cpu'
scale_yx: 0.075
47 changes: 47 additions & 0 deletions examples/acquisition_settings/example_acquisition_settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ lf_microscope_settings:
use_autofocus: True
autofocus_stage: 'ZDrive'
autofocus_method: 'PFS'
# Autotracker parameters using the label-free channel
autotracker_config: ['Channel - LF', 'BF']

# Microscope settings which will be applied when the light-sheet acquisition is
# initialized
Expand All @@ -144,3 +146,48 @@ ls_microscope_settings:
ls_autoexposure_settings:
autoexposure_method: 'manual'
rerun_each_timepoint: True

autotracker_settings:
tracking_method: 'phase_cross_correlation'
reconstruction: ['phase', 'vs'] ##list of reconstruction methods to apply before tracking
tracking_interval: 1
shift_limit: [30,200,200]
device: 'cpu'
scale_yx: 0.075
phase_config: # apply phase reconstruction before tracking
transfer_function:
wavelength_illumination: 0.450
yx_pixel_size: 0.1494
z_pixel_size: 0.174
z_padding: 5
index_of_refraction_media: 1.4
numerical_aperture_detection: 1.35
numerical_aperture_illumination: 0.52
invert_phase_contrast: false
apply_inverse:
reconstruction_algorithm: Tikhonov
regularization_strength: 0.01
TV_rho_strength: 0.001
TV_iterations: 1
vs_config:
model:
class_path: viscy.translation.engine.VSUNet
init_args:
architecture: fcmae
model_config:
in_channels: 1
out_channels: 2
in_stack_depth: 21
encoder_blocks: [3, 3, 9, 3]
dims: [96, 192, 384, 768]
encoder_drop_path_rate: 0.0
stem_kernel_size: [7, 4, 4]
in_stack_depth: 21
decoder_conv_blocks: 2
pretraining: False
head_conv: True
head_conv_expansion_ratio: 4
head_conv_pool: False
test_time_augmentations: True
tta_type: median
ckpt_path: /hpc/projects/comp.micro/virtual_staining/models/fcmae-3d/fit_v2/pretrain_end2end/lightning_logs/finetune_VS_end2end_v1_test6_prefetch2_nopersistwork_restart_2/checkpoints/epoch=64-step=24960.ckpt
33 changes: 32 additions & 1 deletion mantis/acquisition/AcquisitionSettings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import copy
import warnings

from dataclasses import field
from typing import Dict, List, Literal, Optional, Tuple, Union
from typing import Dict, List, Literal, Optional, Tuple, Union, Any

import numpy as np

Expand Down Expand Up @@ -36,10 +37,12 @@ class PositionSettings:
position_labels: List[str] = field(default_factory=list)
num_positions: int = field(init=False, default=0)
well_ids: List[str] = field(init=False, default_factory=list)
xyz_positions_shift: list = field(init=False, default_factory=list)

def __post_init__(self):
assert len(self.xyz_positions) == len(self.position_labels)
self.num_positions = len(self.xyz_positions)
self.xyz_positions_shift = copy.deepcopy(self.xyz_positions)

try:
# Look for "'A1-Site_0', 'H12-Site_1', ... " format
Expand Down Expand Up @@ -73,6 +76,7 @@ class ChannelSettings:
# dictionaries with following structure: {well_id: list_of_exposure_times}
exposure_times_per_well: Dict = field(init=None, default_factory=dict)
laser_powers_per_well: Dict = field(init=None, default_factory=dict)
min_exposure_time: NonNegativeFloat = 0 # in ms

def __post_init__(self):
self.num_channels = len(self.channels)
Expand Down Expand Up @@ -142,6 +146,7 @@ class MicroscopeSettings:
o3_refocus_config: Optional[ConfigSettings] = None
o3_refocus_interval_min: Optional[int] = None
o3_refocus_skip_wells: List[str] = field(default_factory=list)
autotracker_config: Optional[ConfigSettings] = None


@dataclass
Expand Down Expand Up @@ -194,3 +199,29 @@ def __post_init__(self):
attr_val = getattr(self, attr)
if attr_val is not None:
setattr(self, attr, round(attr_val, 1))


@dataclass
class AutotrackerSettings:
tracking_method: Literal['phase_cross_correlation', 'template_matching', 'multi_otsu']
tracking_interval: Optional[int] = 1 # TODO: add units
scale_yx: Optional[float] = 1.0 # in um per pixel
shift_limit: Optional[Union[Tuple[float, float, float], 'None']] = None # in um
device: Optional[str] = 'cpu'
zyx_dampening_factor: Optional[Union[Tuple[float, float, float], None]] = None
# TODO: maybe do the ROI like in the ls_microscope_settings
template_roi_zyx: Optional[Tuple[int, int, int]] = None
template_channel: Optional[str] = None
reconstruction: Optional[List[str]] = field(default_factory=list)
phase_config: Optional[Dict[str, Any]] = field(default_factory=dict)
vs_config: Optional[Dict[str, Any]] = field(default_factory=dict)

@validator("tracking_method")
def check_tracking_method_options(cls, v):
# Check if template matching options are provided and are not None
if v == 'template_matching':
if not all([cls.template_roi_zyx, cls.template_channel]):
raise ValueError(
'template_roi_zyx and template_channel must be provided for template matching'
)
return v
Loading
Loading