### Setup for macOS and Linux Source: https://jvzonlab.github.io/OrganoidTracker/INSTALLATION.html Commands to create the environment on non-Windows platforms. ```bash conda env create -f environment.yml ``` ```bash conda activate organoid_tracker ``` ```bash python organoid_tracker.py ``` ```bash conda env remove -n organoid_tracker ``` ```bash conda env update --file environment.yml --prune ``` -------------------------------- ### Optimize and manage environment Source: https://jvzonlab.github.io/OrganoidTracker/_sources/INSTALLATION.md.txt Commands for installing optional performance libraries, removing the environment, or updating the installation. ```bash conda install orjson ``` ```bash conda env remove -n organoid_tracker ``` ```bash conda env update --file environment-exact-win64 --prune ``` -------------------------------- ### Launch the OrganoidTracker window Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.gui.html Initializes an experiment object and starts the main GUI window. ```python >>> from organoid_tracker.core.experiment import Experiment >>> experiment = Experiment() # This empty experiment is a placeholder >>> from organoid_tracker.gui import main_window >>> main_window.launch_window(experiment) ``` -------------------------------- ### Test OrganoidTracker installation Source: https://jvzonlab.github.io/OrganoidTracker/_sources/INSTALLATION.md.txt Run this command after activating the environment to verify the software is working and launch the GUI. ```bash python organoid_tracker.py ``` -------------------------------- ### Launch Jupyter Notebook Source: https://jvzonlab.github.io/OrganoidTracker/JUPYTER_NOTEBOOK.html Starts the Jupyter Notebook server in the current directory. ```bash jupyter notebook ``` -------------------------------- ### mainloop() Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.gui.main_window.html Starts the application's main event loop. ```APIDOC ## mainloop() ### Description Starts the main loop of the application. ``` -------------------------------- ### launch_window(experiment: Experiment) -> MainWindow Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.gui.main_window.html Launches the main GUI window with an empty figure. This function initializes the window but does not start the main loop. ```APIDOC ## launch_window(experiment) ### Description Launches a window with an empty figure. This function does not start the main loop; use a visualizer to add interactivity. ### Parameters - **experiment** (Experiment) - Required - The experiment object to be associated with the window. ### Returns - **MainWindow** - The initialized main window instance. ``` -------------------------------- ### Optional performance optimization Source: https://jvzonlab.github.io/OrganoidTracker/INSTALLATION.html Install the orjson library to improve file I/O performance. ```bash conda install orjson ``` -------------------------------- ### Install Jupyter Notebook Source: https://jvzonlab.github.io/OrganoidTracker/JUPYTER_NOTEBOOK.html Installs the Jupyter Notebook package via Conda. ```bash conda install -c conda-forge notebook ``` -------------------------------- ### Visualization Setup Functions Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.coordinate_system.sphere_representer.html Functions to configure 2D and 3D figures for sphere representations. ```APIDOC ## setup_figure_2d(ax, sphere_representation) ### Description Configures a 2D axis for sphere representation. ### Parameters - **ax** (Axes) - The matplotlib axes object. - **sphere_representation** (SphereRepresentation) - The representation to draw. ## setup_figure_3d(figure, sphere_representation) ### Description Configures a 3D figure for sphere representation. ### Parameters - **figure** (Figure) - The matplotlib figure object. - **sphere_representation** (SphereRepresentation) - The representation to draw. ``` -------------------------------- ### Create a metadata management plugin Source: https://jvzonlab.github.io/OrganoidTracker/WORKING_WITH_CUSTOM_METADATA.html Example of a plugin that adds a menu item to the GUI to update experiment metadata via a dialog. ```python # Plugin file - save this as plugin_whatever.py in the plugins folder. from typing import Dict, Any from organoid_tracker.gui import option_choose_dialog from organoid_tracker.gui.window import Window # This adds a menu option that calls _set_drug_type def get_menu_items(window: Window) -> Dict[str, Any]: return { "Edit//Set drug type...": lambda: _set_drug_type(window), } # This function asks the user to set a drug type def _set_drug_type(window: Window): experiment = window.get_experiment() current_drug_type = experiment.global_data.get_data("drug_type") available_drugs = [ "Choose a drug", "palbociclib", "gefitinib", "erlotinib" ] result = option_choose_dialog.prompt_list("Choose drug type", "Drug type", "Choose the drug that was applied to the experiment.\n\nCurrent value: " + str(current_drug_type) + ".", available_drugs) if result is None or result == 0: return # User pressed Cancel or choose "Choose a drug" experiment.global_data.set_data("drug_type", available_drugs[result]) ``` -------------------------------- ### Example of a Python dictionary Source: https://jvzonlab.github.io/OrganoidTracker/PLUGIN_TUTORIAL.html A basic example of a Python dictionary structure used to map keys to values. ```python my_dictionary = { "apple": "Type of fruit", "biology": "Study of living systems", "boat": "Vehicle for water transporation", "cell": "Some kind of enclosed space." } ``` -------------------------------- ### Define multi-file plugin directory structure Source: https://jvzonlab.github.io/OrganoidTracker/PLUGIN_TUTORIAL.html Directory structure for plugins requiring multiple files, requiring a directory name starting with 'plugin_' and an '__init__.py' file. ```text Plugin directory/ plugin_some_example.py plugin_other_example.py plugin_directory_example/ __init__.py some_other_file_of_this_plugin.py ``` -------------------------------- ### Set and Get Experiment Metadata Source: https://jvzonlab.github.io/OrganoidTracker/_sources/WORKING_WITH_CUSTOM_METADATA.md.txt Demonstrates basic retrieval and assignment of global experiment metadata values. ```python from organoid_tracker.core.experiment import Experiment experiment = Experiment() experiment.global_data.get_data("drug_type") # Will return None experiment.global_data.set_data("drug_type", "control") experiment.global_data.get_data("drug_type") # Will now return "control" ``` -------------------------------- ### Run script via system Python Source: https://jvzonlab.github.io/OrganoidTracker/SCRIPTS.html Execute a script directly using the system's default Python 3 installation. ```bash .py ``` -------------------------------- ### load_plugin(file_path: str) -> Plugin | None Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.plugin.plugin_loader.html Loads a single plugin from a specified file path or directory. The file path must point to a Python file or module, and the basename must start with 'plugin_'. ```APIDOC ## load_plugin(file_path: str) -> Plugin | None ### Description Loads a single plugin from the provided file path. The path can point to a single Python file or a folder acting as a Python module. The file name must be the full path, and the basename must start with 'plugin_'. ### Parameters - **file_path** (str) - Required - The full path to the plugin file or module directory. ### Returns - **Plugin | None** - Returns a Plugin object if successfully loaded, or None if no plugin is found at the specified location. ``` -------------------------------- ### Find first and last time points Source: https://jvzonlab.github.io/OrganoidTracker/_sources/API.md.txt Retrieves the last time point number for positions, images, or the overall experiment. Replace 'last' with 'first' to get the starting time point. ```python from organoid_tracker.core.experiment import Experiment experiment = Experiment() last_number = experiment.positions.last_time_point_number() # Last time point for which we have positions last_number = experiment.images.last_time_point_number() # Last time point number for which we have images last_number = experiment.last_time_point_number() # Highest of the above ``` -------------------------------- ### Launch visualizer from script Source: https://jvzonlab.github.io/OrganoidTracker/_sources/API.md.txt Initialize an experiment with image data and open the visualizer window. ```python from organoid_tracker.core.experiment import Experiment from organoid_tracker.core.images import Images from organoid_tracker.gui import main_window from organoid_tracker.image_loading.array_image_loader import SingleImageLoader from organoid_tracker.visualizer import standard_image_visualizer array = ... # Some single color 3D numpy array, representing an image # Set up Images object images = Images() images.image_loader(SingleImageLoader(array)) # ... you could also load LIF files, TIFF files, set a resolution, etc. # Set up Experiment object, holding the given images experiment = Experiment() experiment.images = images # ... you can add any data you want to the experiment # Open the visualizer standard_image_visualizer.show(experiment) main_window.mainloop() # Necessary! Google "event loop" for details ``` -------------------------------- ### Initialize ConfigFile Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.config.html Read a configuration section from the default or a specified folder. ```python config = ConfigFile("my_script_name") ``` ```python config = ConfigFile("my_script_name", folder_name=r"C:path o older") ``` -------------------------------- ### set_track_start_marker Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.linking_analysis.linking_markers.html Sets the start marker for a track at a specific position. ```APIDOC ## set_track_start_marker(positions, position, start_marker) ### Description Sets a reason why the track started at the given point. ### Parameters - **positions** (PositionCollection) - The collection of positions. - **position** (Position) - The specific position. - **start_marker** (StartMarker | None) - The start marker to set. ``` -------------------------------- ### Constructing Experiment Positions and Links Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.core.html Demonstrates initializing an Experiment, setting image resolution, and managing positions and links between time points. ```python >>> from organoid_tracker.core.experiment import Experiment >>> from organoid_tracker.core.images import ImageResolution >>> from organoid_tracker.core.position import Position >>> experiment = Experiment() >>> experiment.images.set_resolution(ImageResolution(0.32, 0.32, 2, 12)) >>> experiment.name.set_name("Some name") >>> >>> # Add two positions and link them >>> experiment.positions.add(Position(0, 0, 0, time_point_number=0)) >>> experiment.positions.add(Position(1, 3, 0, time_point_number=1)) >>> experiment.links.add_link(Position(0, 0, 0, time_point_number=0), Position(1, 3, 0, time_point_number=1)) >>> >>> print(experiment.positions.of_time_point(TimePoint(1))) # "{Position(1, 3, 0, time_point_number=1)}" ``` -------------------------------- ### Remove or update OrganoidTracker Source: https://jvzonlab.github.io/OrganoidTracker/INSTALLATION.html Commands for removing the environment or updating the installation. ```bash conda env remove -n organoid_tracker ``` ```bash conda env update --file environment-exact-win64 --prune ``` -------------------------------- ### experiment.links.iterate_to_past(last_position) Source: https://jvzonlab.github.io/OrganoidTracker/_sources/API.md.txt Iterates backwards in time starting from a given position. ```APIDOC ### Method `experiment.links.iterate_to_past(last_position)` ### Description Provides an iterator to traverse the lineage of a cell backwards in time from a specified position. ### Parameters - **last_position** (Position) - Required - The starting position to begin the backward iteration. ``` -------------------------------- ### load_from_lif_reader(experiment, file, reader, serie_index_one, min_time_point=0, max_time_point=1000000000) Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.image_loading.liffile_image_loader.html Initializes experimental images from an already opened LIF file reader. ```APIDOC ## load_from_lif_reader(experiment, file, reader, serie_index_one, min_time_point=0, max_time_point=1000000000) ### Description Sets up the experimental images for an already opened LIF file. ### Parameters - **experiment** (Experiment) - Required - The experiment object to populate. - **file** (str) - Required - Path to the LIF file. - **reader** (Reader) - Required - The already opened reader object. - **serie_index_one** (int) - Required - The index of the series to load. - **min_time_point** (int) - Optional - The starting time point (default: 0). - **max_time_point** (int) - Optional - The ending time point (default: 1000000000). ``` -------------------------------- ### load_from_lif_file(experiment, file, series_index_or_name, min_time_point=0, max_time_point=1000000000) Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.image_loading.liffile_image_loader.html Initializes experimental images from a LIF file that has not yet been opened. ```APIDOC ## load_from_lif_file(experiment, file, series_index_or_name, min_time_point=0, max_time_point=1000000000) ### Description Sets up the experimental images for a LIF file that is not yet opened. ### Parameters - **experiment** (Experiment) - Required - The experiment object to populate. - **file** (str) - Required - Path to the LIF file. - **series_index_or_name** (str) - Required - The index or name of the series to load. - **min_time_point** (int) - Optional - The starting time point (default: 0). - **max_time_point** (int) - Optional - The ending time point (default: 1000000000). ``` -------------------------------- ### Summing image channels with ChannelSummingImageLoader Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.image_loading.builtin_merging_image_loaders.html Demonstrates how to initialize a ChannelSummingImageLoader by grouping existing channels into new combined channels. ```python >>> old_image_loader: ImageLoader = ... >>> old_channels = old_image_loader.get_channels() >>> merged_image_loader = ChannelSummingImageLoader(old_image_loader, [ >>> [old_channels[0], old_channels[1], old_channels[2]], >>> [old_channels[3]] >>> ]) ``` -------------------------------- ### Retrieve and Save Configuration Settings Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.config.html Fetch settings with default values and save changes to disk. ```python config.get_or_default("example_string", "My default value", comment="Some helpful comment") ``` ```python config.get_or_default("example_int", "4", comment="Only accepts integers", type=config_type_int) ``` ```python config.save() ``` -------------------------------- ### finetune_solution Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.linking_analysis.links_postprocessor.html Optimizes the tracking solution by adjusting links. ```APIDOC ## finetune_solution(experiment, experiment_result) ### Description Adds, deletes or swaps single links to lower the energy of the solution. ### Parameters - **experiment** (Experiment) - Required - The experiment object. - **experiment_result** (Experiment) - Required - The experiment result object. ``` -------------------------------- ### Iterate through cell history Source: https://jvzonlab.github.io/OrganoidTracker/_sources/API.md.txt Traverses cell positions backwards in time starting from a given position. ```python from organoid_tracker.core.experiment import Experiment experiment = Experiment() last_position = ... for position in experiment.links.iterate_to_past(last_position): # Record some state of the position, like x_location = position.x time_point_number = position.time_point_number() ``` -------------------------------- ### Save and load tracking data Source: https://jvzonlab.github.io/OrganoidTracker/_sources/API.md.txt Demonstrates initializing an experiment, loading data from a file, and saving the experiment state to a JSON file. ```python from organoid_tracker.core.experiment import Experiment from organoid_tracker.imaging import io # Creating a new experiment without any data experiment = Experiment() # Loading a new experiment from existing data experiment = io.load_data_file("my_file_name.aut") # Saving io.save_data_to_json(experiment, "my_file_name.aut") ``` -------------------------------- ### of_time_point(time_point: TimePoint) -> Iterable[Tuple[Position, Position]] Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.core.connections.html Gets all connections of a time point. ```APIDOC ## of_time_point(time_point: TimePoint) -> Iterable[Tuple[Position, Position]] ### Description Gets all connections of a time point. ### Parameters - **time_point** (TimePoint) - Required - The time point to query. ``` -------------------------------- ### Manage experiment metadata Source: https://jvzonlab.github.io/OrganoidTracker/WORKING_WITH_CUSTOM_METADATA.html Basic operations for setting, getting, and deleting metadata values in an experiment. ```python from organoid_tracker.core.experiment import Experiment experiment = Experiment() experiment.global_data.get_data("drug_type") # Will return None experiment.global_data.set_data("drug_type", "control") experiment.global_data.get_data("drug_type") # Will now return "control" ``` ```python from organoid_tracker.core.experiment import Experiment experiment = Experiment() experiment.global_data.set_data("temperature_by_time_point", [20.1, 20.4, 21.2, 21.9, 22.3, 23.2, 25.4, 27.1, 29.8, 31.2]) ``` ```python from organoid_tracker.core.experiment import Experiment experiment = Experiment() experiment.global_data.set_data("my_data", None) ``` -------------------------------- ### load_from_czi_reader Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.image_loading.czifile_image_loader.html Sets up experimental images from an already opened CZI reader. ```APIDOC ## load_from_czi_reader(experiment, file, reader, serie_index, min_time_point=0, max_time_point=1000000000) ### Description Sets up the experimental images for an already opened CZI file reader. ### Parameters - **experiment** (Experiment) - The experiment object to associate with the images. - **file** (str) - The path to the CZI file. - **reader** (CziFile) - The already opened CziFile reader instance. - **serie_index** (int) - The series index to load. - **min_time_point** (int) - Optional, default 0. The starting time point. - **max_time_point** (int) - Optional, default 1000000000. The ending time point. ``` -------------------------------- ### find_all_positions_in_track_of Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.linking_analysis.track_positions_finder.html Retrieves all positions associated with a specific track starting from a given position, including subsequent tracks. ```APIDOC ## find_all_positions_in_track_of(links, position) ### Description Gets all positions in the track of the given position, and all tracks after it. ### Signature `find_all_positions_in_track_of(links: Links, position: Position) -> Iterable[Position]` ### Parameters - **links** (Links) - The collection of links defining the tracking relationships. - **position** (Position) - The starting position from which to trace the track. ### Returns - **Iterable[Position]** - An iterable containing all positions found in the track sequence. ``` -------------------------------- ### create_run_script(output_folder, command_name) Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.util.run_script_creator.html Creates a BAT or SH file to execute a registered command, along with a configuration file pointing to the plugin directory. ```APIDOC ## create_run_script(output_folder, command_name) ### Description Generates a script file (BAT or SH) to execute a command registered via get_commands. It also creates a configuration file linked to the current plugin directory. ### Parameters - **output_folder** (str) - The directory where the script files will be created. - **command_name** (str) - The name of the command to be executed by the generated script. ``` -------------------------------- ### to_networkx_graph(*, time_point: TimePoint) -> Graph Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.core.connections.html Gets a non-directional NetworkX graph that represents the connections of the given time point. ```APIDOC ## to_networkx_graph(*, time_point: TimePoint) -> Graph ### Description Gets a non-directional NetworkX graph that represents the connections of the given time point. The graph is a copy. ``` -------------------------------- ### Plotting a Moving Average Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.util.moving_average.html Example usage of the MovingAverage class to calculate and visualize trends from scatter data using matplotlib. ```python >>> import matplotlib.pyplot as plt >>> # Create and plot some sample data >>> x_values = [0, 0, 1, 2, 4, 6, 8] >>> y_values = [6, 8, 5, 3, 2, -1, -4] >>> plt.scatter(x_values, y_values) >>> >>> # Calculate and plot the moving average >>> average = MovingAverage(x_values, y_values, window_width=3) # Calculate with this window width >>> average.plot(plt.gca()) # Plot to the current axis (gca = get current axis) >>> plt.show() ``` -------------------------------- ### Implement custom JSON default serialization Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.imaging.io.html Example implementation of the default method for a JSONEncoder subclass to handle arbitrary iterators. ```python def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return super().default(o) ``` -------------------------------- ### GuiExperiment Class Methods Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.gui.gui_experiment.html Methods for managing experiments, tabs, and event handlers within the GUI. ```APIDOC ## add_experiment(experiment: Experiment) -> int ### Description Adds an experiment to the tab list and returns the index of the new tab. ## execute_command(command: str) ### Description Executes a command by calling all registered command handlers. ## get_active_experiments() -> Iterable[Experiment] ### Description Retrieves all currently active experiments. ## get_selectable_experiments() -> Iterable[Tuple[int, str]] ### Description Returns a list of selectable experiment names and their corresponding indices. ## register_event_handler(event: str, source: str, action: Callable) ### Description Registers a callback for specific GUI or data events. Supported events include matplotlib events, 'data_updated_event', 'any_updated_event', 'tab_list_updated_event', and 'command_event'. ## select_experiment(index: int) ### Description Sets the experiment at the specified index as the currently visible experiment. ``` -------------------------------- ### get_division_count_in_lineage Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.linking_analysis.lineage_division_counter.html Calculates the number of divisions in a lineage starting from a specific track, returning None if the lineage is incomplete or goes out of view. ```APIDOC ## get_division_count_in_lineage(starting_track, positions, last_time_point_number) ### Description Gets how many divisions there are in the lineage starting at the given cell. If the cell does not divide, it returns 0. If the lineage ends before the experiment concludes due to the cell going out of view, it returns None. ### Parameters - **starting_track** (LinkingTrack) - The starting track of the lineage. - **positions** (PositionCollection) - The collection of cell positions. - **last_time_point_number** (int) - The time point limit for the analysis. ### Returns - **int | None** - The number of divisions or None if the lineage is incomplete. ``` -------------------------------- ### Create Conda environment for Windows Source: https://jvzonlab.github.io/OrganoidTracker/INSTALLATION.html Commands to initialize the environment on Windows, with a fallback for systems lacking CUDA support. ```bash conda env create -f environment-exact-win64.yml ``` ```bash conda env create -f environment.yml ``` -------------------------------- ### prompt_image_series_multiple(window) Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.gui.image_series_loader_dialog.html Prompts the user to select an image series via a window interface and loads it into the experiment. ```APIDOC ## prompt_image_series_multiple(window) ### Description Prompts an image series, and loads it into the experiment. Returns whether anything was loaded. ### Parameters - **window** (Window) - Required - The parent window context for the dialog. ### Returns - **bool** - Returns True if an image series was successfully loaded, False otherwise. ``` -------------------------------- ### Activate and test OrganoidTracker Source: https://jvzonlab.github.io/OrganoidTracker/INSTALLATION.html Commands to activate the environment and launch the application. ```bash conda activate organoid_tracker ``` ```bash python organoid_tracker.py ``` -------------------------------- ### load_from_czi_file Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.image_loading.czifile_image_loader.html Sets up experimental images from a CZI file path. ```APIDOC ## load_from_czi_file(experiment, file, series_index_one, min_time_point=0, max_time_point=1000000000) ### Description Sets up the experimental images for a CZI file that is not yet opened. ### Parameters - **experiment** (Experiment) - The experiment object to associate with the images. - **file** (str) - The path to the CZI file. - **series_index_one** (str | int) - The series index to load. - **min_time_point** (int) - Optional, default 0. The starting time point. - **max_time_point** (int) - Optional, default 1000000000. The ending time point. ``` -------------------------------- ### Load a plugin using plugin_loader Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.plugin.html Use this to load a plugin from a specified file path and retrieve its available commands. ```python >>> from organoid_tracker.plugin import plugin_loader >>> plugin = plugin_loader.load_plugin("path/to/folder/plugin_file.py") >>> print(plugin.get_commands()) # Prints the commands of the first plugin in the folder ``` -------------------------------- ### Set and Get Link Metadata Source: https://jvzonlab.github.io/OrganoidTracker/WORKING_WITH_CUSTOM_METADATA.html Use the experiment.links object to manage metadata for connections between two positions. Ensure positions are defined before accessing or setting link data. ```python from organoid_tracker.core.experiment import Experiment from organoid_tracker.core.position import Position experiment = Experiment() position_1 = Position(0, 0, 0, time_point_number=0) position_2 = Position(0, 0, 0, time_point_number=1) value = experiment.links.get_link_data(position_1, position_2, "key") experiment.links.set_link_data(position_1, position_2, "key", "value") ``` -------------------------------- ### Implement plugin command-line subcommands Source: https://jvzonlab.github.io/OrganoidTracker/PLUGIN_TUTORIAL.html Define 'get_commands' to map command names to handler functions that accept a list of arguments and return an integer status code. ```python from typing import List # This method is called by the plugin system def get_commands(): return { "my_command": _my_command_handler } def _my_command_handler(args: List[str]) -> int: print("Hello world!", args) return 0 ``` -------------------------------- ### Managing Position Metadata with position_markers Source: https://jvzonlab.github.io/OrganoidTracker/WORKING_WITH_CUSTOM_METADATA.html Use the position_markers module to get, set, or filter positions by their type metadata. These methods automatically handle case conversion to uppercase. ```python from organoid_tracker.core.experiment import Experiment from organoid_tracker.core.position import Position from organoid_tracker.position_analysis import position_markers # Replace these with real values experiment = Experiment() position = Position(0, 0, 0, time_point_number=0) experiment.positions.add(position) # This method returns the "type" metadata of a position, # and converts it to UPPERCASE if it isn't already position_markers.get_position_type(experiment.positions, position) # This method sets the "type" metadata of a position, # after converting the type to UPPERCASE if it isn't already position_markers.set_position_type(experiment.positions, position, "PANETH") # This method returns an iterable of all positions of the type "PANETH". # Note that if a single Paneth cell has 100 positions over time, # then this method will return all 100 positions of that Paneth cell. paneth_positions = position_markers.get_positions_of_type(experiment.positions, "PANETH") ``` -------------------------------- ### create_image_with_links_list Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.neural_network.link_detection_cnn.training_data_creator.html Creates an image with a list of links based on provided experiment data and configuration multipliers. ```APIDOC ## create_image_with_links_list ### Description Generates training data images containing links for the neural network, utilizing various multipliers to weight different types of link events. ### Parameters - **experiments** (Iterable[Experiment]) - Required - The collection of experiments to process. - **division_multiplier** (int) - Optional - Multiplier for division events (default: 5). - **mid_distance_multiplier** (int) - Optional - Multiplier for mid-distance events (default: 5). - **loose_end_multiplier** (int) - Optional - Multiplier for loose end events (default: 0). - **multiple_options_multiplier** (int) - Optional - Multiplier for multiple options events (default: 0). - **div_window** (int) - Optional - Window size for division events (default: 3). - **medium_distance** (tuple) - Optional - Range for medium distance events (default: (3, 7)). - **min_cases** (int) - Optional - Minimum number of cases required (default: 0). ``` -------------------------------- ### ConfigFile(section_name, folder_name='./') Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.config.html Initializes a new configuration file handler for a specific section within an organoid_tracker.ini file. ```APIDOC ## ConfigFile(section_name, folder_name='./') ### Description Initializes a wrapper around ConfigParser to read or create configuration settings from an organoid_tracker.ini file. ### Parameters - **section_name** (str) - Required - The section name to read from or write to. - **folder_name** (str) - Optional - The directory containing the .ini file. Defaults to './'. ``` -------------------------------- ### organoid_tracker.visualizer.standard_image_visualizer.show Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.visualizer.standard_image_visualizer.html Creates and displays a standard visualizer for a given experiment. ```APIDOC ## show(_experiment : Experiment_) ### Description Creates a standard visualizer for an experiment. ### Parameters - **_experiment** (Experiment) - Required - The experiment object to visualize. ``` -------------------------------- ### Load experiment list files Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.imaging.html Iterate through multiple tracking files and associated images defined in an .autlist file. ```python >>> from organoid_tracker.imaging import list_io >>> for experiment in list_io.load_experiment_list_file("some_file.autlist"): >>> ... # Do something with the experiment ``` -------------------------------- ### Load an experiment file Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.html Use the io module to load experimental data from an .aut file. ```python >>> from organoid_tracker.imaging import io >>> experiment = io.load_data_file("some_file_name.aut") ``` -------------------------------- ### Export tracking data to legacy format Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.guizela_tracker_compatibility.html Use this to save experiment links to a directory in the legacy Guizela format. ```python >>> from organoid_tracker.core.experiment import Experiment >>> experiment = Experiment() # Placeholder, replace with actual data >>> from organoid_tracker.guizela_tracker_compatibility import guizela_data_exporter >>> guizela_data_exporter.export_links(experiment, "path/to/directory") ``` -------------------------------- ### navigate(_url : str_) Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.text_popup.position_popup.html Handles navigation to a given URL, returning Markdown or performing specific actions. ```APIDOC ## navigate(_url : str_) -> str | None ### Description Returns the Markdown for the given URL. The website can also perform some other action, like zooming in on a position or starting a program. If this method returns None, then the navigation is cancelled. ### Parameters - **_url** (str) - The URL to navigate to. ### Returns - **str | None** - The Markdown content or None if navigation is cancelled. ``` -------------------------------- ### Manually Add Possible Links Source: https://jvzonlab.github.io/OrganoidTracker/CUSTOM_TRACKING_SCRIPTS.html Demonstrates how to manually define potential links between positions in an experiment. ```python from organoid_tracker.core.position import Position from organoid_tracker.imaging import io # Load some tracking data experiment = io.load_data_file("input file.aut") # Select some positions # (normally you would retrieve those from experiment.positions instead of hardcoding) position1 = Position(0, 0, 0, time_point_number=0) position2 = Position(1, 2, 1, time_point_number=1) position3 = Position(1, 9, 0, time_point_number=1) # Specify the possible links # In this case, position1 is linked to position2 and/or position3 experiment.links.add_link(position1, position2) experiment.links.add_link(position1, position3) ``` -------------------------------- ### Import legacy tracking data Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.guizela_tracker_compatibility.html Use this to load tracking data from a specified directory into an existing Experiment object. ```python >>> from organoid_tracker.core.experiment import Experiment >>> experiment = Experiment() >>> from organoid_tracker.guizela_tracker_compatibility import guizela_data_importer >>> guizela_data_importer.add_data_to_experiment(experiment, "path/to/directory") ``` -------------------------------- ### create_image_with_divisions_list Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.neural_network.division_detection_cnn.training_data_creator.html Creates a training data set from experiments, allowing for upsampling of dividing and dying cells. ```APIDOC ## create_image_with_divisions_list ### Description Creates training data set. Allows upsampling of dividing and dying cells (loose ends). If full_window is TRUE all cells within the window around cell division are deemed dividing, otherwise only the anaphase is classified as division. The exclusion window allows the exclusion of difficult cases just outside the window if full_window=TRUE. ### Parameters - **experiments** (Iterable[Experiment]) - Required - **division_multiplier** (int) - Optional - Default: 10 - **loose_end_multiplier** (int) - Optional - Default: 1 - **counter_examples_per_div** (float) - Optional - Default: 0.25 - **window** (tuple) - Optional - Default: (3, 2) - **loose_end_window** (int) - Optional - Default: 1 - **full_window** (bool) - Optional - Default: False - **exclusion_window** (any) - Optional - Default: None ``` -------------------------------- ### create_connections(experiment, *, print_progress=False) Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.connecting.connector_using_angles.html Creates connections for a given experiment using relative distances and an angular check algorithm. ```APIDOC ## create_connections ### Description Creates the connections for the given experiment, using the relative distances and an angular algorithm to determine neighbor relationships. ### Signature `create_connections(experiment: Experiment, *, print_progress: bool = False) -> Connections` ### Parameters - **experiment** (Experiment) - Required - The experiment object for which connections are to be created. - **print_progress** (bool) - Optional - If set to True, prints the progress of the connection creation process. Defaults to False. ``` -------------------------------- ### prompt_load_file Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.gui.dialog.html Prompts the user to select a single file for loading. ```APIDOC ## prompt_load_file(title: str, file_types: List[Tuple[str, str]]) -> str | None ### Description Shows a prompt that asks the user to open a file. Returns the file path as a string, or None if the user cancelled. ### Parameters - **title** (str) - Required - The title of the file dialog. - **file_types** (List[Tuple[str, str]]) - Required - A list of tuples defining file extensions (e.g., [('PNG file', '*.png')]). ### Returns - **str | None** - The selected file path or None if cancelled. ``` -------------------------------- ### prompt_image_series(file_loaders, experiment) Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.gui.image_series_loader_dialog.html Prompts the user to select an image series and loads it into the provided experiment object. ```APIDOC ## prompt_image_series(file_loaders, experiment) ### Description Prompts an image series, and loads it into the experiment. Returns whether anything was loaded. ### Parameters - **file_loaders** (Iterable[FileLoader]) - Required - A collection of file loaders to use for loading the series. - **experiment** (Experiment) - Required - The experiment object to load the series into. ### Returns - **bool** - Returns True if an image series was successfully loaded, False otherwise. ``` -------------------------------- ### load_experiment_list_file(open_files_list_file: str, *, load_images: bool = True, min_time_point: int = -100000000, max_time_point: int = 100000000) -> Iterable[Experiment] Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.imaging.list_io.html Loads all experiments listed in the specified file with optional filtering for time points and image loading. ```APIDOC ## load_experiment_list_file(open_files_list_file: str, *, load_images: bool = True, min_time_point: int = -100000000, max_time_point: int = 100000000) -> Iterable[Experiment] ### Description Loads all the listed files in the given file. ### Parameters - **open_files_list_file** (str) - Required - The path to the list file. - **load_images** (bool) - Optional - Whether to load images (default: True). - **min_time_point** (int) - Optional - Minimum time point filter (default: -100000000). - **max_time_point** (int) - Optional - Maximum time point filter (default: 100000000). ### Returns - (Iterable[Experiment]) - An iterable of loaded Experiment objects. ``` -------------------------------- ### LineageFateVisualizer Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.visualizer.lineage_fate_visualizer.html Constructor for the LineageFateVisualizer class, which initializes the visualizer with a window and a parent viewer. ```APIDOC ## class LineageFateVisualizer(_window, _parent_viewer=StandardImageVisualizer) ### Description Initializes a visualizer that shows how each cell develops during an experiment. Colors represent the final position on the data axis, and specific labels indicate cell death, division, or lineage termination. ### Parameters - **_window** (Window) - Required - The window instance for the visualizer. - **_parent_viewer** (Type[Visualizer]) - Optional - The parent viewer class, defaults to StandardImageVisualizer. ``` -------------------------------- ### open_file Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.gui.dialog.html Opens a file using the default system application. ```APIDOC ## open_file(filepath: str) ### Description Opens a file using the default application associated with the file type. ### Parameters - **filepath** (str) - Required - The path to the file to be opened. ``` -------------------------------- ### Define a basic plugin menu item Source: https://jvzonlab.github.io/OrganoidTracker/PLUGIN_TUTORIAL.html This snippet demonstrates the required structure for a plugin file, including the import of the dialog module and the definition of the get_menu_items function. ```python from organoid_tracker.gui import dialog def get_menu_items(window): return { "My menu item//Count cells in time points...": lambda: dialog.popup_message("My plugin", "Not yet implemented") } ``` -------------------------------- ### Create Conda environment for macOS and Linux Source: https://jvzonlab.github.io/OrganoidTracker/_sources/INSTALLATION.md.txt Standard environment creation command for non-Windows operating systems. ```bash conda env create -f environment.yml ``` ```bash conda activate organoid_tracker ``` -------------------------------- ### Display a popup dialog Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.gui.html Use this to show a simple message box with a title and content. ```python >>> from organoid_tracker.gui import dialog >>> dialog.popup_message("My title", "My message") ``` -------------------------------- ### prompt_list(title, header, label, options) Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.gui.option_choose_dialog.html Displays a popup dialog allowing the user to select a single option from a provided list. If only one option is provided, it returns 0 immediately without showing the popup. Returns None if the list is empty. ```APIDOC ## prompt_list(title, header, label, options) ### Description Shows a popup that allows you to choose from the given list of options. If len(options) == 1, then this method doesn’t show a popup, but immediately returns 0. If options is empty, None is returned. ### Parameters - **title** (str) - Required - The title of the dialog window. - **header** (str) - Required - The header text displayed in the dialog. - **label** (str) - Required - The label text for the selection area. - **options** (List[str]) - Required - A list of strings representing the available options. ### Returns - **int | None** - The index of the selected option, or None if the list is empty. ``` -------------------------------- ### ConfigFile.get_or_default Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.config.html Retrieves a value for a given key, returning a default value if the key is missing and optionally saving it to the configuration. ```APIDOC ## ConfigFile.get_or_default(key, default_value, *, comment='', store_in_defaults=False, type=config_type_str) ### Description Gets a value from the config file. If the key does not exist, the default value is stored and returned. ### Parameters - **key** (str) - Required - The configuration key. - **default_value** (Any) - Required - The value to return if the key is missing. - **comment** (str) - Optional - A comment to associate with the key. - **store_in_defaults** (bool) - Optional - Whether to store in the DEFAULTS section. - **type** (Callable) - Optional - A function to parse the string value into the desired type. ``` -------------------------------- ### compare_links(ground_truth, scratch, max_distance_um=5, margin_xy_px=0) Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.comparison.links_comparison.html Compares two sets of links between ground truth and scratch experiments. ```APIDOC ## compare_links ### Description Compares two sets of links on the level of individual links. For every link in the baseline data, it is checked if it is present in the automatic data, and vice versa. ### Parameters - **ground_truth** (Experiment) - Required - The baseline experiment data. - **scratch** (Experiment) - Required - The automatic experiment data to compare. - **max_distance_um** (float) - Optional - Maximum distance in micrometers for link matching (default: 5). - **margin_xy_px** (int) - Optional - Margin in pixels for XY coordinates (default: 0). ### Returns - **LinksReport** - A report object containing comparison results. ``` -------------------------------- ### prompt_list_multiple(title, header, label, options) Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.gui.option_choose_dialog.html Displays a popup dialog allowing the user to select zero or more options from a provided list. Returns an empty list if no options are provided, or None if the operation is cancelled. ```APIDOC ## prompt_list_multiple(title, header, label, options) ### Description Shows a popup that allows you to choose zero or more options from the given list of options. If options is empty, [] is returned. Returns None if cancelled. ### Parameters - **title** (str) - Required - The title of the dialog window. - **header** (str) - Required - The header text displayed in the dialog. - **label** (str) - Required - The label text for the selection area. - **options** (List[str]) - Required - A list of strings representing the available options. ### Returns - **List[int] | None** - A list of indices of the selected options, or None if the user cancelled the dialog. ``` -------------------------------- ### load_images(experiment, container, pattern, min_time_point=0, max_time_point=1000000000) Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.image_loading.general_image_loader.html Loads images from supported formats. The container specifies the file or directory, and the pattern defines the search criteria within that container. ```APIDOC ## load_images ### Description Loads images from any of the supported formats. The container is a file or a directory, and pattern is the format used to search within that file or directory. ### Parameters - **experiment** (Experiment) - Required - The experiment object. - **container** (str) - Required - The file or directory path. - **pattern** (str) - Required - The pattern to search within the container. - **min_time_point** (int) - Optional - The minimum time point to load (default: 0). - **max_time_point** (int) - Optional - The maximum time point to load (default: 1000000000). ``` -------------------------------- ### prompt_str Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.gui.dialog.html Asks the user to enter a line of text. ```APIDOC ## prompt_str(title, question, default='') ### Description Asks the user to enter a line of text. Returns the entered string, or None if the user pressed Cancel or closed the dialog. ``` -------------------------------- ### NearbyDeaths.__init__ Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.linking_analysis.cell_nearby_death_counter.html Initializes a new instance of the NearbyDeaths class, setting up an index for efficient spatial calculations. ```APIDOC ## Constructor: NearbyDeaths(links, positions, resolution, max_distance_um) ### Description Initializes the tracker to record how many times a nearby cell has died within a specified distance. ### Parameters - **links** (Links) - Required - The links object containing tracking data. - **positions** (PositionCollection) - Required - The collection of cell positions. - **resolution** (ImageResolution) - Required - The image resolution settings. - **max_distance_um** (float) - Optional - The maximum distance in micrometers to consider a cell 'nearby'. Defaults to 18. ``` -------------------------------- ### prompt_options Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.gui.dialog.html Displays a dialog with two or three options plus a cancel button. ```APIDOC ## prompt_options(title, question, *, option_1, option_2=None, option_3=None, option_default=DefaultOption.CANCEL) ### Description Shows two or three options to choose from, and additionally a cancel button. Returns None if the default button was pressed, otherwise returns an integer (1, 2, or 3) corresponding to the picked option. ### Parameters - **title** (str) - The title of the dialog. - **question** (str) - The question text displayed. - **option_1** (str) - The first option. - **option_2** (str | None) - Optional second option. - **option_3** (str | None) - Optional third option. - **option_default** (DefaultOption) - The default button to select. ``` -------------------------------- ### create_connections(experiment) Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.connecting.connector_by_distance.html Method to generate connections for an experiment. ```APIDOC ## Method: create_connections ### Description Calculates and returns connections for all time points in the provided experiment based on the distance criteria. This method does not modify the input experiment object. ### Parameters - **experiment** (Experiment) - Required - The experiment object containing the positions to be connected. ### Returns - **Connections** - A new Connections object containing the calculated links. ``` -------------------------------- ### export_links(experiment, output_folder, comparison_folder=None) Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.guizela_tracker_compatibility.guizela_data_exporter.html Exports the links of the experiment in Guizela’s file format. ```APIDOC ## export_links ### Description Exports the links of the experiment in Guizela’s file format. ### Parameters - **experiment** (Experiment) - Required - The experiment object to export. - **output_folder** (str) - Required - The folder path where the data will be exported. - **comparison_folder** (str | None) - Optional - The folder path for comparison data, defaults to None. ``` -------------------------------- ### Load images using general_image_loader Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.image_loading.html Loads images from a specified folder using a pattern string to identify time and channel components. ```python >>> from organoid_tracker.core.experiment import Experiment >>> experiment = Experiment() >>> from organoid_tracker.image_loading import general_image_loader >>> general_image_loader.load_images(experiment, "path/to/folder", "image_t{time:003}_c{channel}.tif") ``` -------------------------------- ### Load advanced image configurations Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.image_loading.html Loads multiple image channels from a dictionary configuration, useful for complex datasets with different patterns. ```python >>> from organoid_tracker.core.experiment import Experiment >>> experiment = Experiment() >>> from organoid_tracker.image_loading import general_image_loader >>> general_image_loader.load_images_from_dictionary(experiment, { >>> "images_channel_appending": [ >>> { >>> "images_container": "path/to/my/data", >>> "images_pattern": "t{time:03}_488nm.tif" >>> }, >>> { >>> "images_container": "path/to/my/data", >>> "images_pattern": "t{time:03}_561nm.tif" >>> }, >>> { >>> "images_container": "path/to/my/data", >>> "images_pattern": "t{time:03}_CoolLED.tif" >>> } >>> ] >>> }) ``` -------------------------------- ### HelpPopup Class Methods Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.text_popup.help_popup.html Methods available for interacting with the HelpPopup interface. ```APIDOC ## HelpPopup.get_root_folder() ### Description Returns the root folder path. Paths for assets like images are relative to this path. ### Returns - **str**: The root folder path. ## HelpPopup.get_title() ### Description Returns the title for the website. ### Returns - **str**: The website title. ## HelpPopup.navigate(url: str) ### Description Navigates to the provided URL. This method returns the Markdown content for the URL or performs specific actions like zooming or starting a program. If the navigation is cancelled, it returns None. ### Parameters - **url** (str) - Required - The URL to navigate to. ### Returns - **str | None**: The Markdown content or None if navigation is cancelled. ``` -------------------------------- ### load_image_series_from_config(experiment, file_name, pattern, min_time_point, max_time_point) Source: https://jvzonlab.github.io/OrganoidTracker/organoid_tracker.image_loading.nd2file_image_loader.html Loads image series into the images object based on file name and pattern configuration. ```APIDOC ## load_image_series_from_config(experiment, file_name, pattern, min_time_point, max_time_point) ### Description Loads the image series into the images object using the file_name and pattern settings. ### Parameters - **experiment** (Experiment) - Required - The experiment context. - **file_name** (str) - Required - The name of the file. - **pattern** (str) - Required - The pattern string for loading. - **min_time_point** (int) - Required - The starting time point. - **max_time_point** (int) - Required - The ending time point. ```