organoid_tracker.gui.gui_experiment module

class organoid_tracker.gui.gui_experiment.GuiExperiment(experiment: Experiment)

Bases: object

Used to store the experiment, along with some data that is only relevant within a GUI app, but that doesn’t need to be saved.

KNOWN_EVENTS = {'any_updated_event', 'command_event', 'data_updated_event', 'program_close_event', 'tab_list_updated_event'}
add_experiment(experiment: Experiment) int

Adds an experiment to the tab list. Returns the index that is used for the new tab, which you can then use to select that tab.

execute_command(command: str)

Calls all registered command handlers with the given argument. Used when a user entered a command.

get_active_experiments() Iterable[Experiment]

Gets all currently active experiments. This will usually be one experiment, but the user has the option to open all experiments.

get_active_tabs() List[SingleGuiTab]

Gets the currently active tabs. Either this is a single tab, or if the “All tabs” option has been selected, this returns all tabs.

get_all_tabs() List[SingleGuiTab]

Gets all currently open tabs.

get_experiment() Experiment

Gets the currently selected experiment. Raises UserError if no particular experiment has been selected.

get_marker_by_save_name(save_name)
get_open_tab() SingleGuiTab

Gets the currently selected tab. Raises UserError if no particular tab has been selected.

get_registered_markers(type)
get_selectable_experiments() Iterable[Tuple[int, str]]

Gets all selectable experiment names, along with an index for self.select_experiment()

goto_position(position: Position)

Moves the view towards the given position. The position must have a time point set.

is_selected(select_index: int) bool

Checks if the select_index is of the currently selected experiment.

program_closing()

Called when the program is closed (so after saving the data - the user cannot cancel anymore at this point).

redraw_data()

Redraws the main figure using the latest values from the experiment.

redraw_image_and_data()

Redraws the image using the latest values from the experiment.

register_event_handler(event: str, source: str, action: Callable)

Registers an event handler. Supported events:

  • All matplotlib events.

  • “data_updated_event” for when the figure annotations need to be redrawn.

  • “any_updated_event” for when the complete figure needs to be redrawn, including the menu bar and image.

  • “tab_list_updated_event” for when just the list of available experiments needs to be redrawn.

  • “command_event” for when a command is executed

remove_experiment(experiment: Experiment)

Removes the given experiment from the list of loaded experiments. If no experiments are remaining, an empty one will be initialized.

replace_selected_experiment(experiment: Experiment)

Discards the currently selected experiment, and replaces it with a new one

select_experiment(index: int)

Sets the experiment with the given index (from self.get_selectable_experiments()) as the visible experiment.

property undo_redo: UndoRedo
unregister_event_handlers(source_to_remove: str)

Unregisters all handles registered using register_event_handler

class organoid_tracker.gui.gui_experiment.SingleGuiTab(experiment: Experiment)

Bases: object

property experiment: Experiment
property undo_redo: UndoRedo