Skip to content

Commit

Permalink
Add initial version of calculate_well_positions with optional plate t…
Browse files Browse the repository at this point in the history
…ranslation
  • Loading branch information
jluethi committed Oct 1, 2024
1 parent 99d9299 commit 8dc1bed
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/napari_ome_zarr_navigator/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def add_features_to_labels(
pass


def calculate_well_positions(plate_url, row, col):
def calculate_well_positions(plate_url, row, col, plate=True):
dataset = 0
level = 0
zarr_url = f"{plate_url}/{row}/{col}/{dataset}"
Expand All @@ -70,10 +70,16 @@ def calculate_well_positions(plate_url, row, col):
row = rows.index(row)
col = cols.index(col)

top_left_corner = [row * scale[0] * shape[0], col * scale[1] * shape[1]]
if plate:
top_left_corner = [
row * scale[0] * shape[0],
col * scale[1] * shape[1],
]
else:
top_left_corner = [0, 0]
bottom_right_corner = [
(row + 1) * scale[0] * shape[0],
(col + 1) * scale[1] * shape[1],
top_left_corner[0] + scale[0] * shape[0],
top_left_corner[1] + scale[1] * shape[1],
]

return top_left_corner, bottom_right_corner

0 comments on commit 8dc1bed

Please sign in to comment.