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.

Version 0.0.4 / scene controls, overview cache and release-only dragging.

PREPARE / METADATA AND ARRAY GRAPHS maps adapts requests regions reads bytes Local imageCZI, TIFF, ... refkv + Zarrreferences + OME Lazy napari layersDask arrays Original bytesstay on disk Zarr + codecsdecode on demand VIEW / PIXEL READS
  1. Select a local source; no converted image is required.
  2. refkv describes the source as reference-backed Zarr with OME image metadata.
  3. The plugin builds lazy layers without scanning their pixels.
  4. Viewing triggers source reads and decoding; decoded arrays exist in memory, not as a converted file.
Fig. 1Virtualization avoids a persistent pixel copy, not the memory and decoding needed to display an image.

Open path

Raw images and archives meet at the same reader.

select raw imageselect VZIPwrap referencesexpose referencesfind OME imagessupply live CZI factorsroute supported CZIkeep other formatsstack compatible scenesswitch matching CZI scenesrelease thumb by defaultreuse generated overviewsselect layerselect layerLocal inputzarrifyrefkv.zarr.openZarr groupLazy layersCZI assemblynapari image layersCanvas: T/Z + spatial Y/XChosen T/Z plane64 MiB overview LRUMetadata inspectorselect raw imageselect VZIPwrap referencesexpose referencesfind OME imagessupply live CZI factorsroute supported CZIkeep other formatsstack compatible scenesswitch matching CZI scenesrelease thumb by defaultreuse generated overviewsselect layerselect layerLocal inputzarrifyrefkv.zarr.openZarr groupLazy layersCZI assemblynapari image layersCanvas: T/Z + spatial Y/XChosen T/Z plane64 MiB overview LRUMetadata inspector
Fig. 2Only a raw CZI supplies the live calibration summary used for new tile assembly.

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.

CZI-only assembly. Other formats bypass this extra path. They can still display images and pyramids already exposed by refkv, but this plugin does not yet assemble their separate irregular tile arrays.

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

Image file or VZIP archive / Browse
[ ] Save VZIP archive
Open

Progress and status

CZI scenes: One canvas / Scene slider
Scene number: type or use up/down arrows
[ ] Update while dragging

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

Filter properties
source
series / channel
ome
zarr_structure
czi_assembly (when present)
reader_warning (when present)

Plugin dock

  1. Select the source; a dock drop only selects it.
  2. Optionally choose a VZIP destination.
  3. Click Open; a worker prepares the lazy layer data.
  4. 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.

Fig. 3The opener and inspector share one dock but retain separate jobs; this is a schematic, not a screenshot.

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 / SCENE SLIDER MATCHING / ONE CANVAS NONMATCHING FALLBACK ONE CHANNEL LAYER Selected sceneS = 19original pixels Scene 20 / 28 switch ONE CHANNEL LAYER All scene positionslazy chunks + overviews 28 scene footprints Scene A / layeroriginal size + pyramid Scene B / layerdifferent shape Canvas: show togetherDock slider: show one Schematic layouts, not measured scene positions. Repeat per acquisition channel.
Fig. 4Both modes retain one layer per channel for matching scenes, including T/Z; incompatible scenes stay separate.

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.

UPDATE WHILE DRAGGING / OFF BY DEFAULT FOR A SELECTED CANVAS previews releases Drag T: 30 to 10no intermediate reads Index shows 10image stays at T=30 Request T=10one chosen position Keys, step/page clicks, committed numeric entry and playback stay immediate. Enable live dragging to request intermediate positions again.
Fig. 5Release-only dragging avoids starting a new frame calculation at each intermediate thumb position.

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.

indexes saves still references original source Original filekeep unchanged Reference layoutin memory VZIP archiveoptional file Not a portable, self-contained pixel backup.
Fig. 6Saving preserves refkv's reference layout, not the plugin's runtime CZI mosaic, overview cache or live pyramid-factor summary.

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.

Supported path

OME images + usable codecs

mapsOMELayers
Incomplete CZI

Unsupported tiles remain

Warning
Explicit failure

No supported OME image

No image layer
Fig. 7A pyramid alone is not evidence that native resolution or every source tile is displayed.

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.

Experimental software. Validate scientific results independently, especially overlap regions and views with warnings.

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.