Pixel Classification GUI (using ImageJ and R in Bio7)

I finally finished a first version of a Supervised Classification GUI using ImageJ and R within Bio7:

At the moment it can be installed into Bio7 3.1 following the Github documentation (see video below).

I reused the ROI Manager for the creation of classes using the underscore notation.

The plugin can be compiled dynamically. I tried to simplify the Java source so that it can be
extended easily. Feedback and suggestions are welcome.

The executed simple R scripts (using a Random Forest example) can be adapted easily for training and classification using the R package universe.

A big thank you to @schmid to solve and fix a thread blocking RankFilters mystery.

1 Like

An update of the plugin is available which simplifies the classification process with new options for the class transfer. Now you can simply:

  1. Open an image in ImageJ
  2. Create the ROI selections in the ROI Manager (using an underscore to mark the class signatures or using optionally ROI groups (thanks to @LThomas in ImageJ available).
  3. Transfer the ROI data as a matrix to R (now the stack data is hidden)
  4. Train the selected data with R
  5. Classify and predict new data (selected images or optionally recursive directories) with R



Now a dynamic classification preview can be generated from a selection:

I also added some easy R examples using different R packages (simply change the path to the scripts):

1 Like

A new version of the plugin is available.

The plugin opens and creates features in ImageJ and classifies images with R. All scripts and macros can easily be customized. Even the whole plugin can be customized and dynamically compiled.

New features:

  • Added an option to disable the display of the classified image in ImageJ (if you store the data with R or to save RAM)
  • You can now enable and customize a post processing ImageJ macro for the classified image to detect objects and automate measurements (see Settings tab)
  • Added a project wizard action to create a reproducible project to store the data, settings and images
  • The directory dialog (classification of folders and subfolder images) is now set by default to the workspace location
  • Added more simple supervised classification examples from different R packages
  • Added unsupervised R examples (just use the Classify action)


To update the plugin in Bio7 3.2 just delete all classfiles in the plugins folder (use the R-Shell view context menu action (General->Open Script Location) and simply replace the Java files and subfolders in the Image Classification folder (or delete everything in the folder and add the new files and folder from Github).
A compilation automatically occurs when executing the Image Classification->Main action.

You can also use this repository (with the Eclipse EGit plugin - available in the Update Manager of Bio7) to download, compile (compile the Main.java file) and start the latest version of this plugin.