Skip to main content

PyPI version

microviewer

Multiplatform 3D numpy image browser based viewer.

from microviewer import view, hyperview, objects

view(numpy_image) # for gray and color images
view(numpy_image, seg=True) # for segmentation labels
view(numpy_image, seg=True, port=8082)

hyperview(image, labels) # interactive overlay

# uses vtk to visualize meshes, bounding boxes, 
# skeletons, and point clouds
objects([ mesh, skeleton, bbox, point_cloud ])
uview image.npy.gz # view as image
uview labels.npy.gz --seg # view as segmentation
uview image.npy.gz labels.npy.gz # view image w/ overlay
uview image.npy.gz --paint # view image w/ blank overlay

Segmentation display in microviewer

Visualize 3D numpy arrays in your browser without difficult installation procedures or reformatting your data. The code is CPU based and the image is uncompressed in memory. You're limited to images that are at most 2^31 bytes large (~2.1 GB) due to browser limitations.

Features

  • 3 axis visualization of 3D images.
  • Grayscale images with segmentation overlay.
  • Segmentation selection with brush tools.
  • Direct voxel painting.
  • Save segmentation as .npy or .ckl, an advanced compresssion format.
  • Undo/Redo

3D Image Support

  • 8-bit grayscale 3D images
  • color images (including 3 channel 3D images)
  • floating point images
  • boolean images
  • segmentation labels
  • .npy, .ckl, .nrrd, or .nii format

For .ckl, .nrrd, and .nii formats, you must install crackle-codec, pynrrd, and nibabel respectively. All are installed by the "all_formats" optional installation argument.

3D Object Support

  • osteoid Skeletons
    • Color By: Connected Component, Radius, Cross Sectional Area
  • zmesh and CloudVolume Meshes
  • Point Clouds
  • Bounding Boxes

Example

import numpy as np
import zmesh
import kimimaro
import crackle
import microviewer
from osteoid.lib import Bbox

labels = crackle.load("connectomics.npy.ckl.gz", label=62347522)
resolution = np.array([16,16,40])

skel = kimimaro.skeletonize(
  labels, 
  teasar_params={
    'scale': 3,
    'pdrf_exponent': 8,
  },
  anisotropy=resolution,
)[1]

mesher = zmesh.Mesher(resolution)
mesher.mesh(labels)
mesh = mesher.get(1)

bbox = Bbox([0,0,0], np.array(labels.shape) * resolution)

microviewer.objects([ bbox, mesh, skel ], skeleton_color_by='radius')


# x = cross sectional area (if precomputed)
# r = radius (if precomputed, but usually is)
# c = connected components
microviewer.objects([ bbox, mesh, skel ], skeleton_color_by='x', skeleton_heatmap={
  "min": 100, # automatically determined if unspecified
  "max": 100000, # automatically determined if unspecified
  "scale": "log", # linear (default) or log
})

3D object display in microviewer via vtk

Installation

pip install microviewer

By default, only .npy files are supported. Additional formats are supported via optional downloads.

Possible optional arguments:

all_formats, nii, nrrd, ckl, jxl,
objects,
all

Note: jxl and objects have relatively heavy downloads.

pip install "microviewer[all]"

History

This microviewer package has been a part of CloudVolume since 2018, but is now broken out into its own package for more flexible wider use. Microviewer uses a modified version of https://github.com/seung-lab/data-cube-x/ (2016) to represent the array in Javascript, which was originally developed for eyewire.org.

Release files for microviewer 1.21.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for microviewer 1.21.0
File Size Uploaded
microviewer-1.21.0.tar.gz 1.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for microviewer 1.21.0
File Interpreter ABI Platform
microviewer-1.21.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.6 MB

Release files / microviewer-1.21.0.tar.gz

Download URL microviewer-1.21.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
072b6d6008fcfe3001c920b2fc24e3b913384b35691f88f84c971d902f375c53
BLAKE2b-256 checksum
How to use checksums
c5ad389fab379346658d70b4da421ad5e1605b1ecf0f2513460ba532bdae60e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / microviewer-1.21.0-py3-none-any.whl

Download URL microviewer-1.21.0-py3-none-any.whl
Size 161.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8de9d6814dab3a1af1869807b556b8b7876797e6b6198797dc3563c23174a56c
BLAKE2b-256 checksum
How to use checksums
4154bd41b09b521183b0cb0b3abe1e483058846a8ed79c5ef73c8600590028be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.21.0 This release

2 release files

1.20.0

2 release files

1.19.0

2 release files

1.18.0

2 release files

1.17.1

2 release files

1.16.0

2 release files

1.15.1

2 release files

1.15.0

2 release files

1.14.0

2 release files

1.12.0

2 release files

1.11.0

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.6

2 release files

1.6.5

2 release files

1.6.4

2 release files

1.6.3

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page