From 0b9e6e72443fbd657d09b6ea2d34d3bf4747b846 Mon Sep 17 00:00:00 2001
From: Andrey Aristov <aaristov@pasteur.fr>
Date: Sat, 26 Mar 2022 23:30:47 +0100
Subject: [PATCH] auto names and channel axis

---
 src/napari_segment/_reader.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/napari_segment/_reader.py b/src/napari_segment/_reader.py
index c86f0cd..063b83b 100644
--- a/src/napari_segment/_reader.py
+++ b/src/napari_segment/_reader.py
@@ -38,10 +38,11 @@ def napari_get_reader(path):
 
 
 def read_nd2(path):
+    print(f"opening {path}")
     data = nd2.ND2File(path)
     ddata = data.to_dask()
     try:
-        channel_axis = list(d.sizes.keys()).index('C')
+        channel_axis = list(data.sizes.keys()).index("C")
     except ValueError:
         channel_axis = None
     return [
@@ -49,9 +50,11 @@ def read_nd2(path):
             ddata,
             dict(
                 channel_axis=channel_axis,
-                name=["BF", "fluo"],
-                colormap=["gray", "green"],
-                contrast_limits=[(8500, 35000), (150, 20000)],
+                name=[ch.channel.name for ch in data.metadata.channels],
+                # colormap=[hex(ch.channel.colorRGB)
+                # for ch in data.metadata.channels],
+                # scale=data.metadata.channels[0].volume.axesCalibration[:]
+                # contrast_limits=[(8500, 35000), (150, 20000)],
             ),
             "image",
         )
-- 
GitLab