Category Archives: R

Bio7 3.2 Released

20.11.2020

A new version of Bio7 is available. This update comes with a plethora of new features, improvements and bugfixes.

Bio7 3.2 Dark theme enabled using the spatstat package examples and plots.

For those who don’t know Bio7. The application Bio7 is an integrated development environment for ecological modeling, scientific image analysis and statistical analysis.

It also contains a feature complete development environment for R with an advanced R editor, R developer tools and interfaces to perform scientific image analysis with R and the embedded ImageJ application.

New and Noteworthy

General:

  • Bio7 3.2 RCP (Rich Client Platform) built upon Eclipse 4.17
  • Bundled with AdoptOpenJDK 14.0.2 and JavaFX 15
  • Bundled with R 4.0.3 (Windows only!)
  • Added an image classification plugin for supervised and unsupervised image classification (using R and ImageJ – see R-Shell view context menu “Image Classification”). For an overview and details, see: https://github.com/Bio7/Bio7_Classification

Image Classification plugin (Dark Theme enabled)

  • Menus and scrollbars are now dark on Windows, too
  • Improved the dynamic script menus. Nested folders can be hidden for complex Java plugins (see image classification plugin).
  • Updated several Java libraries (Groovy, POI, etc.)
  • Improved several view layouts (showing scrollbars if necessary)
  • Changed all SWT ExpandBars to CTabFolders to improve the display when the dark theme is selected
  • Added more default fast wizards actions to the toolbar menu (to create Bio7 projects with files in one action)

Opened fast wizard menu (Dark Theme enabled)

  • Added new API methods (e.g., an R script job interface)
  • Enabled the recognition of Eclipse supported ASCII control characters in the console (see preferences)
  • Improved the compilation of pure LaTeX files without the necessity to run Rserve
  • Improved the dark theme on Windows, Linux and MacOSX

ImageJ

  • Updated the ImageJ plugin to version 1.53g34 (see ImageJ release notes)
  • Improved the visual interface for debugging
  • The main view menu can now be extended dynamically from plugins
  • ImageJ macros updated
  • Toolbar menus improved
  • Converted the ImageJ toolbar menus to SWT to display the dark theme
  • Converted several ImageJ context menus to SWT (recognizable on HighDPI, Linux GTK)
  • For all changes since the last release, see: https://github.com/Bio7/EclipseImageJ1Plugin

R

  • Updated the embedded R application on Windows
  • The R plugin can now be updated individually
  • Added a new ‘Load Packages’ table to display installed R packages and if updates available (selected packages can be updated in this view, too)

Load Packages tab (Dark Theme)

  • Added a grammar rule for raw string literals to the R editor (thanks to Bart Kiers)
  • Added a database preference to store the XML database profile file in a different (secret) location.
  • Fixed some minor R-Shell bugs

R + ImageJ

  • Added an option to transfer ImageJ ROI groups or special ROI names as class signatures to R (ROI Manager transfer actions in the Image-Methods view)
  • Improved the ROI stack transfer for virtual stacks (to load and transfer disk resident image stacks)
  • Improved several functions for the new image classification plugin

Download and Installation:

Windows:

Just download the *.zip distribution file from https://bio7.org and unzip it in your preferred location. Bio7 comes bundled with a Java Runtime Environment, R and Rserve distribution and works out of the box.

Linux:

Download and extract the installation file from https://bio7.org.
For Linux you have to install R and Rserve (see Rserve installation below!).

MacOSX:

Download and extract the installation file from https://bio7.org.

If you start Bio7 a warning or error can occur because of the changes how Apple treats signatures! To allow Bio7 to start see this instructions for Yosemite, Sierra, Mojave and Big Sur:

First try to open the app with the context menu to allow the execution. If that won’t work try the following:

Yosemite: Open an app from an unidentified developer

Sierra: Open an app from an unidentified developer

Moave and Sierra: How to fix “Application” is damaged and can’t be opened error in macOS Mojave and High Sierra.

In addition for MacOSX you have to install R and Rserve (see below!).

Linux and MacOSX Rserve (compiled for cooperative mode) installation:

To install Rserve open the ‘Native R’ console in the ‘Console’ view and then execute the view menu action “Options -> Install Rserve (coop. mode) for R …” for different R versions (SSL 1.1 version for Linux Ubuntu > 19.10).
This will download and install Rserve in your default R library location, see video below (please make sure that your default Linux R library install location has writing permissions!):

How to install Rserve for Linux and MacOSX: https://youtu.be/tF7HbRBRIF

In cooperative mode only one connection at a time is allowed (which we want for this Desktop apl.) and all subsequent connections share the same namespace (default on Windows)!

Bio7 Documentation

For more information about Bio7 please consult the soon updated Bio7 User Guide.

A plethora of Bio7 videotutorials for an introduction can be found on YouTube.

 

Supervised Image Classification with ImageJ and R in Bio7

24.08.2020

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:

https://github.com/Bio7/Bio7_Classification

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:

https://bio7.org

Bio7 3.1 Released

07.02.2020

A new release of Bio7 is available. This update comes with a plethora of new features, improvements and bugfixes.

R ImageJ Analysis Perspective (MacOSX Catalina, Dark Mode)

For those who don’t know Bio7. The application Bio7 is an integrated development environment for ecological modeling, scientific image analysis and statistical analysis.

It also contains a feature complete development environment for R with an advanced R editor, R developer tools and interfaces to perform scientific image analysis with R and the also embedded ImageJ application.

New and Noteworthy

General:

  • Bio7 3.1 RCP (Rich Client Platform) built upon Eclipse 4.14
  • Bundled with AdoptOpenJDK 13.0.2
  • Bundled with R 3.6.2 (Windows only!)
  • New main toolbar action available to create different projects and files in one shot
  • Added a toolbar submenu action to open the ‘Control’ view
  • ‘Dark Mode’ theme automatically enabled on supported OS (MacOSX only!)
  • ‘2D’ perspective (e.g., for cellular automata simulations) is now hidden by default.
  • Removed the ‘Image’ perspective and the ‘Points Panel’ view and actions
  • Updated libraries (SSH for Windows, etc.)
  • Improved the ‘WorldWind’, ‘2D’ and  ‘3D’ perspective to open and arrange the editor area in a user-friendly programming layout by default (see screenshots below).

WorldWind Perspective with opened Java file (MacOSX Catalina, Dark Mode)

2D Perspective with opened Java file (MacOSX Catalina, Dark Mode)

  • JavaFX has been disabled by default in the preferences for Linux HighDPI displays (e.g., GTK scale 2) because of an open bug when embedded in an SWT canvas.
  • Improved the default Bio7 CSS interface colors

R:

  • New toolbar wizard to create quickly R, R Markdown and Shiny files in a project
  • New R Packages tab available to show and update installed R packages (see screenshot below)

Load Packages Tab (MacOSX Catalina, Dark Mode)

  • Changed the ‘Image-Methods’ view to show only R/ImageJ related actions (bidirectional transfer of image data, selection data, particle and cluster methods, etc.)
  • Added the ‘Geometry Selections’ view to the ‘R ImageJ Analysis’ perspective to transfer ROI selection coordinates as a list or georeferenced data geometries (using package ‘sp’ and Java GDAL)
  • Added the KMeans cluster algorithm to the ‘Cluster Pic’ action in the ‘Image-Methods’ view
  • The ‘R ImageJ Analysis’ perspective is now visible by default
  • Improved the ‘Pixel RM’ and ‘Pixel RM Stack’ action to transfer all ROI selections more efficiently, especially for VirtualStacks of ImageJ
  • Added a new option in the ‘Pixel RM’ and ‘Pixel RM Stack’ action to transfer ROI Manager selections signature names according to a separator char (handy for supervised classification with ImageJ and R)
  • Added a new stack transfer API method (‘imageFeatureStackToR’) to transfer whole stacks in a column layout (for pixel classification)
  • The ‘R-Shell’ view list now scrolls to the last selected variables after a workspace refresh
  • New R editor ‘Quickfixes’ available (warning for an assignment operator in function call, check for null and na in comparison operators)
  • Improved the code completion of the ‘R-Shell’ view and the R editor
  • Improved the plot layout in ImageJ (when using the preference option ‘ImageJ View Display Size’ in the Rserve plot preferences)
  • Added a Shiny timeout to improve the server startup
  • Updated the R ANTLR parser

ImageJ:

  • Updated ImageJ to version 1.52t(.51)
  • Added a new ImageJ macro debugger interface
  • Added a new thumbnail action to the context menu of the ‘Navigator’ view to open image and LUT files of a selected directory
  • Added a ‘Detach All Images’ action to transfer all opened tab images to a view (which can be moved and arranged like a separate window)
  • Improved the dark theme for all AWT components
  • Added new default macro editor templates
  • Improved the ImageJ plot windows
  • Improved the detached image view layout
  • Improved the canvas layout for HighDPI displays on Windows
  • Huge amount of other changes since the last release. For all changes, see:https://github.com/Bio7/EclipseImageJ1Plugin

Java:

  • Dynamic compilation now supports Java 13 by default
  • Added a new option to dynamically compile a class without a constructor call (without object creation). The object has to be created in the main method (as known from Java).
  • Updated the Java OpenGL (JOGL) 3D interfaces
  • Updated Java WorldWind to the latest version
  • Fixed the OpenGL view visibility on MacOSX (the ‘3D’ and ‘WorldWind’ view stayed visible when switching to another perspective)
  • Added an experimental fullscreen option to open WorldWind and the ‘3D’ view on a secondary monitor (press F3)
  • Updated Java libraries

Download and Installation:

Windows:

Just download the *.zip distribution file from https://bio7.org and unzip it in your preferred location. Bio7 comes bundled with a Java Runtime Environment, R and Rserve distribution and works out of the box.

Linux:

Download and extract the installation file from https://bio7.org.
For Linux you have to install R and Rserve (see Rserve installation below!).

MacOSX:

Download and extract the installation file from https://bio7.org.

If you start Bio7 a warning or error can occur because of the changes how Apple treats signatures! To allow Bio7 to start see this instructions for Yosemite, Sierra and Mojave:

First try to open the app with the context menu to allow the execution. If that won’t work try the following:

Yosemite: Open an app from an unidentified developer

Sierra: Open an app from an unidentified developer

Moave and Sierra: How to fix “Application” is damaged and can’t be opened error in macOS Mojave and High Sierra.

In addition for MacOSX you have to install R and Rserve (see below!).

Linux and MacOSX Rserve (compiled for cooperative mode) installation:

To install Rserve open the ‘Native R’ console in the ‘Console’ view and then execute the view menu action “Options -> Install Rserve (coop. mode) for R …” for different R versions (SSL 1.1 version for Linux Ubuntu > 19.10). This will download and install Rserve in your default R library location, see video below (please make sure that your default Linux R library install location has writing permissions!):

How to install Rserve for Linux and MacOSX: https://youtu.be/tF7HbRBRIF

In cooperative mode only one connection at a time is allowed (which we want for this Desktop appl.) and all subsequent connections share the same namespace (default on Windows)!

Bio7 Documentation

For more information about Bio7 please consult the soon updated Bio7 User Guide.

A plethora of Bio7 videotutorials for an introduction can be found on YouTube.

Easily Built And Share Custom R Menu Scripts With Bio7

09.04.2019

Bio7 can be extended with R packages, Eclipse plugins and ImageJ plugins. Another very easy option to extend the Bio7 Graphical User Interface with R actions are dynamic menus which can be used, e.g., for personalized workflows or repeating tasks.
The provision of new menus and nested menus is simple and can be arranged for different tasks.

Three different menu locations can be populated with custom scripts. One location is the context menu of the R-Shell view.

To extend the R-Shell context menu scripts have to be copied to a default script location of the Bio7 installation. Folders in the locations constitute a new submenu, nested folders results in nested submenus. It is not necessary to restart the application because the menus are updated automatically and copied scripts are instantly available as an executable action

Executable R scripts in a menu can be used for instance to offer different plot actions (there is a special hidden vector variable available ‘.r_shell_vars‘ to get multiple selected objects, e.g., to plot a selected variable (without the need to use a Java to R API!):

plot(get(.r_shell_vars[[1]]))

In addition the different default script locations can be changed in the preferences. This is handy if you want to share scripts in a team using, e.g., GIT for updates and reproducibility.
For Bio7 you can install the Eclipse GIT plugin (Menu: Help->Install New Software, Select ‘Eclipse Repository’, search for ‘git’, select and install ‘Git integration for Eclipse’) to share a local script folder on GitLab, Github, Bitbucket, etc.

A short overview how to create custom menus in the R-Shell context menu is demonstrated in the video below:

Please note that the menus can also be extended with JVM script types which run on the JVM (Java, Jython, Groovy, BeanShell, JavaScript, ImageJ Macro). If a custom interface should be created a selected JVM language can be used to create custom views and populate a special custom perspective.
Special API functions for the interaction of Java and R are available, too.

An example how to build and invoke a custom interface with Java SWT is shown in the video below (a pure Java example installing and using the WindowBuilder plugin):


Bio7 3.0 Released

27.03.2019

A new release of Bio7 is available which is built upon Eclipse 4.11 and the latest Java OpenJDK. This new version comes bundled with OpenJDK 12, supports the dynamic compilation of Java 11 and fixes several annoying bugs on MacOSX (e.g., shutdown crashes).

The R interface has been improved and the R-Shell now updates the workspace display automatically after a R code evaluation or R data transfer.

In additon for Bio7 3.0 the themes have been improved (especially for MacOSX and the Mojave dark mode) and some Touch Bar actions for MacOSX are available, too (if the MacOSX device has a Touch Bar).

Screenshots:

Screenshot MacOSX Mojave (dark mode)

Screenshot Linux Ubuntu 18.10:

Release Notes:

General:

  • Built upon OpenJDK 12 and Eclipse 4.11
  • Bundled with OpenJDK 12
  • Improved script menus
  • Touch Bar actions for MacOSX devices when a Touch Bar is available (can be enabled in the Bio7 preferences)
  • Image perspective is now hidden by default (we have already the ImageJ edit perspective)
  • Updated SSH executables for Windows
  • Multiple Images and PDF files can now be opened from without a lost focus

R:

  • Windows version bundled with R 3.5.3 and Rserve
  • R-Shell displays objects after evaluation
  • More default scripts in the R-Shell scripts menu (PyRserve, Install Rserve, etc.)
  • R-Shell visual improvements (line height of code completion – see preferences)
  • Added Touch Bar actions for MacOSX (can be enabled in the preferences)
  • Clipboard code evaluation improved
  • Improved browser selection for rmarkdown, knitr, R help, etc.
  • Improved text search speed for package installation search (MacOSX)

Java

  • Dynamic compilation of Java 11 supported
  • Added support for Java modules in the preferences (if necessary)
  • Added support for add-on libraries as installable plugins (OSGI)
  • *.java or *.class files can be put in the scripts menu for compilation (*.java) or execution (*.class)
  • Added support to compile Java files on the ImageJ classpath (which is a seperated OSGI classpath) to compile ImageJ plugins with dependent *.jars
  • High dpi scaling for Java Swing and AWT available if configured in the Bio7.ini file (-Dsun.java2d.uiScale=2.0 for high dpi displays)
  • Updated JOGL to version 2.3.2 with custom fixes
  • Changed the 3D interfaces (WorldWind, 3d) to the faster NEWT interface.

Table:

  • Excel export now exports all opened tabs as sheets in one file
  • Images in cells are now exported in excel files, too (anchored at cells)
  • Improved scripts menu

ImageJ:

Huge amount of changes since the last release. For all changes, see:

https://github.com/Bio7/EclipseImageJ1Plugin

Download and Installation:

Windows:

Just download the *.zip distribution file from https://bio7.org and unzip it in your preferred location. Bio7 comes bundled with a Java Runtime Environment, R and Rserve distribution and works out of the box.

Linux:

Download and extract the installation file from https://bio7.org.
For Linux you have to install R and Rserve (see Rserve installation below!).

MacOSX:

Download and extract the installation file from https://bio7.org.

If you start Bio7 a warning or error can occur because of the changes how Apple treats signatures! To allow Bio7 to start see this instructions for Yosemite, Sierra and Mojave:

Yosemite: Open an app from an unidentified developer

Sierra: Open an app from an unidentified developer

Moave and Sierra: How to fix “Application” is damaged and can’t be opened error in macOS Mojave and High Sierra.

In addition for MacOSX you have to install R and Rserve (see below!).

Linux and MacOSX Rserve (compiled for cooperative mode) installation:

To install Rserve open the R shell and then execute the menu action “Options -> Install Rserve (coop. mode) for R …” for different R versions. This will download an install Rserve in your default R library location, see video below (please make sure that your default Linux R library install location has writing permissions!).
In cooperative mode only one connection at a time is allowed (which we want for this Desktop appl.) and all subsequent connections share the same namespace (default on Windows)!

How to install Rserve for Linux and MacOSX: https://youtu.be/tF7HbRBRIF

Installation of Useful R Packages

R packages which are useful in combination with Bio7 can easily be installed with the R-Shell context menu “Packages” action:

R-Shell context menu->Packages->Install_Default_R_Packages

Bio7 Documentation

For more information about Bio7 please consult the soon updated Bio7 User Guide.

A plethora of Bio7 videotutorials for an introduction can be found on YouTube.