Skip to content

Commit 241ca58

Browse files
committed
fix(napari): πŸ› default view_in_napari to showing every channel
channel=0 as the default silently hid every channel but the first β€” surprising for a "let me look at my image" viewer, especially since it's independent of whichever channel a segmentation ran on (e.g. Cellpose on channel 0 while the acquisition has 3-4 channels). Default to channel=None (all channels); pass an int to view just one.
1 parent 3412300 commit 241ca58

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

β€Ždocs/guide/ome_zarr_napari.mdβ€Ž

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,18 @@ image found under `scan.zarr/labels/`:
136136
```python
137137
from patchworks.plugins.napari import view_in_napari
138138

139-
# auto-loads scan.zarr/labels/* as Labels layers:
139+
# auto-loads scan.zarr/labels/* as Labels layers, all image channels shown:
140140
view_in_napari("scan.zarr")
141141

142142
# or point at a separate plain label store written with write_to=:
143143
view_in_napari("scan.zarr", labels="labels.zarr")
144144
```
145145

146+
By default every channel of the image is shown (`channel=None`), independent
147+
of which one you segmented on β€” Cellpose might run on channel 0 while you
148+
still want to see the whole multi-channel acquisition. Pass an int to view
149+
just one channel instead: `view_in_napari("scan.zarr", channel=0)`.
150+
146151
!!! note
147152
napari ships in `patchworks[all]`, or install just it with
148153
`pip install "patchworks[napari]"`.

β€Žsrc/patchworks/plugins/napari.pyβ€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def view_in_napari(
267267
image: Union[da.Array, str, Path],
268268
labels: Union[da.Array, str, Path, None] = None,
269269
*,
270-
channel: int | None = 0,
270+
channel: int | None = None,
271271
labels_component: str = "labels",
272272
image_name: str = "image",
273273
labels_name: str = "labels",
@@ -290,7 +290,9 @@ def view_in_napari(
290290
place ``tile_process`` writes them by default β€” each as its own Labels
291291
layer. (Falls back to image-only if there are none.)
292292
channel : int or None, optional
293-
Channel to display from the image (``None`` keeps all channels).
293+
Channel to display from the image. ``None`` (default) shows every
294+
channel β€” the segmentation channel doesn't need to match what you
295+
view. Pass an int to show just that one.
294296
labels_component : str, optional
295297
Array name inside a plain-zarr label store (default ``"labels"``,
296298
matching ``tile_process``'s ``output_component``).

0 commit comments

Comments
Β (0)