Skip to content

μViewer

William Silversmith edited this page Jan 31, 2019 · 18 revisions
from cloudvolume import CloudVolume, view, hyperview

channel_vol = CloudVolume(...)
seg_vol = CloudVolume(...)
img = channel_vol[...]
seg = seg_vol[...]

img.view() # works on VolumeCutouts
seg.view() # segmentation type derived from info file
view(img) # alternative for arbitrary numpy arrays
view(seg, segmentation=True) 
hyperview(img, seg) # img and seg shape must match

>>> Viewer server listening to http://localhost:8080

Point your browser at http://localhost:8080 after starting the viewer as depicted above.

CloudVolume includes a built-in dependency free viewer for 3D volumetric datasets smaller than about 2GB uncompressed. It can be useful if you want to visualize arbitrary numpy arrays, a cutout without the surrounding area, a cutout from a distributed job, or if you are unwilling or unable to set up your files to work with neuroglancer. This capability supplements the save_images feature that can save a numpy array into an image stack.

Features

  • Image and Segmentation
  • X, Y, Z axial reslicing
  • bool, uint8, uint16, uint32, float32, and float64 data types (NaN, -Inf display as black, +Inf white)
  • Limited support for 64-bit integer data (converted to float64)
  • Single image viewer and "hyperview" which combines an EM image and a segmentation overlay.
  • Hover highlight of segmentation and dynamic recoloring
  • Neuroglancer keyboard controls
  • Mapping of image pixels to neuroglancer coordinates
  • Up to 2GB individual volumes (two volumes can exceed this limit in aggregate).

Controls

Control Command
Change Slice Scroll, comma, period, W, S
Change Axis Space, A, D
Freeze Voxel Information Left Click
Recolor Segmentation L
Clear Selected Segmentation X
Change Segmentation Opacity +, -

Image View

Grayscale view

Segmentation View

Segmentation View

Composite View (Hyperview)

Composite View (Hyperview)

How does it work?

The microviewer server uses the standard Python http.server (formerly the SimpleHTTPServer) and thus requires no dependencies.

The client is in Javascript and is based on the open source custom 2D canvas renderer written for eyewire.org called DataCube. DataCube's represents volumetric images as 1D typed arrays that allows for the computation of 2D axial slices as both ordinary images and as canvas imagedata. The small and self-contained footprint makes it simple to include in many different contexts. The simplicity of the representation makes it easy to apply transforms to the data, though care is required to make such operations fast enough for real time rendering.

Consider using DataCube in your own project: https://github.com/seung-lab/data-cube-x

--
Made with <3.