It’s a while ago that I wrote about supervised image classification combining ImageJ and R in Bio7 (see video here). Later I decided to create a classification Graphical User Interface for Bio7 to make this process easier and implement typical functions for convenience.
However it took some time to finish a first version of this plugin and also to create a first documentation – working on it when I had some time to spare.
Click on the screenshot below to see a video on YouTube:
The plugin uses mainly the Java API of ImageJ to load, transform and filter images for a feature stack and transfer ROI (Region Of Interest) selections of this stack (pixel values) to R to train and classify the data with dedicated R scripts. The GUI itself reuses a powerful ImageJ component to collect selections (ROI Manager) and is embedded in a flexible view container (can be dragged around and detached).
Until now the plugin supports several datatypes, conversions, filters (features) and a GUI to apply a trained R classifier on multiple selected images or directories with the selected features easily.
The simple R scripts which can be executed from the GUI are using by default the randomForest package to train and classify the images. Automatically the classified results are transferred back to ImageJ for visualization and post-processing, e.g., object detection or particle analysis.
For a reproducible workflow all selections (using ROI Manager methods) and current GUI settings can be saved, e.g., for classification workflows of different tasks (cell detection, landscape analysis, etc.).
The plugin itself can be downloaded and installed via Github (e.g., using the Eclipse EGit plugin) and then compiled dynamically. Later it will be shipped with the upcoming Bio7 3.2 release.
At all the plugin is concepted in that way that it can be extended easily (extending the GUI interface using, e.g., the free Eclipse WindowBuilder plugin or simply extending the R scripts).
I tried to hold the source compact, as easy as possible and as complex as necessary.
The installation details and documentation can be found on the dedicated Github page:
If you have some suggestions or ideas for improvements of the plugin let me know.
If you don’t know Bio7 at all:
The plugin can be installed into the OpenSource software Bio7 which can be found here:
4 thoughts on “Supervised Image Classification with ImageJ and R in Bio7”