[](https://badge.fury.io/py/microviewer)
# microviewer
Multiplatform 3D numpy image browser based viewer.
```python
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 ])
```
```bash
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
```

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](https://numpy.org/neps/nep-0001-npy-format.html) or [.ckl](https://github.com/seung-lab/crackle), 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](https://github.com/seung-lab/osteoid) Skeletons
- Color By: Connected Component, Radius, Cross Sectional Area
- [zmesh](https://github.com/seung-lab/zmesh) and [CloudVolume](https://github.com/seung-lab/cloud-volume) Meshes
- Point Clouds
- Bounding Boxes
### Example
```python
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')
```

## Installation
```bash
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.
```bash
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/seung-lab/microviewer/",
"name": "microviewer",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "William Silversmith",
"author_email": "ws9@princeton.edu",
"download_url": "https://files.pythonhosted.org/packages/59/dd/cbba908d0c185fe6a78dcfb1d88755561eb97649d8ae2de7fd2336e6b565/microviewer-1.17.1.tar.gz",
"platform": null,
"description": "[](https://badge.fury.io/py/microviewer)\n\n# microviewer\nMultiplatform 3D numpy image browser based viewer.\n\n```python\nfrom microviewer import view, hyperview, objects\n\nview(numpy_image) # for gray and color images\nview(numpy_image, seg=True) # for segmentation labels\nview(numpy_image, seg=True, port=8082)\n\nhyperview(image, labels) # interactive overlay\n\n# uses vtk to visualize meshes, bounding boxes, \n# skeletons, and point clouds\nobjects([ mesh, skeleton, bbox, point_cloud ])\n```\n\n```bash\nuview image.npy.gz # view as image\nuview labels.npy.gz --seg # view as segmentation\nuview image.npy.gz labels.npy.gz # view image w/ overlay\nuview image.npy.gz --paint # view image w/ blank overlay\n```\n\n\n\nVisualize 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.\n\n## Features\n\n- 3 axis visualization of 3D images.\n- Grayscale images with segmentation overlay.\n- Segmentation selection with brush tools.\n- Direct voxel painting.\n- Save segmentation as [.npy](https://numpy.org/neps/nep-0001-npy-format.html) or [.ckl](https://github.com/seung-lab/crackle), an advanced compresssion format.\n- Undo/Redo\n\n## 3D Image Support\n\n- 8-bit grayscale 3D images\n- color images (including 3 channel 3D images)\n- floating point images\n- boolean images\n- segmentation labels\n- .npy, .ckl, .nrrd, or .nii format\n\nFor .ckl, .nrrd, and .nii formats, you must install crackle-codec, pynrrd, and nibabel respectively. All are installed by the \"all_formats\" optional installation argument.\n\n## 3D Object Support\n\n- [osteoid](https://github.com/seung-lab/osteoid) Skeletons\n\t- Color By: Connected Component, Radius, Cross Sectional Area\n- [zmesh](https://github.com/seung-lab/zmesh) and [CloudVolume](https://github.com/seung-lab/cloud-volume) Meshes\n- Point Clouds\n- Bounding Boxes\n\n### Example\n\n```python\nimport numpy as np\nimport zmesh\nimport kimimaro\nimport crackle\nimport microviewer\nfrom osteoid.lib import Bbox\n\nlabels = crackle.load(\"connectomics.npy.ckl.gz\", label=62347522)\nresolution = np.array([16,16,40])\n\nskel = kimimaro.skeletonize(\n labels, \n teasar_params={\n 'scale': 3,\n 'pdrf_exponent': 8,\n },\n anisotropy=resolution,\n)[1]\n\nmesher = zmesh.Mesher(resolution)\nmesher.mesh(labels)\nmesh = mesher.get(1)\n\nbbox = Bbox([0,0,0], np.array(labels.shape) * resolution)\n\nmicroviewer.objects([ bbox, mesh, skel ], skeleton_color_by='radius')\n```\n\n\n\n## Installation\n\n```bash\npip install microviewer\n```\n\nBy default, only .npy files are supported. Additional formats are supported via optional downloads.\n\nPossible optional arguments: \n\n`all_formats`, `nii`, `nrrd`, `ckl`, `jxl`, \n`objects`, \n`all` \n\nNote: jxl and objects have relatively heavy downloads.\n\n```bash\npip install \"microviewer[all]\"\n```\n\n## History\n\nThis 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.\n\n",
"bugtrack_url": null,
"license": "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",
"summary": "Visualize 3D numpy arrays in the browser.",
"version": "1.17.1",
"project_urls": {
"Homepage": "https://github.com/seung-lab/microviewer/"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "831c2f0522923c184aa8b3df01e15c8e09730b2dffcbba0cc12c4cc0b18dd58c",
"md5": "c4a445f3bcef4adbcd7fdf46348f4af8",
"sha256": "1b5facab2ba4354772e0c73d3054c7bd15d82ce1a047f3aacd28e8997674c31c"
},
"downloads": -1,
"filename": "microviewer-1.17.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c4a445f3bcef4adbcd7fdf46348f4af8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 160241,
"upload_time": "2025-07-16T19:33:55",
"upload_time_iso_8601": "2025-07-16T19:33:55.843022Z",
"url": "https://files.pythonhosted.org/packages/83/1c/2f0522923c184aa8b3df01e15c8e09730b2dffcbba0cc12c4cc0b18dd58c/microviewer-1.17.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "59ddcbba908d0c185fe6a78dcfb1d88755561eb97649d8ae2de7fd2336e6b565",
"md5": "e4b3fd82aa3144cab6d0683a6a9c56ad",
"sha256": "618a33a8dee86cbde8e70d39e9ab6d91813c7933520cf5ac9a5946a6e51dce73"
},
"downloads": -1,
"filename": "microviewer-1.17.1.tar.gz",
"has_sig": false,
"md5_digest": "e4b3fd82aa3144cab6d0683a6a9c56ad",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 1483999,
"upload_time": "2025-07-16T19:33:58",
"upload_time_iso_8601": "2025-07-16T19:33:58.697896Z",
"url": "https://files.pythonhosted.org/packages/59/dd/cbba908d0c185fe6a78dcfb1d88755561eb97649d8ae2de7fd2336e6b565/microviewer-1.17.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-16 19:33:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "seung-lab",
"github_project": "microviewer",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "click",
"specs": []
},
{
"name": "numpy",
"specs": []
}
],
"lcname": "microviewer"
}