Skip to content

Commit

Permalink
fix grid layout
Browse files Browse the repository at this point in the history
  • Loading branch information
ziw-liu committed Feb 28, 2024
1 parent b1c1e1d commit e8fe720
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 9 additions & 4 deletions iohub/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,19 @@ def _get_position_coords(self):
if not self.reader.stage_positions:
raise ValueError("Stage positions not available.")
for idx, pos in enumerate(self.reader.stage_positions):
stage_pos = pos.get("XYStage")
stage_pos = pos.get("XYStage") or pos.get("XY")
if stage_pos is None:
raise ValueError(
f"Stage position is not available for position {idx}"
)
coords_list.append(pos["XYStage"])
row = pos["GridRow"]
col = pos["GridCol"]
coords_list.append(stage_pos)
try:
row = pos["GridRow"]
col = pos["GridCol"]
except KeyError:
raise ValueError(
f"Grid indices not available for position {idx}"
)
row_max = row if row > row_max else row_max
col_max = col if col > col_max else col_max

Expand Down
2 changes: 2 additions & 0 deletions tests/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def test_converter_ometiff(mm2gamma_ome_tiff, grid_layout, chunks, tmpdir):
converter()
with open_ome_zarr(output, mode="r") as result:
intensity = 0
if grid_layout and converter.p > 1:
assert len(result) < converter.p
for pos_name, pos in result.positions():
_check_scale_transform(pos)
_check_chunks(pos, chunks)
Expand Down

0 comments on commit e8fe720

Please sign in to comment.