Skip to content

Commit 48d766c

Browse files
improve image comparison table
1 parent 9810a77 commit 48d766c

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

notebooks/1_ngio_basics.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,18 @@ def _(Path):
213213
image_path = hcs_path / "B" / "03" / "0"
214214
ome_zarr_container = ngio.open_ome_zarr_container(image_path)
215215
image = ome_zarr_container.get_image()
216-
return data_dir, image, image_path, ome_zarr_container
216+
return data_dir, image, image_path, ngio, ome_zarr_container
217+
218+
219+
@app.cell(hide_code=True)
220+
def _(ome_zarr_container, plot_image):
221+
plot_image(
222+
ome_zarr_container,
223+
title="CardiomyocyteTiny, well B/03/0 (original image, level 0)",
224+
axes_order="yx",
225+
z=0,
226+
)
227+
return
217228

218229

219230
@app.cell(hide_code=True)
@@ -446,7 +457,7 @@ def _(mo):
446457

447458

448459
@app.cell(hide_code=True)
449-
def _(np, plt):
460+
def _(ngio, np, plt):
450461
from matplotlib import colors as _colors
451462
from matplotlib.patches import Rectangle as _Rectangle
452463

@@ -543,7 +554,9 @@ def plot_image(
543554
plt.show()
544555

545556

546-
def compare_containers(orig, deriv):
557+
def compare_containers(
558+
orig: ngio.OmeZarrContainer, deriv: ngio.OmeZarrContainer
559+
):
547560
attrs = ("levels", "level_paths", "is_3d", "channel_labels")
548561
rows = [
549562
"| Attribute | Original | Derived | |",
@@ -559,6 +572,16 @@ def compare_containers(orig, deriv):
559572
o, d = getattr(orig_img, attr), getattr(deriv_img, attr)
560573
marker = "✅ same" if o == d else "🔄 changed"
561574
rows.append(f"| `image.{attr}` | `{o}` | `{d}` | {marker} |")
575+
576+
o = orig_img.meta.version
577+
d = deriv.meta.version
578+
marker = "✅ same" if o == d else "🔄 changed"
579+
rows.append(f"| `image.meta.version` | `{o}` | `{d}` | {marker} |")
580+
581+
o = orig_img.zarr_array.metadata.zarr_format
582+
d = deriv_img.zarr_array.metadata.zarr_format
583+
marker = "✅ same" if o == d else "🔄 changed"
584+
rows.append(f"| `zarr_version` | `{o}` | `{d}` | {marker} |")
562585
return "\n".join(rows)
563586

564587
return compare_containers, plot_image

0 commit comments

Comments
 (0)