A plugin to classify aphids by stage of development.

License BSD-3 PyPI Python Version tests codecov napari hub

A plugin to classify aphids by stage of development.

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


You can install napari-aphid via pip:

pip install napari-aphid

To install latest development version :

pip install git+https://github.com/hereariim/napari-aphid.git


This plugin is a tool to count the number of aphids from two models developed on ilastik. Implemented in napari, this tool allows the correction of pixels and labels that are not well predicted.

In this plugin we find our two main parts of the aphid counting model presented in two widgets. A third widget allows to save the updates applied on the segmentation mask.

This plugin is an use cas, dedicated to private use of french laboratory.

Plugin input


The user must give two objects as input:

  • Compressed file in .zip format
  • Ilastik pixel classification model in .ilp format

In particular, compressed file must be organized as follows:

└── Country.zip
    └── Country
        ├── Area1
        │   ├── Area1.im_1.tif
        │   ├── Area1.im_1.h5
        │   ├── Area1.im_2.tif 
        │   ├── Area1.im_2.h5  
        │   ├── Area1.im_3.tif
        │   ├── Area1.im_3.h5
        │   ...
        │   ├── Area1.im_n.tif
        │   └── Area1.im_n.h5
        ├── Area2
        │   ├── Area2.im_1.tif
        │   ├── Area2.im_1.h5
        │   ├── Area2.im_2.tif
        │   ├── Area2.im_2.h5
        │   ├── Area2.im_3.tif
        │   ├── Area2.im_3.h5
        │   ...
        │   ├── Area2.im_n.tif
        │   └── Area2.im_n.h5
        └── Arean
            ├── Arean.im_1.tif
            ├── Arean.im_1.h5
            ├── Arean.im_2.tif
            ├── Arean.im_2.h5
            ├── Arean.im_3.tif
            ├── Arean.im_3.h5
            ├── Arean.im_n.tif
            └── Arean.im_n.h5

In each folder Area1, Area2, ..., Arean, we notice that each tif image is accompanied by its h5 version. The images in h5 format were generated by the Export h5 widget of the Ilastik plugin in the ImageJ software.


The user must give the Ilastik object classification model in .ilp format.

Widget: Image segmentation

This widget is a tool to segment a set of images. It takes as input a compressed file of images and an ilastik segmentation model. A Run button is used to start the image segmentation process. In the background, the console presents the progress status. This widget returns a menu which is a list of processed images. This list allows an RGB image and its segmentation mask to be displayed in the napari window.


User conduct : In this widget, the user corrects the image with the annotation tools (brush and eraser only). With the brush, he/she has to add the same colour presented in the image. To obtain this colour, the user can take the color with the color picker tool. With the eraser, he/she erase colour not well predicted. Tous les annotations appliquées dans l'image doit être sauvegarder avec le bouton Save du widget Save modification

Widget: Save modification

This is the backup of the segmentation mask. It saves updates applied to the mask.

Widget: Object classification

This widget is a tool to classify segmented images. It takes as input an ilastik object classification model. A Run button is used to start the classification process. In the background, the console shows the progress of the image processing. This widget returns a menu that lists the processed images. This list provides two elements. The first is the display of the selected image in the window. The second is the display of a table that shows the predicted classes for each object.


User conduct : In this widget, the user corrects labels not well predicted in the table at the bottom right. He must not forget to save his correction with the Save button. When the user has finished with all his images, he uses the Export button to import a quantitative table. This table contains for each image, the name of the aphid type and its size in pixels.


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, "napari-aphid" is free and open source software


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


  • 1.1.7

Last updated:

  • 30 June 2023

First released:

  • 13 January 2023


Supported data:

  • Information not submitted

Plugin type:

GitHub activity:

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

Python versions supported:

Operating system:


  • napari
  • numpy
  • magicgui
  • qtpy
  • opencv-python-headless
  • scikit-learn
  • scikit-image
  • h5py
  • matplotlib
  • pandas
  • scipy