A plugin to load images stored in MATLAB .mat files with napari

PyPI version

Python versions

See Build Status on Azure Pipelines


This plugin loads image variables stored in MATLAB .mat files into napari.

It loads any variable that looks like an image. Presently, that includes any array with more than two dimensions with size greater than 20 pixels (determined by shape_is_image()).

If loading a variable with 3 or more dimensions, the plugin assumes that it is a stack of images, and the dimension with greatest size is the axis of the stack.

Loading Large Files

If loading a large .mat file saved in HDF5/v7.3 format, chunks of the images are loaded as needed, resulting in fast initial load, but potentially slower scrolling.

Slices of the image stacks are randomly sampled to determine min/max contrast values.


This plugin relies on scipy to load small .mat files and h5py (with dask) to load larger HDF5/v7.3 .mat files.

It implicitly requires napari for use.


napari-mat-images requires napari to be installed, although it is not listed as a requirement for installation. This plugin relies on plugin functionality found in napari version > 0.2.12. This can be installed via pip from PyPI:

$ pip install napari>0.2.12

You can install napari-mat-images via pip from PyPI:

$ pip install napari-mat-images


Once installed, the plugin will be used whenever trying to load a .mat file. This can be done from the napari GUI or commandline:

$ napari my_file.mat


Contributions are very welcome. Tests can be run with pytest, please ensure the coverage at least stays the same before you submit a pull request.


Distributed under the terms of the BSD-3 license, napari-mat-images is free and open source software


If you encounter any problems, please file an issue along with a detailed description.

This napari plugin was generated with Cookiecutter along with napari's cookiecutter-napari-plugin template.


  • 0.1.3

Last updated:

  • 30 June 2021

First released:

  • 29 March 2020


Supported data:

  • Information not submitted

Plugin type:

  • Information not submitted

GitHub activity:

  • Stars: 1
  • Forks: 1
  • Issues + PRs: 2

Python versions supported:

Operating system:


  • dask[delayed]
  • h5py
  • numpy
  • pluggy
  • scipy

Sign up to receive updates