Napari

0.7.0 · active · verified Fri Apr 17

napari is an n-dimensional array viewer in Python, providing an interactive, multi-dimensional data viewer for scientific visualization. It emphasizes image processing and analysis, offering a flexible, plugin-friendly architecture. As of version 0.7.0, it continues active development with regular feature additions and improvements to its core architecture and ecosystem.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart initializes a napari viewer, adds a simple 2D image layer generated with NumPy, and ensures the viewer's event loop is started using `napari.run()` for a responsive GUI. Replace `np.random.rand` with your actual image data.

import napari
import numpy as np

# Create an empty napari viewer
viewer = napari.Viewer()

# Add a 2D image layer with random data
viewer.add_image(np.random.rand(128, 128), name='random image')

# Start the napari event loop (essential for the GUI to appear and be interactive)
if __name__ == '__main__':
    napari.run()

view raw JSON →