Package: napari-compressed-labels-io
napari-compressed-labels-ioDescriptionThis napari plugin provides readers and writers for labels and their corresponding image layers into zarr format for compression and portability. Each reader/writer pair supports a round trip of saving and loading image and labels layers.WritersTwo writers are provided by this plugin, each with its own reader.labels_to_zarrThis writer is an alternative to napari's default label writer and will write an entire labels layer, regardless of its dimensions, into a single zarr file. This writer provides the best compression option and its associated readerget_zarr_labelswill read the layer back into napari.This writer will be called when the user tries to save a selected labels layer into a path ending with .zarrlabel_image_pairs_to_zarrThis writer will save 3-dimensional labels and image layers from the viewer into individual zarrs for portability and convenience. For example, given one labels and one image layer of the shape (10, 200, 200) saved to my_stacks.zarr, 10 subdirectories will be created, each with two zarrs inside of shape (200, 200) corresponding to the labels and image layer.This writer allows users to load stacks of associated images, label them, and then quickly save these stacks out into individual slices for easy loading, viewing and interaction. Its associated reader supports the loading into napari of the whole stack, all layers at one slice of the stack, and an individual layer of a given slice of the stack.The writer currently supports only 3D layers, with the exception of RGB images of the form (z, y, x, 3), which are also supported.ReadersTwo readers are provided by this plugin for loading the formats saved by each writer. These are detailed below.get_zarr_labelsThis reader will open any zarr file with a .zarray at the top level inpathas a labels layer. This is to be used in conjunction withlabels_to_zarr.get_label_image_stackThis reader will open any zarr containing a.zmetafile as layers into napari. Depending on what is being opened, the reader will either load a full stack of labels and images, one slice of a stack of images and labels or an individual layer within a slice. This is to be used in conjunction withlabel_image_pairs_to_zarr..zmetaThis metadata file contains information about the layer types in the stack and in each individual slice, as well as the number of image/label slices. This allows the reader plugin to load the correct layer types with appropriate names both at a stack level and at the individual slice level.An example .zmeta specification{"meta":{"stack":7#numberofslicesintheentirestack(1foranindividualslice,0foralayerwithinaslice)},"data":{"image":[#allimagelayersmustbelistedhere{"name":"leaves_example_data","shape":[790,790,3],"dtype":"uint8","rgb":true#wherergbisfalsetheimagewillbeloadedasgreyscale(colormapsupporthasnotyetbeenimplemented)}],"labels":[{"name":"oak","shape":[790,790],"dtype":"int64"},{"name":"bg","shape":[790,790],"dtype":"int64"}]}}Thisnapariplugin was generated withCookiecutterusing with@napari'scookiecutter-napari-plugintemplate.InstallationYou can installnapari-compressed-labels-ioviapip:pip install napari-compressed-labels-ioContributingContributions are very welcome. Tests can be run withtox, please ensure
the coverage at least stays the same before you submit a pull request.LicenseDistributed under the terms of theMITlicense,
"napari-compressed-labels-io" is free and open source softwareIssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.