Skip to content

Commit c34237c

Browse files
committed
Improve window handling in converter (closes #952)
1 parent e86d4a8 commit c34237c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

fractal_tasks_core/channels.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ class OmeroChannel(BaseModel):
5959
wavelength_id: Unique ID for the channel wavelength, e.g. `A01_C01`.
6060
index: Do not change. For internal use only.
6161
label: Name of the channel.
62-
window: Optional `Window` object to set default display settings for
63-
napari.
62+
window: Optional `Window` object to set default display settings. If
63+
unset, it will be set to the full bit range of the image
64+
(e.g. 0-65535 for 16 bit images).
6465
color: Optional hex colormap to display the channel in napari (it
6566
must be of length 6, e.g. `00FFFF`).
6667
active: Should this channel be shown in the viewer?
@@ -370,6 +371,15 @@ def define_omero_channels(
370371
if channel.window:
371372
channel.window.min = 0
372373
channel.window.max = 2**bit_depth - 1
374+
else:
375+
# If no channel.window is set, create a new one with full bitrange
376+
# min & max
377+
channel.window = Window(
378+
min=0,
379+
max=2**bit_depth - 1,
380+
start=0,
381+
end=2**bit_depth - 1,
382+
)
373383

374384
# Check that channel labels are unique for this image
375385
labels = [c.label for c in new_channels]

0 commit comments

Comments
 (0)