napari-virtual-reader / general workflow
Keep the pixels in the original file.
Build a virtual OME-Zarr view, then decode source regions when napari requests them.
- Select a local source; no converted image is required.
- refkv describes the source as reference-backed Zarr with OME image metadata.
- The plugin builds lazy layers without scanning their pixels.
- Viewing triggers source reads and decoding; decoded arrays exist in memory, not as a converted file.
Open path
Raw images and archives meet at the same reader.
flowchart TD
Input["Local input"] -->|select raw image| Raw["zarrify"]
Input -->|select VZIP| Archive["refkv.zarr.open"]
Raw -->|wrap references| Store["Zarr group"]
Archive -->|expose references| Store
Store -->|find OME images| Layers["Lazy layers"]
Raw -.->|supply live CZI factors| CZI["CZI assembly"]
Layers -->|route supported CZI| CZI
Layers -->|keep other formats| View["napari image layers"]
CZI -->|stack compatible scenes| View
View <-->|switch matching CZI scenes| Canvas["Canvas: T/Z + spatial Y/X"]
Canvas -->|release thumb by default| Plane["Chosen T/Z plane"]
Plane -->|reuse generated overviews| Cache["64 MiB overview LRU"]
View -->|select layer| Metadata["Metadata inspector"]
Canvas -->|select layer| Metadata
The reader maps OME image groups, axes and transforms into lazy layers. Tile assembly recovers stored levels without inventing missing tile resolutions. A separate scene-canvas path can add lazy display overviews.
Why CZI needs an extra path
refkv can expose irregular or overlapping CZI tiles separately from its regular image levels. Reading only those levels can omit native resolution or show just an overview.
The CZI assembler uses tile coordinates and resolution factors to expose those pieces as aligned image levels. Placement restores the missing view; lazy chunk reads avoid materializing the whole slide. Laziness alone does not solve tile placement.
Colour is not a channel count
CZI packed BGR(A) samples become one RGB(A) layer. Codec-aware ordering retains already-decoded RGB. Scalar fluorescence channels stay separate.
Matching scenes share a layer
Compatible CZI scenes open on a native S axis. Matching scenes also share one spatial canvas per channel, retaining T/Z dimensions. Unsupported geometries retain separate scene layers.
Registered filename extensions offer the reader; they do not guarantee that refkv can parse the file or decode its codecs.
User workflow
Choose a file above; inspect the selected layer below.
Open Data as virtual OME-ZARR
Progress and status
Selected canvas: preview T/Z index while dragging;
request the final frame on release.
Native S stack: napari slider + dock number.
Separate scenes: dock slider + number.
Selected layer metadata
Zarr structure / Metadata
source series / channel ome zarr_structure czi_assembly (when present) reader_warning (when present)
Plugin dock
- Select the source; a dock drop only selects it.
- Optionally choose a VZIP destination.
- Click Open; a worker prepares the lazy layer data.
- The Qt thread adds the returned layers.
File > Open or canvas drop
Choose this reader. The same combined dock opens or is reused. These paths do not save an archive automatically.
Inspect without reading pixels
The inspector follows the active layer and uses a metadata-only snapshot. An unrelated layer clears it.
The Zarr tree describes the original reference store. For an assembled CZI, the displayed mosaic can have different shapes and levels; inspect czi_assembly as well.
Scene display
Matching scenes keep one layer in both modes.
Matching scenes open with napari's native S slider. The dock's 1-based scene-number field supports direct entry and up/down arrows. Native S indices are 0-based; both controls stay synchronized.
Switch to One canvas to see all matching scenes at their recorded Y/X positions, with T/Z sliders retained. S becomes spatial placement and C remains separate layers. Switch back to restore original scene arrays, pyramid levels and the selected scene.
One spatial canvas when safe
Scenes need the same axes, shape, dtype, scale, pyramid depth and channel membership. S/T/C/Z/Y/X canvases require shared T/Z origins and no rotation, shear or extra affine transforms. Gaps are zero; later numeric scenes win overlaps.
Separate layers when needed
Nonmatching scenes keep their own shapes and pyramids. The dock slider and scene-number field show one scene at a time; canvas mode shows them together. Independent scene/channel visibility can also prevent stacking.
Large sparse canvases gain lazy nearest-neighbour overviews. Fractional scene positions also use nearest-neighbour canvas sampling. This is display composition, not registration, and it does not recover missing native data.
Generated overview chunks share a 64 MiB in-memory least-recently-used cache across channels and levels. First visits still read source images. Cached revisits avoid those reads; native and stored levels remain uncached. Mode conversion creates a fresh cache. There is no background prefetch.
The dragging option applies to this viewer's shared dimension controls while a composed CZI canvas is selected. Other selections, leaving composed mode or closing the widget restore previous tracking. Numeric entry commits on Enter or focus loss.
Mode changes apply to the active source load. Native S stacks follow napari's shared dimension controls; separate-layer dock sliders retain independent scene indices.
Persistence
A VZIP saves the map, not the image pixels.
Choose the original CZI for mosaic assembly. Reopened VZIPs may show only regular levels and warn about remaining tiles. Source access must also be permitted by refkv's policy.
Saving stages the archive before publishing it. Replacing an existing destination requires confirmation; a failed write preserves the old archive. Cancelling the save dialog cancels that open action.
Boundaries
Lazy does not mean every file is complete.
OME images + usable codecs
Unsupported tiles remain
No supported OME image
Supported 2D CZI mosaics use deterministic tile placement, not registration or blending. This plugin does not use czitools or libCZI as a fallback.
The incomplete-tile warning is also CZI-specific. No warning for another format is not proof of a complete view.
Remote inputs, non-image tables, arbitrary tensors and stores without OME image metadata are outside the current reader scope. Decode errors propagate; zero-filled mosaic gaps are not an error-recovery mechanism.
Implementation sources
Reader: read_images, scene compatibility and archive saving
Dock: native S controls, scene restoration and Qt delivery
Canvas: compose_scene_canvas and chunk-local reads
Metadata inspector and batched refresh
Editable Mermaid read-path diagram
Describes the current implementation, not a guarantee of upstream format support. Continue with the detailed CZI assembly guide.