Skip to content

Commit

Permalink
Use well-translation for Plate ROI loading
Browse files Browse the repository at this point in the history
  • Loading branch information
jluethi committed Jul 19, 2024
1 parent 84ae72d commit 77309ab
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/napari_ome_zarr_navigator/roi_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from napari.utils.colormaps import Colormap

from napari_ome_zarr_navigator.ome_zarr_image import OMEZarrImage
from napari_ome_zarr_navigator.util import calculate_well_positions
from napari_ome_zarr_navigator.utils_roi_loader import (
read_table,
)
Expand All @@ -35,6 +36,10 @@ def __init__(
self.channel_names_dict = {}
self.labels_dict = {}
self.label_layers = {}

# Translation to move position of ROIs loaded
self.translation = [0, 0]

self._roi_table_picker = ComboBox(label="ROI Table")
self._roi_picker = ComboBox(label="ROI")
self._channel_picker = Select(
Expand Down Expand Up @@ -205,6 +210,7 @@ def add_intensity_roi(
contrast_limits=rescaling,
colormap=colormap,
name=channel,
translate=self.translation,
)
# TODO: Optionally return some values as well? e.g. if info is needed
# by label loading
Expand Down Expand Up @@ -249,7 +255,10 @@ def run(self):
# )
# return
self.label_layers[label] = self._viewer.add_labels(
label_roi, scale=scale_label, name=label
label_roi,
scale=scale_label,
name=label,
translate=self.translation,
)

# Load features
Expand Down Expand Up @@ -364,9 +373,12 @@ def __init__(
self._zarr_picker.choices = zarr_images
self._zarr_picker._default_choices = zarr_images

# TODO: Calculate base translation for a given well
# Needs top-left corner of the well
self.translation = 1
# Calculate base translation for a given well
self.translation, _ = calculate_well_positions(
plate_url=plate_url,
row=row,
col=col,
)

# # Handle defaults for plate loading
# if "well_ROI_table" in self._roi_table_picker.choices:
Expand Down

0 comments on commit 77309ab

Please sign in to comment.