Generate Dense Patches


A simple plugin to create a lot of training data from a 3D volume and mask

License BSD-3 PyPI Python Version tests codecov napari hub

A simple plugin to create a lot of training data from a 3D volume and mask. For help with this plugin please open an issue, for issues with napari specifically raise an issue here instead.

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


It's recommended to have installed napari and pyqt through conda.

conda install napari pyqt

Then to install this plugin via pip:

pip install generate-dense-patches

To install latest development version :

pip install git+


To use this plugin with napari:

  1. Drag and drop an image and/or segmentation mask (tif) into the viewer.
  2. Open "Plugins" Toolbar and select "Generate dense patches" and click "Generate 2D Patches"

This plugin works to create a lot of 2D training data by generating an $n^3$ cube, rotating every $\theta$ slices and saving every (step size) slice of the generated volume.

  1. Make sure the "save directory box", "step size", "rotation theta", and "patch size" is filled in

If no point is placed, then the center of the image will be used as the center of the cube. If a point is placed, then the center of the cube will be the point.

  1. Press run and wait for the patches to be generated.


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


Distributed under the terms of the BSD-3 license, "generate-dense-patches" is free and open source software


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


  • 0.0.2

Last updated:

  • 12 September 2023

First released:

  • 12 September 2023


Supported data:

  • Information not submitted

Plugin type:

GitHub activity:

  • Stars: 0
  • Forks: 0
  • Issues + PRs: 0

Python versions supported:

Operating system:


  • napari >=0.4.18
  • napari-plugin-engine >=0.2.0
  • numpy ==1.22
  • scikit-image >=0.19
  • magicgui
  • imagecodecs

Sign up to receive updates