Skip to content

Commit

Permalink
Merge pull request #1046 from annie-xd-wang/update-features-UpdateExp…
Browse files Browse the repository at this point in the history
…erimentSetting

Reset the image writer if the channel (C), time point (T), or z-stack (Z) changes during execution
  • Loading branch information
AdvancedImagingUTSW authored Dec 16, 2024
2 parents 1d0bbfe + 6833992 commit ebe3037
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/navigate/model/features/update_setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
# Standard library imports
import logging
from functools import reduce
import time

# Third party imports

Expand Down Expand Up @@ -345,7 +346,15 @@ def signal_func(self):
# end active microscope
self.model.active_microscope.end_acquisition()

state = self.model.configuration["experiment"]["MicroscopeState"]
pre_z_steps = state["number_z_steps"]
pre_channels = sum(
[v["is_selected"] is True for k, v in state["channels"].items()]
)
pre_timepoints = state["timepoints"]

# update experiment values
# check if any parameter about x, y, c, z, t changed
for k, v in self.experiment_parameters.items():
try:
parameters = k.split(".")
Expand All @@ -362,6 +371,13 @@ def signal_func(self):
self.model.active_microscope.prepare_next_channel()
# update image writer
if self.model.image_writer:
z_steps = state["number_z_steps"]
channels = sum(
[v["is_selected"] is True for k, v in state["channels"].items()]
)
timepoints = state["timepoints"]
if pre_z_steps != z_steps or pre_channels != channels or pre_timepoints != timepoints:
self.model.image_writer.initialize_saving(sub_dir=time.strftime("%H%M%S"))
try:
self.model.image_writer.data_source.set_metadata_from_configuration_experiment(
self.model.configuration
Expand Down

0 comments on commit ebe3037

Please sign in to comment.