Bio7 User Guide Version 2.4 (work in progress)

© 2015 M. Austenfeld

Updated: 01.07.2016

Table of Contents
The application Bio7 is an integrated development environment for ecological modelling and contains powerful tools for model creation, scientific image analysis and statistical analysis. The application itself is based on an RCP-Eclipse-Environment (Rich-Client-Platform) which offers a huge flexibility in configuration and extensibility because of its plug-in structure and the possibility of customization. Over the past years Bio7 evolved to a general simulation and analysis platform also useful for a variety of other scientific disciplines. In this platform powerful known tools were integrated for the purpose of simulations and analysis. The complexity of a modelling process is hidden behind a user-friendly flexible Graphical User Interface which should assist the development and analysis of simulation models. Therefore Bio7 offers and embeds also powerful and well proofed third party tools which are capable to do Image Analysis (ImageJ), Statistical Analysis (R), easy to learn scripting languages to ease the development of simulation models and an embedded compiler for the need of speed in complex calculations. Additionally editors (Java, R, BeanShell/Groovy, Jython) and different panels for visualization are integrated for an easier development. Communication in between the different components is possible by means of scripts and compiled code and can be collected in a executeable flowchart for “Sensitivity Analysis”, etc. Furthermore an advantage of this platform is the plugin structure which can be extended with all kind of third party plugins to support theoretical hypothesis on ecosystems functioning and the understanding of complex systems.
figure images/chapter1/logo.jpg

1 Why Bio7?

1.1 Ecological Background

The application Bio7 was originally developed for the chair of experimental and systems biology (Bio7) to create and analyze spatially explizit simulation models on dry acidic grasslands on inland sand dunes. Only specialists like Corynephorus canescens, Polytrichum piliferum, etc. can settle on this nutrient poor water limited sandy soils. Additionally high temperatures on the surface of the soil and erosion make it very hard for other species to settle there. In comparison to other ecosystems this habitat is less complex in its species structure and nutrient dynamics which facilitates monitoring of vegetation dynamics to identify the driving forces or key factors of the system. With the exploration of this ecosystem several questions and hypothesis should be answered and verified. Because many specialized plants and animals occur in this habitat the main question is, how we can protect and preserve this valuable ecosystem at all. Also the key factors are from high interest and can maybe serve to identify similar processes in more complex systems like the tropical rainforest. From various experiments in these systems we have knowledge about seed dispersal, competition, and nutrients availability or dependencies from different species which are typical for this habitat. We use the capabilities of this application to express the features of this system in syntactical rules for simulation.
figure images/chapter1/c11.jpg
Figure 1.1 Dry Acidic Grasslands

2 Getting started

2.1 Installation

2.1.1 System requirements:

It is recommended that your computer should have at least 1024 mb ram and a 1 ghz processor. A 3d Graphics Card which is OpenGL enabled (only necessary for the “Spatial” view and the embedded “WorldWind” view. To use the LibreOffice feature of Bio7 an installation of LibreOffice >= 4.0 is required. The path to LibreOffice will be automatically fetched by Bio7 from the registry (Windows) or can be adjusted in the Bio7 preferences (Windows, Linux, MacOSX) to the default path.

2.1.2 Installation: Installation:

Simply unzip the archive of Bio7 (Windows, Linux) in your preferred OS location. The MacOSX version can be installed easily with the available *.dmg file installer. To start the application simply double click on the Bio7 binary file. There is no need to install a extra Java Runtime Environment (see below). Windows

A Java Runtime Environment (JRE), R and Rserve comes bundled with the application. R, Rserve installation for MacOSX, Linux

A JRE is bundled. For Linux and MacOSX R and Rserve have to be installed! Bio7 will fetch the default paths from the OS System PATH (so hopefully no other adjustments have to be made) after an installation. If the default path on MacOSX can’t be found please adjust the path to the R binary (e.g., /Library/Frameworks/R.framework/Versions/3.2/Resources). Rserve has to be available in cooperative mode (Rserve and native R share the same workspace) which can be installed from the Bio7 Bitbucket website.
Simply download a custom compiled Rserve binary from the Bio7 Bitbucket repository:
Installation on MacOSX and Linux from within R with (please adapt the file path!):
1install.packages("/Users/xxx/Downloads/Rserve_1.8-4_Mac_cooperative.tgz", repos=NULL)
Figure 2.1 R command to install Rserve
Linux (compiled with Linux Mint 17.2):
1install.packages("/home/xxx/Downloads/Rserve_1.8-4_Linux_cooperative.tar.gz", repos=NULL)
Figure 2.2 R command to install Rserve
Compilation of Rserve in cooperative mode on Linux or MacOSX (if necessary!)
Rserve can be compiled and installed in the local R application with the shell command:
Figure 2.3 R command to compile and install Rserve (from the local directory)

2.1.3 R Windows specific:

The default add-on package location in a Bio7 release is now: “Bio7\plugins\Bundled_R_x.xx.xx\R\site-library”. At this location inside of Bio7 the packages will be installed by default (if not changed!).

2.1.4 Useful R packages

To use all Bio7 functions ( for editor formating, knitr documents, markdown documents, spatial analysis and import, export of spatial data) some R packages are recommended to install.You can install all packages e.g. with the following R script easily:
1packagesForBio7<-c("knitr","formatR","rmarkdown","sp", "maptools", "rgdal","raster") 
2install.packages(packagesForBio7, dep=TRUE, repos="")
Figure 2.4 R script to install R packages
Since Linux requires a compilation of the R packages it might be necessary to install some Linux packages, too (see↓). R packages Linux specific:

For Linux there are no binaries available. For the compilation of the R packages the Linux packages g++ and gfortran have to be installed (if not available by default!). For the compilation of the rgdal package in addition you need the Linux packages: gdal, libgdal-dev, libproj-dev. If you would like to install the spatstat package, too, you need: libblas-dev,liblapack

2.1.5 R Markdown

To use the R Markdown features please install the rmarkdown package, knitr from within R and the pandoc binaries from here:
For Windows and MacOSX pandoc must be on the system PATH – Linux adds the path by default. You can also add the path in R with:
Add pandoc to the OS PATH. Else type in the R console:
Figure 2.5 R command to set OS PATH in R only
or with the LaTeX path added:
Figure 2.6 R command to set OS PATH in R only
After installation typically available. Else type in the R console:
Figure 2.7 R command to set OS PATH in R only
Add pandoc path to the Windows PATH (evtl. restart). Else type in the R console:
1Sys.setenv(PATH=paste(Sys.getenv(“PATH”),”C:/pandoc”, sep=””))
Figure 2.8 R command to set OS PATH in R only
The commands can be copied and saved for each startup (only if necessary) in the R preferences textfield:
R->Preferences->Rserve Preferences->R startup commands

2.1.6 LaTeX

To use LaTeX with Bio7 please install a LaTeX environment e.g.:
MiKeTX (
MacTeX (
TeX Live (
Then adjust the Bio7 path to the pdflatex binary (only necessary if not on the OS path!):
R->Preferences->Rserve preferences->pdflatex path
To get the installation location folder on Linux or on MacOSX type:
> which pdflatex
For Windows MikeTeX pdflatex can be typically found at:
C:\Program Files (x86)\MiKTeX 2.9\miktex\bin

2.1.7 R MacOSX specific:

For some plot functionality eventually XQuartz has to be installed (if not already installed or needed at all - default device is Quartz!). Eventually it is important to avoid blanks in the Bio7 installation path for the bundled JRE (not tested though!)

2.1.8 Windows only (if needed)!:

To write the R package location path to the Windows registry please start Bio7 with the enabled option “Install path at startup” to set the registry path to the bundled R location. By default this option is disabled not to harm any default user installation of R. In Bio7 x.x please install the R package rgdal which is needed for some spatial import and export scripts. Please note that the import scripts for spatial data can have problems with special text encoded filenames. If an rgdal import script produces an error the Rserver will probably die and you have to restart Rserve. By default this option is disabled not to harm any default user installation of R. In Bio7 please install the R package rgdal which is needed for some import and export scripts. Please note that the import scripts for spatial data can have problems with special text encoded filenames. If an rgdal import script produces an error the Rserver will probably die and you have to restart Rserve.

2.1.9 Portable (Windows):

It is also possible to install Bio7 on an Usb-Stick with the described procedure. Moreover LibreOffice can also be installed portable with Bio7. Download the portable version ( and adjust the LibreOffice path to the LibreOfficePortable\App\libreoffice\program subfolder in the Preferences.

2.1.10 Examples for Bio7:

On the Bio7 SourceForge website you can download examples for the Bio7 application. In addition the examples can be accessed on github. To install the Bio7 examples please import the examples from the file. File ▷ Import ▷ Existing Projects into Workspace. Select the archive file and the two projects. Press Finish to import them into Bio7 (they will be imported to the workspace location). Please take care to import the examples as a *.zip file to restore the relative resource path of the examples (on MacoSX the examples are often unzipped after download. Please adjust the settings to avoid the decompression of the archive file).

2.1.11 Increased Java memory

For an increased Java heap space open the Bio7.ini file in the install directory of Bio7. In the file you can change the default memory settings e.g. the initial heap size -Xms and the maximum heap space -Xmx.MacOSX For an increased Java heap space open the Bio7 package (context menu if you click on the icon) then go to Contents/MacOSX and open the Bio7.ini file with a text editor. In the file you can change the default memory settings e.g. the initial heap size -Xms and the maximum heap space -Xmx

2.1.12 Important information:

A certain firewall software can corrupt the Bio7 *.zip file (as well as other files). Please ensure that you have downloaded a functioning Bio7 version. In addition it is also reported that a certain antivirus software detects the bundled R software (on Windows) as malware. Often the R specific “open.exe” is detected as malware. Please use a different scanner to make sure that the software is not infected if you have any doubts.

3 The Platform-Architecture

After the Bio7 application has been launched a typical Eclipse workbench window is displayed. An Eclipse window contains a page, which contains an arrangement of views and editors whose layout is defined by a perspective. In the Bio7 workbench window after the startup, the Resource perspective is activated.
figure images/chapter4/windowcomponents.jpg
Figure 3.1 Window components of Bio7

3.1 The Toolbar

The toolbar offers several default actions which are described in the following section.It should be noted that editors or plugins can add items to the toolbar.
figure images/chapter3/c31.jpg
Figure 3.2 Toolbar of Bio7 Toolbar from left to Right:

  1. Play/Pause: Starts or stops a simulation run. This action will start or pause a default calculation thread of the application. The calculation thread then repeatedly calls a special method (called run) in a compiled Java class if available (which extends a special class called “Model”).
  2. Setup: Invokes a Java setup method if available in the compiled class.
  3. Reset: Resets the discrete grid in the application. This action will reset all states in the Quadgrid (Hexgrid) arrays to the value 0.
  4. Counter-Reset: Resets the counter to null. This action will reset the time to the value 0 and will also update the default charts. The values of a special list which automatically stores the population count of enabled states in a simulation run will also be deleted.
  5. Random: Distributes selected plants from the database in the discrete field. There are two random functions available in the menu of this item to randomize the field. With a special action landscape patterns can be produced (see 4.2.3↓).
  6. LibreOffice: This action will open a connection to LibreOffice. If you select this action Bio7 tries to connect to LibreOffice with the LibreOffice API (Application Programming Interface). The path to LibreOffice will be fetched from the Preferences and can be adjusted there (Windows: If LibreOffice is installed, it will be automatically fetched from the Windows Registry if possible. Sometimes the Windows path to LibreOffice has to be adjusted, too. With this connection some actions are available (see 9.3↓)
  7. R: Will open a connection to R by means of a Server (Rserve). This action will connect Bio7 to the Rserve application which builds a connection to the statistical tool R (see 4.7↓).
  8. Print: Prints the content of an opened editor. If an editor in Bio7 has been opened this method will print the content.
Note: When a file has been opened additional entries occur according to the opened editor.

3.2 The Menu

The menubar of the Bio7 application offers several menus for the work with the different components of the application.

4 The Perspectives of Bio7

In the perspective bar several different perspectives can be activated via the perspective buttons. All the views or editors in the perspective can be closed, opened, detached or moved. The perspectives in Bio7 can be extended with several other views which can be opened in the Windows ▷ Views menu or with the default action in the status bar at the bottom left of the program. Additionally self defined perspectives can be created or deleted. From the Eclipse Workbench User Guide ( “Perspectives provide combinations of views and editors that are suited to performing a particular set of tasks....”
To open a new perspective:
  1. Click the Open Perspective button on the shortcut bar on the left side of the Workbench window. (This provides the same function as the Window  ▷  Open Perspective menu on the menu bar.)
  2. To see a complete list of perspectives, select Other... from the drop-down menu.
  3. Select the perspective that you want to open. When the perspective opens, the title bar of the window changes to display the name of the perspective. In addition, an icon is added to the shortcut bar, allowing you to quickly switch back to that perspective from other perspectives in the same window.

4.1 Resource Perspective

After Bio7 has been started the perspective in front is the Resource perspective. The parts of the Resource perspective are:
figure images/chapter4/resourceperspective.jpg
Figure 4.1 The Resource perspective with opened context menu of the Navigatior view
(1) The Navigator view to import, export, open and manage files.
(2) The Editor area where the files are opened.
(3) The Console for Bio7.
(4) The Outline view (e.g. active when the Flow editor has been opened).
(5) The Properties view which shows the selected file properties (Also important for the adjustment of the Flow editor properties).
(6) The Snippets view in which snippets for the different text based editors of Bio7 can be created.
(7) The context menu of the Navigator view which contains several file actions. Some actions are only visisble if a special file type is selected (e.g. the R Packages action in the screenshot is only visible when a R file is selected).

4.1.1 The Navigator

In the Navigator view files can be managed and stored. The context menu offers several actions to import and export files for the available Bio7 editors and specialized actions dependant on the selected filetype. All the files are managed by projects which can have folders and subfolders, etc. for managing a large amount of different files. These projects and their files can be exported or imported as *.zip files for data exchange. The file navigator (Navigator view) of Bio7 allows you to create different editor files with a help of a file wizard. A double-click on the file in the file navigator will open the file in the default registered editor.

4.1.2 The Editor Area

The editor area is the area where all files are opened and edited. The context menu varies depending on which file is opened. When opened the text based editors offer typical text functionalities like: Copy, Paste, Undo, Redo, Cut, Find/Replace, Print, etc. in the context menu and in the edit menu (menubar) of Bio7. When a file has been opened editor specific buttons will be added to the toolbar which execute an editor action according to the opened file (compilation respectively interpreting code of Java, BeanShell, Groovy, Jython , R or execution of a Flow!). The editor area can be enabled in every perspective with the Window ▷ Show/Hide Editor action in the main Bio7 menu.

4.1.3 The Console of Bio7

The Bio7 console gives access to several interpreted languages and a pseudo-terminal for the Operating System (OS) environment. In the view menu the different modes can be selected.
figure images/chapter4/consoleview.jpg
Figure 4.2 The Console view of Bio7 with opened menu
  1. The script consoles (Beanshell, Groovy, Jython) can interactively communicate with the Bio7 application or simply interpret different instructions in the selected scripting language.
  2. The Shell pipes commands to the underlying OS with a pseudo-terminal.
  3. The Native R and Native Python consoles pipe commands to the different applications (Please adjust the paths to the language environments in the Preferences! See: 10.1↓).
  4. The default enabled Console Output only displays errors and prints messages. In addition it pauses the REPL (read–eval–print loop).The Console is responsible for the:
    1. Output messages for the interpreters and connected applications.
    2. Output messages of the embedded Java compiler (compiler warnings, infos, etc.)
    3. Output of the R interpreter (Rserve warnings, etc.) and evaluated expressions in R.
In the context menu of the Console view several actions are available to clear displayed text or copy text from the console to the clipboard. Menu of the Console View

In the Options menu of the Console view text encoding properties, font settings and special interpreter commands can be selected. As already noted in the Console menu the different interpreters and native connections (R, Python, OS shell) can be selected.

4.1.4 The Snippets View

In the Snippets view code templates can be created and stored for the different editors in Bio7. The Snippet view plugin comes from the WTP project ( To create snippets inside this view, categories have to be created inside a template editor (Customize... action in the context menu). This editor can be opened with a right-click in the Snippets view. Copied text from any text based editor of Bio7 can be pasted directly as a snippet after a category has been created inside the view. In addition selected text in an editor can be stored as a template. More complex templates with variables and a detailed description can be created, too. This is extremely useful if you want to create custom formulas or statistics. A created template can be transferred to an active opened editor with a double-click of the mouse device. Optional the different categories can also be folded and customized for a better overview (see figure below).
Note: By default every text based editor of Bio7 has an integrated template editor for the different programming languages with default snippets.
figure images/chapter4/snippetsview.jpg
Figure 4.3 The Customize... dialog of the Snippets view available in the context menu

4.2 The 2d Perspective

The 2d-perspective offers several views for displaying and adjusting simulations of spatial discrete models and spatial discrete individual based models.
figure images/chapter4/2dperspective.jpg
Figure 4.4 The 2d Perspective

4.2.1 The Quadgrid

The Quadgrid view (1) - like the by default hidden Hexgrid panel - visualizes a simulation field for discrete simulation models. At startup only one state with value 0 is dispersed in the Quadgrid (respectively Hexgrid) field. The panel itself is a visualization of states stored in an two dimensional integer array. In the grid array (xystate) numeric states of type integer are stored for simulation purposes. By default there is also a temporary array available (xytempstate) for an intermediate store of states when calculating patterns for the next timestep (t+1) as it is usual in grid based modelling. The arrays can be accessed by means of a small API to facilitate the development of such models. In the panel it is possible to zoom in or zoom out with the scroll wheel of the mouse. The state of the cells can be adjusted by clicking and dragging on them. With a right click on the Quadgrid panel a context menu opens with the possibility to select states in the Quadgrid panel (Keys: Alt+S).
1/*A simple example to show how to produce and set random cells!*/
23int rand; // A random number variable!
45public void run() {
6	for (int y = 0; y < Field.getHeight(); y++) {
78		for (int x = 0; x < Field.getWidth(); x++) {
9			rand = (int) (Math.random() * Bio7State.getStateSize());
10			Field.setState(x,y,rand);
11			Field.setTempState(x,y,rand);
1213		}
14	}
Figure 4.5 Java example to update the states of the Quadgrid Transfer Quadgrid Data and Patterns to R

In the toolbar of the Quadgrid view population and pattern data can be transferred directly to R with two available actions.

4.2.2 The Hexgrid

It has sometimes advantages to create hexagonal designs in experimental setups which will reproduce a binned pattern more naturally instead of the Quadgrid. A central cell in a Hexgrid is surrounded by six neighbours. All have the same euclidean distance from the centre to the surrounding cell. Bio7 offers a hexagonal grid which is by default hidden, but can easily be activated with Window ▷ Show View ▷ Other ▷ Bio7-Panels ▷ Hexgrid
figure images/chapter10/hexgrid.jpg
Figure 4.6 The Hexgrid view

4.2.3 Randomize the Quadgrid (Hexgrid)

In the Bio7 toolbar a special dialog can be opened to create a pattern with the Midpoint Algorithm (see [6]). The Midpoint Algorithm is especially suited for creating clustered random patterns like landscapes and super individuals (e.g. clumbed vegetation patterns which grow in a colony like e.g. moos).
figure images/chapter4/midpointdialog.jpg
Figure 4.7 Midpoint 2D dialog to create random patterns

4.2.4 The Linechart and the Piechart

The Linechart and the Piechart views (3) serve as a monitor to watch population size and count the different states in a simulation run. Regardless how fast a simulation runs the charts get updated every second. With a right-click on the charts several options are available. For example to store an image of the chart or to adjust some chart parameters. The Piechart visualizes the count of the activated states inside the Quadgrid (Hexgrid). The Linechart displays the amount of states in dependence of the simulation steps. When a simulation is started coloured lines will visualize the amount of states over the time. The colours of the charts will be automatically updated when the colours are changed in the Plants view.

4.2.5 Recording the Amount of States over Time

In Bio7 a list is available which stores the values of a simulation run. Each state amount in every timestep is automatically recorded. With the Reset action (see↑) in the toolbar this values can be deleted for a new run starting at timestep 0. In addition it is possibly to delete the values programmatically. If you don’t need this feature you can deactivate it in the Bio7 preferences.

4.2.6 The Time and Space Control

When the Time&Space (4) item is enrolled (by default it is!) a panel appears showing information about the time steps a simulation has proceeded. Additionally every time step is displayed as a month and 12 time steps are displayed as a year. Furthermore several sliders for the adjustment of the parameters calculation speed (time resolution) and field size (capacity) are available. Additionally a checkbox and a button are displayed which enable the resize event after a slider change.

4.2.7 Spreadsheet

In the top-right of the perspective the Spreadsheet view (5) offers a visualization of states. The name and the info are displayed by default. Also two columns with check boxes are displayed. By enabling a check box in the column “Select” a state can be selected to set (draw) a specific cell in the quadgrid. With the checkbox in the column “Delete” states can be selected for deletion. Spreadsheet Toolbar

In the spreadsheet toolbar (6) the pattern and adjustments (height, width, amount of states) of the quadgrid can be saved to a file. It is also possible to store the current Java source with the pattern and adjustments. This simulation file can be reopened with the open action or simply dragged on the general toolbar of Bio7. If Java source is detected in a simulation file it will be compiled and loaded and if available the setup method will be executed. In addition the following toolbar actions are available:

4.2.8 File Storage of Patterns

As already mentioned a grid pattern can be stored (optionally along with the Java model source) with the save action in the toolbar of the spreadsheet. The State View

In the state view (7) the different states are displayed. With the state button(s) the default color of the states can be changed easily.

4.3 SceneBuilder Perspective

Since Bio7 2.0 the JavaFX SceneBuilder is embedded in Bio7 available as a perspective. A default file wizard is available to create a template *.fxml file along with a Java source file to create a custom GUI embedded in a custom Bio7 view. A general guide for the SceneBuilder can be found here: Introductional video tutorials for the embedded builder in Bio7 can be found on YouTube:
figure images/chapter4/scenebuilder.jpg
Figure 4.8 JavaFX SceneBuilder Perspective

4.4 Image Perspective

At startup the image perspective shows three different views for several tasks in the area of image analysis, point-pattern analysis and simulation of 2-dimensional spatially continuous models. In the ImageJ-Canvas view (1) a complete version of the well known image analysis tool ImageJ has been integrated in the Bio7 application for profound image analysis and measurements of ecological parameters. Because ImageJ offers also a complete API (Application Programming Interface) the development of customized image methods are possible. Directly connected to this view a scalable Points panel (2) for adjustments and visualization of point pattern has been integrated. This panel is also programmatically available by means of a small API which facilitates the construction of 2d continuous simulation models. An easy to use thumbnail browser (3) offers the possibility to open images as thumbnails which than can be opened directly in ImageJ.
figure images/chapter4/imageperspective.jpg
Figure 4.9 The Image perspective with opened ImageJ menu in the ImageJ view

4.4.1 ImageJ-Canvas

For a complete description of the software ImageJ follow the link: The online documentation can be found here: The differences between the regular version of ImageJ and the integrated version in Bio7 are described in the list below:
As aforementioned functions of ImageJ can be called directly from the Java compiler or from the BeanShell (Groovy), Jython interpreters. Many of the available examples from the ImageJ website can be executed directly within the different editors of Bio7 by compiling or interpreting them. All standard functions of ImageJ are integrated. Macros are fully supported and can also be added dynamically to the main menu of Bio7 for customized actions. In the menu of the ImageJ view some additional menu points (“Windows “) have been added for: ImageJ Toolbar

As already noted the ImageJ toolbar is integrated in Bio7 as a view. It will be opened detached if the the ImageJ toolbar action is executed (Window ▷ ImageJ-Toolbar). Drag and drop actions (open images and install ImageJ plugins) are supported, too. In addition macros for the toolbar can be installed (as known from ImageJ).
figure images/chapter4/imagejtoolbar.jpg
Figure 4.10 The ImageJ toolbar integrated as a detachable view ImageJ Plugins And Macro Paths

Bio7 supports plugins and macros for ImageJ. The paths to the macros are:
If plugins are dropped in the plugins directory the menu Plugins will be extended with submenu actions. In addition the Plugins ▷ Utilities ▷ Control Panel action is available to display all installed plugins. For more information about plugins and macros please consult the ImageJ documentation. Compilation of ImageJ plugins

The compilation of ImageJ plugins can be done with the default ImageJ compile action in the Image-Canvas menu (e.g. Plugins ▷ New ▷  Plugin) or with the Java editor of Bio7. In the File creation wizard of Bio7 ImageJ plugin and filter templates are available.

4.4.2 Points Panel

In the Points panel points can be set or deleted with the mouse (left-click, right-click). Additionally points can be dragged to any locations inside the boundary of the adjusted size inside the “Area of Analysis” of the Points panel marked by a green rectangle. The coordinates (pixel location) are displayed in the status bar of the Bio7 application. The panel itself can be resized to a virtual size of 106* 106 units (pixel) inside a scrolling panel (e.g. you can set points in a virtual area of 106* 106cm (as unit !) which means that you can adjust points in an area of 10 km with cm precision). Also zooming is supported when a big area is required. If the panel is zoomed or scaled down the points automatically will get translated, resized and stay selectable. It is also possible to add quads from the Quadgrid panel to the Points panel and to select this quads by setting a point inside its area. To achieve this a special toolbar is available in the Window-menu of the ImageJ view (see below).

4.4.3 ImageJ Interactions with R and the Points panel

In Bio7 a special view is available (ImageJ-Canvas menu ▷ Window ▷ Bio7-Toolbar) which offers several actions to transfer Imagej image data and Points panel data to and from R. Also some options for the Points panel can be activated in this dialog (view), too.The availabe actions are described in the following list.
figure images/chapter4/imagemethodsnew.jpg
Figure 4.11 Image-Methods dialog
(1) With the Alpha Image slider the alpha value of a loaded image in the Points panel can be adjusted.
(2) The slider can adjust the alpha value of the Quadgrid field which can be added or removed with button (5).
(3) This action loads an image to the Points panel.When an image is loaded (from ImageJ or from Bio7) the size of the “Area of Analysis” will be adjusted automatically to the image size and the new size will be displayed in the spinners (Fieldsize). The “Area of Analysis” is displayed by the green rectangle in the Points panel.
(4) Removes an image from the Points panel.
(5) Adds or removes the Quadgrid as a layer in the Points panel.
(6) Removes all point from the Points panel.
(7) Slider to adjust the size of an enabled Quadgrid.
(8) Slider to resize the Points panel and all enabled layers in the Points panel. When zooming has been activated the points still stay selectable or draggable because the coordinates are automatically translated. The scrollbar will be adjusted to the size of the “Area of Analysis”.
(9-10) The size of the “Area of Analysis” can be adjusted with the two spinners (Fieldsize X, Fieldsize Y) which can be set from 1-106 units. When the size of the area will be changed automatically the scrollbar will be fitted to the new size of the green rectangle.
(11-12) With this spinners the size (Particle Size) and the alpha value (Alpha) of the points (or particles) can be changed.
(13) Adds a Voronoi Diagram from existing Points as a layer in the Points panel.
(14) Adds a Delauney Triangulation from existing Points as a layer in the Points panel.
(15) Option to update an enabled Voronoi Diagram dynamically.
(16) Option to clip an enabled Voronoi Diagram to the “Area of Analysis” (green rectangle).
(17) Option to update an enabled Delauney Triangulation dynamically.
(18) Option to display the areas of enabled Voronoi polygons in a Voronoi diagram.
(19-20) Slider to adjust the size of displayed Voronoi areas in an enabled Voronoi diagram.
(21) With the Pic-> button it is possible to transfer images that have been loaded with ImageJ directly to the Points panel. The size of the “Area of Analysis” will be changed according to the size of the image.
(22) This action transfers measured coordinates of a Particle Analysis in ImageJ as Points to the Points panel (double precision). If action (5) has been activated (the Quadgrid as a layer in the panel) the points which fall in a grid cell will mark the cell with the selected state.
(23) This action transfers the current display of the Points panel (with all activated layers) as an image to ImageJ. It is important to know that the transferred image to ImageJ depends on the “Area of Analysis” and the zoom factor of the Points panel. If the Points panel is not zoomed and the “Area of Analysis” is 1000*1000 this will result in a 1000*1000 image in ImageJ. If the Points panel was scaled with a 1000*1000 “Area of Analysis” the resulted transferred picture to ImageJ would be a scaled image (<1000*1000) which shows the same area.
(24) With the Pixel button thresholded pixel from the ImageJ view will be mapped to the active state of an activated Quadgrid (5). If the Quadgrid size is >1 pixel than the thresholded pixel will fall into one quad coordinate of the (scaled) Quadgrid (looks like a coarsening of the structure !). If the pixel size of the Quadgrid is 1, all thresholded pixels will fall into one Quadgrid cell of the available Quadgrid area. With this action it is possible to transfer selected image data (e.g. vegetation patterns) for simulation purposes to the easy to use Quadgrid.
(25) This action transfers all values of an opened ImageJ Results Table to R as a dataframe object.
(26) This action open the “Particle Analysis” dialog of ImageJ. If the particle analysis is executed the results of the analysis are transferred to R as a dataframe.
(27) This action transfers Point objects to R. In addition if an ImageJ selection is available the coordinates of the selection will be transferred, too (Points don’t have to be available for a selection transfer). The transferred values are:
(28) This action transfers the results of a particle measurement of ImageJ directly to R. The measurements can be converted to a R matrix.
(29) Transfers the selected pixels (Freehand, Rectangular etc.) with or without a signature as a matrix to R. The transfer type can be selected, too!
(30) Opens the Selection view which offers different action to transfer selection data (coordinates) as R data (x,y or georeferenced!).
(31) Transfers multiple selected pixels (Freehand, Rectangular etc.) with or without a signature from the ROI Manager as a matrix to R. The transfer type can be selected, too!
(32) Transfers multiple selected pixels (Freehand, Rectangular etc.) of a stack with or without a signature from the ROI Manager as a matrix to R. The transfer type can be selected, too!
(33) This action transfers the current image data of various types - selected in (33) and name adjusted in (35) - of ImageJ to R. A matrix transfer is only possible if the datatype double is selected.
(34) This action creates an image of selected R data adjusted in (33) - in matrix or vector form - in ImageJ as an image of optional type selected in (34) from various types selected in (33).
(35) Option to select transfer type of the image data (byte, integer, double, RGB - default R-types!)
(36) Option to select the image type which will be created in ImageJ (Grayscale, Short, Float, Colour).
(37) Option to adjust the name of the ImageJ data which will be transferred to R.
(38) Option to select R data which can be transferred as an image to ImageJ.
(39) Action to perform a cluster analysis. Creates a new image from the assigned pixels.
(40) Action to perform a PCA analysis. Creates a new image from the assigned pixels. Image Transfer to R

With the actions (33) (34) the data of the current active image can be transferred to R or image data from R to ImageJ in a selected datatype (35) respectively image type (36). It is good practice to transfer the image data in the less consumptive data type needed for a transfer. In addition special transfers are available for selected image data as described in (29), (31) and (32):
Note: A description of the ROI Manager for action (31) and (32) can be found here: Supervised Classification with ImageJ and R

The option Create Custom Class Signature in action (31) and (32) is especially useful if a supervised classification of image data in R should be performed. Every ImageJ selection could represent a special vegetation or tissue type (e.g. class plant species, class tumor) represented by multiple spectral bands respectively available data (slices in the stack) which could be used for a training phase of supervised classification. See Bio7 programming examples:
figure images/chapter4/roiimagestacktransfer.jpg
Figure 4.12 Pixel RM (ROI Manager ImageJ) Stack action to transfer selected pixels Transfer of Selection Coordinates

As already noted with the actions (27) and (30) single selection (27) and multiple selection (30) coordinates can be transferred to the R workspace. This is useful if you want to perfom e.g. shape analysis or morphometrics.The selection coordinates are transferred in integer precision. ImageJ also has some nice actions available to edit the selections. They can be found in ImageJ-Canvas menu under Edit ▷ Selection. For example imprecise selections can be interpolated with a spline action or a Convex Hull can be created from a selection to reduce the amount of data points. Geometry Selections View

As already noted the Geometry Selections view can be opened with the Selection action (30) of the Image-Methods view. The view offers several actions to transfer selection data:
  1. Selection coordinates as list: If this option is selected selections from an available ROI Manager of ImageJ are transferred as a simple 2D list to R.
  2. Spatial Data (R package ’sp’ required): If this option is selected data can be transferred with the ’sp’ R package as the following objects in R:
    1. SpatialPolygons or SpatialPolygonsDataFrame (if an available R dataframe has been selected - Add selected data frame action!)
    2. SpatialLines or SpatialLinesDataFrame (if an available R dataframe has been selected- Add selected data frame action!)
    3. SpatialPoints or SpatialPointsDataFrame (if an available R dataframe has been selected- Add selected data frame action!)
figure images/chapter4/geometryselectionsview.jpg
Figure 4.13 The Geometry Selections view to transfer ImageJ selection data to R.
The option Transfer as centroid coordinates transfers the selections as centroids of a grid cell instead of the top-left coordinate of a grid cell. This can be useful or necessary for point data to transfer the point selections in the center of a grid cell (see 4.14↓)! The option Add projection from georeferenced file allows the georeferenced transfer of the selection data from an raster image (e.g., *.geotiff). Please note that the file has to be in a projected into a Projection Coordinate System! Typically the image selection data originates from a georeferenced image which then is selected with the Transfer to R! action to extract the spatial information for the creation of a georeferenced spatial object in the R workspace.
figure images/chapter4/giscomparison.jpg
Figure 4.14 Transfer of point selections as centroids (left image: GIS display of transferred point vector data, right image: ImageJ display of selections)
figure images/chapter4/giscomparisonpolygonshapes.jpg
Figure 4.15 Transfer of different selection ImageJ types (right image) and the result in a GIS display (left image)) Cluster And PCA Analysis

As noted above the action to transfer selected image data can be used to perform a supervised classification with the availabe options. The actions described in (39) and (40) open special dialogs to perfom unsupervised classification (algortihm clara) and a Principal Component Analysis (PCA) of the image data. In the dialog the number of clusters (PCA components) can be specified and arguments can be added to the default settings. Selected layers (opened images) can be added for the analysis. The Only Transfer option can be used to transfer the image data to R without performing an analysis. Please note that the selected image type (35) wisely choosen for a task can drastically reduce the amount of memory used for the analysis.
figure images/chapter4/clusterdialog.jpg
Figure 4.16 Cluster dialog to perform a cluster analysis from selected layers (tab images) Using the Points Panel for Spatial Continuous Simulations

The Points panel can also be used to create spatially continuous models. The available Bio7 snippets demonstrates the use of the Points panel for simulations in the calculation thread of the Bio7 application. In general for a simulation an one dimensional point array (type Individual) has to be created and transferred to the Points panel (setIndividual()). The Individual objects must be parametrized with the coordinates (y,x), the state, the diameter and the alpha value. Tip: The parameters diameter and alpha value, for example, can be used to display fitness or age in a simulation!

4.4.4 Thumbnails

With the thumbnail browser it is possible to open a directory of images as thumbnails. Different options are available for the display of thumbs.
figure images/chapter4/thumbnailbrowser.jpg
Figure 4.17 Thumbnail browser
  1. With the 5->,10->, 15-> buttons you can select how many thumbs should be created in a row
  2. The Small, Medium, Large labelled buttons will create preview images with a size of 100*100, 150*150 or 200*200 pixel.
  3. The Open button opens the directory which should be displayed.
  4. The Mag. button enables or disables the overview navigation panel.
  5. The Rec. button enables the recursive search for images in selected folders (up to 1000 images!)
  6. The combobox will adjust the level of magnification. The thumbs will be resized by means of the lens (blue rectangle in the right panel for the overview!).
Images or file extensions in the following formats will be opened: Mouse Actions Thumbnails Browser

The images can be opened in the ImageJ view by selecting the thumb image buttons in the left panel (left-click!). If you set the mouse over a thumbnail some information about the image will be displayed. A right-click of the mouse over an image opens the parent folder of the image.

4.5 The 3d Perspective

With Bio7 custom 3d visualisations are possible in a specialized OpenGL panel which eases the development of 3d models. In addition custom methods are available to easily load 3d models ,textures, custom shapes as well as libraries for geometrical measurements. The drawback of this flexibility is that the user has to take care of certain circumstances which accompanies the direct use of OpenGL (e.g. if using the Fullscreen feature which retriggers the internal init method).The 3d perspective can be enabled in the perspective bar of Bio7.
figure images/chapter4/3dperspective.jpg
Figure 4.18 3D Perspective

4.5.1 The Space View

The Space view is a new view in Bio7 which is enabled by default when the 3d perspective is opened. Aspects of this view can be controlled with the associated Options Space view which in addition is displayed by default in the 3d perspective. The Space view itself is an embedded GLPanel which visualizes OpenGL (Jogl) commands. After activation of the Space view a quad, the x,y,z coordinates of the world and a grid are shown for orientation. (the z-axis is pointing to the user - the OpenGL coordinate system is right-handed!). With the mouse device the visible world can be rotated (“Arcball” interface) easily - moved left, right and moved forward or backwards (see table below).
Device Event Function
Left Mouse Button Drag left, right,up,down Rotation
Right Mouse Button Drag left, right Move forward, backwards
Middle Mouse Button Drag left,right up, down Move up,down, left, right
Key F2 Fullscreen
Key Escape Exit Fullscreen
Table : Interface Walkthrough (see Camera panel)
Left Mouse Drag left, right, up, down Rotation left, right, up, down
Key PgUp, PgDn Move up, down
Key Arrow left,right Rotation left, right
Key Arrow up, down Move forward, backwards
Table 4.1 Interface Spatial view and Walkthrough interface
Custom OpenGL commands can be written in the Java editor as regular Java code and after compilation enabled in the Options Space view. With the the help of the Bio7 wizard a new OpenGL file can easily be created. Two parameterized methods (run, setup) will be created which make the gl (glu, glut) context available to draw custom shapes and develop models in a 3-dimensional space.
1public void setup(GL gl,GLU glu,GLUT glut){
2// Please enter your Java OpenGL setup code here
34}  public void run(GL gl,GLU glu,GLUT glut){
5// Please enter your Java OpenGL code here
Table 4.2 Body Java OpenGL
In the Options Space view several thematic panels can be expanded which offer different actions decribed below. Time

After the compilation the execution must be enabled in the Time panel (Play/Pause). Also the Setup method (which invokes the method setup() in a compiled Java class if available) can be triggered here. The execution is separated from the normal execution of Bio7 to guarantee that the different thread are not mixed together which could result in an application crash. Furthermore the use of the animation timer guarantees a smooth animation of the developed model. It is very important not to trigger OpenGL methods from the regular execution thread of Bio7 that’s why these custom methods are available to access the full power of OpenGL (Jogl). If enabled the run method is triggered by means of the OpenGL timer and the default frame rate (as fast a the Graphics card allow it). The speed of the execution of the run method or the change of certain variables can be controlled by means of a custom method canStep() which switches a boolean value in dependence of a slider which is also available in the Time panel. Both frame rates, the regular execution speed (fps) and the speed of the triggered step (step fps) method can be visualized in the Space view. In addition a pause can be enabled (No Step) which switches the boolean of the canStep() method to false. If you want to control the speed of a simulation you can use the canStep() method to change values of variables (e.g. spatial coordinates) and hold them with the pause.
figure images/chapter4/3doptionstime.jpg
Figure 4.19 Time panel Space

In the Space panel of the Options Space view several adjustments can be made for the default components of the Space view. With the Octant action the default displayed grid is only drawn in the first octant (e.g. nice for a 3D plot). In additon some actions are available to select the colour of the space and to adjust the displayed grid (visibility, colour, size, etc.). The Fullscreen settings allow to adjust the screen resolution etc. before switching to the full screen mode (if available!). The World Extent sets the boundary space of the 3d panel (Universe) in which 3d objects coordinates will be displayed. With the Speed Drag Distance the speed for the default camera in z-direction can be adjusted. Reset View Distance resets the camera position.
figure images/chapter4/3doptionsspace.jpg
Figure 4.20 Space panel Model

In the Model panel a default *.obj model can be loaded for a custom environment in a simulation or a visualisation of an 3d model. An *.obj model can be created e.g. with the 3D software Blender (also textured). By default several actions are available to scale and position the model in the Space view. These settings can be stored with the Store action (only integers will be stored!).
figure images/chapter4/3doptionsmodel.jpg
Figure 4.21 Model panel Texture

In the Texture view a default textured plane can be seleted (active ImageJ image or an imported image). In addition the Quadgrid or ImageJ image can be added as a dynamic (constantly redrawn) plane to the Space view. By default the texture plane is as big as the size of the image. The Change button is responsible to change the display to the selected texture source.
figure images/chapter4/3doptionstexture.jpg
Figure 4.22 Texture panel Height Map

The Height Map panel can visualize a simple height map with height values of an enabled grayscale (8-bit, 16-bit, 32-bit) ImageJ image. The pixel values of the image determine the height of the height map. Some additional parameter control the resolution of the height map and a multiplying factor for the height. By default the height map is textured with the default selected image in the Texture panel (static or dynamic). Since the height map depends on an ImageJ image the image can be edited with ImageJ methods. Additionally an *.hgt importer script is shipped with Bio7 which creates a 32-bit image as a height map with correct height values in ImageJ.
figure images/chapter4/3doptionheightmap.jpg
Figure 4.23 Height Map panel Camera

With the Camera panel several aspects of the Space view perspective can be controlled. A Enable Walkthrough option enables a classical walk through perspective. If enabled you can walk through the Space view in the x,z plane. The walk directions (rotations up and down) can be controlled with the mouse and the arrow keys (see 4.5.1↑). The camera in this mode will always stay above the plane. This is not the case if the Enable Flythrough option is selected, too. Then the up and down movements of the camera changes the height position and the camera can also be moved below the plane - or negative height values. If the Custom camera is selected the camera can be positioned programmatically and it only shows the camera view if it is defined programmatically (and compiled!). With the Split View option an second camera can be enabled in the lower left of the Space view. In the text fields the position of the camera and the LookAt (the position to which the camera points) coordinates of the camera can be set (e.g. in double precision) and stored with the Store action. The last option Stereo enables an experimental Stereo renderer of the Space view for an anaglyph view of the Space.
figure images/chapter4/3doptionscamera.jpg
Figure 4.24 Camera panel Light

The Light panel controls the light of the Spatial view. Four different light source can be enabled and positioned with spinner fields. Please consider that the lights have a visible effect if more than one normal is defined for the surface (e.g height map, 3d models). If the Local light option is enabled (recommended!) the enabled lights will be rotated with the view.
figure images/chapter4/3doptionslight.jpg
Figure 4.25 Light panel Image

In the Image panel a screenshot from the current Space view can be transferred as an image to ImageJ. Furthermore it is possible to render a selectable amount of frames to ImageJ as an image stack which then can be saved as an *.avi file or an animated *.gif file. The size of the visible Space view determines the size of the images and the stack. A resize of the Space view automatically stops an active rendering to a stack.
figure images/chapter4/3doptionsimage.jpg
Figure 4.26 Image panel
Fullscreen Mode
If Fullscreen mode is supported the Fullscreen mode can be enabled with the F2 key and quitted with the Escape key. This use of the fullscreen mode will trigger the setup method so it is important that certain objects are recreated in the setup method for the correct GL context (avoids a crash of the whole application!!! . TextRenderer objects, Texture objects and *.obj models should be created in the setup method with the correct gl context. Several example are available and demonstrate the general use of OpenGL inside of Bio7. Since OpenGL is single-threaded the Bio7 run method is executed from the internal OpenGL display method. The Bio7 Setup method is triggered from the internal OpenGL init method.
For a pain free use of OpenGL inside of Bio7:
  1. Please do not call an OpenGL method from a different thread.
  2. Generally create the following objects and models in the setup method: TextRenderer objects, Texture objects and *.obj models This ensures that the created objects in Fullscreen mode will be recreated with the correct gl context.
For more information about this read the Jogl User’s guide at: About Jogl in general the book of Andrew Davison: Pro Java 6 3D Game Development ISBN: 1590598172 Web Site for the book: (The *.obj loader source and part of walkthrough ideas are from this book which is highly recommended for an introduction of Jogl).

4.6 The WorldWind Perspective

The WorldWind perspective can be opened in the perspective bar. This perspective embedds two views, the Options WorldWind view (left) and the WorldWind view which embedds the NASA Java Virtual Globe “WorldWind” from: The Options WorldWind view offers several thematic panels and actions available if expanded.
figure images/chapter4/worldwindperspective.jpg
Figure 4.27 The WorldWind Perspective
Default Controls (description from:
Pan Left mouse button; click & drag - all directions
Zoom Use the scroll wheel on the mouse or left & right mouse (both buttons); click & drag - up and down
Tilt Right mouse button; click & drag - up and downor use "Page Up" and "Page Down" on the keyboard.
Right mouse button; click & drag - left and right
Note: Crossing the top and bottom half of the screen while rotating will change direction.
Stop Spacebar
Reset Heading N
Reset all R
Fullscreen F2
Exit Fullscreen Escape
Visit List Locations F3
Table 4.3 The Mouse with scroll wheel
Left mouse button; click & drag - all directions left mouse button
click once to center view.
Zoom Hold "Ctrl" on the keyboard and left mouse button; click & drag - up and down
Hold "Shift" on the keyboard and left mouse button; click & drag - up and down or use
"Page Up" and "Page Down" on the keyboard.
Rotate Hold "Shift" on the keyboard and left mouse button; click & drag - left and right
Stop Spacebar
Reset Heading N
Reset All R
Fullscreen F2
Exit Fullscreen Escape
Visit List Locations F3
Table 4.4 Single mouse button

4.6.1 Control

In the Control view custom coordinates or city names can be set in the Coordinates text field to navigate to the virtual location of the globe. The visible view (coordinates) can be stored for a later visit with a optional name. With the Clear Cache action downloaded textures (maps) can be deleted. The Open Cache action open the storage location of the textures. Coordinates of places can be stored between application sessions in the location list below the Coordinates textfield (Add). Selected list locations can be deleted with the Delete action. List coordinates can be exported or reimported with the Load and Save action. The coordinates are stored as a *.txt file. With the F3 key the list coordinates can be visited in order of the displayed list. This is very useful if you want to make a presentation in Fullscreen (F2) and visit several locations on the virtual globe. Note that you can also add image layers to the globe to enrich such a presentation with plots or visualizations.
figure images/chapter4/worldwindcontrol.jpg
Figure 4.28 Control panel

4.6.2 Default Layers

In this view special default available layers and maps from different sources can be enabled or disabled and blended together with an alpha value.
figure images/chapter4/worldwinddefaultlayers.jpg
Figure 4.29 Default Layers panel

4.6.3 Layers

With this panel Shapefiles (Add Shapefile), GeoTIFF images (Add GeoTIFF), static (IJ image) or dynamic ImageJ images (IJ Dynamic - e.g. a animated stack) can be enabled on the WorldWind surface. In addition custom OpenGL visualizations can be compiled with the embedded Java editor and enabled as a layer (Dyn. Layer) on the 3D-globe. With the Latitude and Longitude textfields images can be referenced (positioned) on the globe and visited with the Go to action. The Get Area action fills the Latitude, Longitude textfields with information from special defined variables in R if available. So you can georeference images etc. in R, transfer the coordinates with the Get Area to the Latitude, Longitude textfields and then activate and position a selected layer on the coordinates (e.g. ImageJ images, R plots - ImageJ is the default R plot device!). With the Compute action coordinates (upper left and lower right) can be picked to set the Latitude and Longitude values in the textfields if the toogle is enabled (don’t forget to disable the toggle after selection!).
figure images/chapter4/worldwindlayers.jpg
Figure 4.30 Layer panel

4.6.4 Render

With the action Capture an animation of the globe can rendered to ImageJ. The amount of rendering time (Frames) and the framerate (FPS - Frames Per Second) can be adjusted, too. With the Screenshot action a screenshot of the panel can be sent to ImageJ as an image. The Info action shows some context help for the two actions.
figure images/chapter4/worldwindrender.jpg
Figure 4.31 Render panel

4.6.5 Measure

In the Measure panel some measurements on the globe can be made with different selection types. The Follow terrain options includes the height profile in the measurements. To start a new Measurement the New Measur. action has to be invoked. The selection type (Shape), path type (Path type), units (Units) and angle format (Angle Format) can be selected in available combo boxes before a measurement. Different measurements can be coloured with the actions Coulor Line, Colour Points and Colour Tooltip. With an available “Values->R” action the measurements can be transferred directly into a R workspace.
figure images/chapter4/worldwindmeasure.jpg
Figure 4.32 Measure panel

4.6.6 Projection

In the projection panel several globe projections can be selected with an option for a flat display (option Flat) of the globe.
figure images/chapter4/worldwindprojection.jpg
Figure 4.33 Projection panel

4.7 The R Perspective and Menus

Bio7 embeds R as a statistical application to do profound statistical analysis of ecological models. To interact with the Bio7 application and all of its components the Rserve connection has to be started. In a start process the Bio7 application tries to connect to the Server (displayed in the progress dialog). If the connection trials exceed 10 trials (1/second) the operation will be aborted. After the connection has been established several methods for the interaction with R are available. By using the R editor (see↓) RScripts can easily be interpreted. Additionally some specialized methods are available in the R menu of Bio7.

4.7.1 R Menus in the Bio7 Main Menu

  1. Start Rserve starts R with a Rserve connection.
  2. With the Load Workspace action R workspaces can be loaded.
  3. The Save Workspace action saves the current workspace.
  4. Evaluate Expression opens a dialog where R expression can be evaluated. The evaluated expression will be displayed in the Console of the Bio7 platform.
  5. Evaluate Selection evaluates the selected line in the R editor and then jumps to the next line.
  6. The Evaluate Clipboard action evaluates R scripts which were transferred before to the clipboard.
  7. The Get Clipboard Data action will transfer data from the clipboard to the workspace of R and is stored in a dataframe “clip”.
  8. The action Remove all objects removes all objects from the current workspace.
  9. The Install package(s) action will open a dialog to install packages from the available repository of R.
  10. The Load package(s) action will open a dialog to select and load an already installed library. The dialog to install packages from the CRAN server fetches a list from available packages if the Get List action has been invoked. The package in the list which should be installed has to be selected and the Install Selected action has to be invoked to install the package to a selected location.
  11. Start RGui with Workspace action starts the standard R shell or RGui with the current workspace if started on theWindows OS (The path to the temporary file can be adjusted in the Preferences of Rserve).
  12. The Preferences action opens the main R and Rserve preferences of Bio7

4.7.2 The R Perspective

The R perspective contains two views for the manipulation and analysis of data with R. The Table view for the import, export and transfer of data to R and the R-Shell view which embedds several methods and templates to evaluate and edit R data expressions.
figure images/chapter4/rperspective.jpg
Figure 4.34 The R Perspective The Table View

The Table view is a spreadsheet component in which data can be imported, exported, edited and transferred to R. Several sheets can be opened side by side as known from popular spreadsheet applications.
The Table View Menu File Import for CSV Data

In the Table view menu a special import action is availabe to import *.csv files. Some configuration options in the dialog which will be opened with this action help in the configuration of a *.csv data import. With a preview action the consequence of e.g. changing delimiters and seperators can be visualized in a table.
figure images/chapter4/csvimportdialog.jpg
Figure 4.35 The CSV Reader dialog to import *.csv data The R-Shell View

The R-Shell view embeds an expression textfield and several tabs to manipulate, edit, transfer, plot data and templates for the R language.
figure images/chapter4/rshell.jpg
Figure 4.36 The R-Shell view in the R perspective
The Expression Textfield
In the expression textfield (1) R expressions can be evaluated with the Evaluate Expression action. The history of the typed expressions are recorded and can be viewed with the arror-key (click to transfer the command to the expression textfield. Furthermore two actions are available to open the R documentation files. The actions below the textfield are listed here:
The Object Tab
The Object tab (2) is divided into a data view (3) and a display (4) for the evaluated R data or R error messages. In the data view a context menu is available (see description below) to edit selected data types and transfer selected data to the Table view of Bio7. If a variable in the data view is selected an object description is given in the display of the Objects tabitem. In the toolbar of the tabitem the following actions are available.
Context Menu in the Data View (5)
Special Keys in the Data View
The Plot Data Tab
A selected data structure (in the data view of the Object tab) can be plotted easily with the different plot actions in this tab. The selected plot type has to be appropriate for the selected datatype. Default all plots are created as an Image in ImageJ. If the option Detour is enabled all commands are transferred to the textfield for customization (templates are available in the context menu of the textfield). The customized command then can be plotted with the Draw Plot action.
figure images/chapter4/rplotshell.png
Figure 4.37 The Plot Data tab with context menu
The Packages tab
The Packages tab displays the current loaded R packages. In the context menu the view can be refreshed (Refresh) for newly loaded packages and another action (Detach) can detach packages if selected in the tree control.
figure images/chapter4/rpackagesshell.png
Figure 4.38 The Packages Tab with context menu
The Template tabs
The template tabs offer several thematic ordered templates for the use in the expression textfield or the R editor. Context information is shown up if a template is selected. A double-click with the left mouse on the selected template transfers the text to the Expression textfield. A Right-Mouse (double-click) transfers the text to an opened R editor.
figure images/chapter4/templatesrshell.png
Figure 4.39 A Template tab The R Editor

figure images/chapter4/reditor.jpg
Figure 4.40 The R editor with the opened context menu
The R editor of Bio7 supports the syntax of the R language. If an R file is created with the default wizard the extension of the created R script file is *r. If you have an *.r file outside the workbench, this file can simply be dropped to a project of Bio7. If a R file has been opened, the toolbar of the Bio7 application displays two new items (1) which have some special functions (if a connection to the Rserver and R has been established).
R editor parser
The R editor of Bio7 is connected to an R parser. Each time the R code in the editor is changed the editor file is parsed and error or warning markers are created - visible as icons in the vertical ruler and underlined in the text where the errors or warnings have been detected. In addition the R parser creates code analytics to detect and inform about several flaws in the code. If some code assistence is available a light bulb will be displayed in the vertical ruler of the editor. A click on the quick fix icon opens a code suggestion which can be applied with a mouse click. The error and warning messages can also also opened if the underlined marked word is hovered. Hovered quick fixes can be confirmed with a mouse click, too.
figure images/chapter4/errorwarnmarkers.jpg
Figure 4.41 The R editor with errors and warnings. Error and warning quick fixes are indicated with a light bulb icon. Quick fixes can be opened (and applied) when hovering over the underlined error or warning. Install R Packages

The Packages dialog offers several actions for the installation of R packages:
figure images/chapter4/rpackageinstall.jpg
Figure 4.42 The Packages dialog to install R packages from the Internet Load R Packages

With the Libraries dialog (R ▷ Load/Remove package(s)) installed R packages can be installed or removed.
figure images/chapter4/loadrpackage.jpg
Figure 4.43 The Libraries dialog to load or remove installed R packages Plotting

Since Bio7 1.7.1 it is possible to plot single and multiple plots with ImageJ as the default R plot device. Multiple plots are displayed in an ImageJ image stack (with the available slider you can select one plot in the stack). Plots and plot stacks can be saved as images and movies with ImageJ in different formats (e.g. stacks can be stored as *.avi or animated *.gif). The size of the plots and the format can be changed in the Rserve Plot Preferences of Bio7 (see↓) .
figure images/chapter4/rplots.png
Figure 4.44 A R Plot opened in ImageJ as the default device R Debugging Interface

Since Bio7 2.0 a debugging GUI for R is integrated as part of the R editor. To debug a R script a breakpoint has to be set inside a R function. If a breakpoint is set several actions are added to the default Bio7 console. For the debugging process the native R console has to be started (The Rserve connection will be automatically change to the native mode if alive!). To start a debugging process the “Debug Trace Action” has to be invoked and the traced function has to be executed in the R shell (see screenshot below). In the shell several debugging actions are available:
  1. The Debug Trace Action to start the debugging process.
  2. The Stop action to stop the debugging process.
  3. The Next action to go to the next statement.
  4. The Continue action which continues with the execution without single stepping.
  5. The Step Into action to step into function calls.
  6. The Finish action to finish the current loop or function.
  7. A Help action to display R debugging console commands.
figure images/chapter4/rdebugging.jpg
Figure 4.45 R debugging GUI with opened context menu to set breakpoints.
R Debugging Views
To inspect the current variables a Debug(x) view is available to display the environment variables and objects. Single variables can be changed in the spreadsheet (“Value” column) to inspect the effect on the environment. In addition a Debug Text view is availabe to display external R source not displayed in the opened R file (e.g. if stepped in an package function call).
Debug Context Menu
The context menu offers several actions to:
  1. Set a breakpoint.
  2. Set a conditional breakpoint - Syntax e.g. : if (x==5) browser() which is a wrapper for: trace(fun, quote(if (x == 5) browser())).
  3. Edit a conditional breakpoint.
  4. Delete a selected breakpoint.
  5. Delete all breakpoints. R Plot Preferences

figure images/chapter4/rserveplotpref.jpg
Figure 4.46 Rserve preferences to select and adjust the R plot device
In the preferences several options are available to adjust the R plots. The default plot size can be changed in the textfield Device Definition (or the whole plot definition). Beside the option to plot images in ImageJ it is possible to open plots in different applications. Some templates in the preferences can be selected to switch e.g. to a *.pdf (multiple plots can be displayed) or *.svg plot (displaying a single plot) which will be opened with the default registered software if available – for *.svg i recommend to improve the plot appearance). Antialiased image plots can be enabled with the Image Cairo option. To change the default Device Definition in the textfield press the action Apply. Please note that the preferences will be saved if you press the OK or Apply button.
Special Plot Function
RGL (a special package for 3D plots) and some native windows need a GUI thread which is not available. To trigger a repaint with Bio7 please select the Bio7 window and press the key combination ALT+A. Help

As noted earlier if a command has been typed in the textfield of the R-Shell view and the ? button has been pressed the action tries to open the default help page for the command in the Bio7 browser (same as typing ?+command in R).
figure images/chapter4/rfunctionhelp.png
Figure 4.47 The Help Browser Rserve preferences

There are several Rserve preferences available wich are described in this section.The following preferences can be adjusted:
figure images/chapter4/rservepreferences.jpg
Figure 4.48 Rserve preferences
(2) In the Packages preferences you can select the default R package mirror to download R packages from. In addition you can set the install location of the packages.
(3) In the Rserve Remote preferences a remote R server can be set for remote Rserve connection. An example can be found in the Bio7 code snippets.
(4) In the Transfer to Table options the transfer method to the Bio7 Table from R can be specified to adjust the numerical precision of numbers. Please consult the R documentation for the command format.
(5) In the Sweave/TeX options the paths to Sweave and pdflatex can be adjusted (sweave has a default path). R Editor

For a description of the R editor see↑. Native R Excution

In Bio7 it is possible to execute R scripts and R commands without Rserve (10.1↓). In the Bio7 console an independant R console can be started which pipes commands directly to an instance of R. If the editor should be used with the native communication this has to be selected in the R preferences of Bio7. Some commands and GUI interfaces cannot be used if the native execution is selected. Reports with knitr

In the context menu of the Navigator view knitr ( files (e.g. *.Rhtml, *Rtex, ) can be selected to compile reports with the R knitr package if installed. *.Rhtml files can be opened and edited in the Bio7 HTML editor. Latex files will be compiled if a Latex environment (e.g. MiKTeX - is installed and the path to pdflatex is adjusted in the Bio7 Rserve preferences. Create R Packages

If R files are selected in the Navigator view an action is available which opens a dialog to create a R package skeleton from files or selected R workspace variables. After the creation if the created R package folder is selected several available actions help in the build process of a package.
For some of the listed actions above the OS pseudo terminal in the console view has to be activated. Custom flags can be added in the R Preferences Built Tools of Bio7. Please note: For the built process of R package binaries some extra tools are needed (especially for Windows). Please consult the R instructions ( on the internet or search for available tutorials. For tests on the Windows OS i installed a Latex environment (MiKeTeX with inconsolata.sty style file installed) and the Rtools distribution for Windows (
figure images/chapter4/rpackagecreation.jpg
Figure 4.49 Dialog to create R package skeleton

4.8 The HTML Perspective

figure images/chapter4/htmlperspective.jpg
Figure 4.50 The HTML Perspective
The HTML perspective is a special perspective to create websites with the HTML editor of Bio7. The HTML editor will be opened if a *.html file is selected or created. It contains two tabs to switch between the source editor and a text interface based on JavaFX. Projects are stored and displayed in the Navigator view (left) which is also displayed by default in this perspective. You can use the Bio7 file wizard to create a new *.html site. With the Open In Browser action the created content can be displayed in the default browser of the OS (embedded as a Browser view below the editor).

4.9 Custom Perspective, Views and Menus

It is also possible to fill an available custom perspective (“Custom”) with Bio7. All views from the application can be used to layout the perspective for certain tasks.

4.9.1 Custom Views

Besides the possibility to extend Bio7 with custom perspectives also multiple custom-views can be defined for embedding self defined GUI’s in Bio7. Self defined JPanels (Swing), SWT canvas, Draw2d panels and JavaFX can easily be embedded in a Custom Controls view. Multiple custom views can be created with a unique id. In a JavaFX custom view fullscreen mode can be triggered with the keys F1 and F2. The keys F3, F4 and F5 open a custom view fullscreen panel on a secondary,tertiary or quartary monitor.
figure images/chapter4/customview.jpg
Figure 4.51 Custom JavaFX view

4.9.2 Custom Menus

Another nice feature of Bio7 is the simple way to extend the Script menus in Bio7 with BeanShell, Groovy, Jython scripts, R scripts and ImageJ macros. Bio7 recognizes files dropped to special folders automatically and extends the menus with the filename of the dropped files. for an overview see (see 10.4↓.

4.9.3 Custom Startup

Groovy scripts can be used to customize the platform directly behind the start of the Bio7 application. These scripts will be executed with the Groovy interpreter. The scripts have to be placed in a specialized folder (10.4↓) for custom activities like :

5 The Editors of Bio7

5.1 General Features

There are several editors integrated in Bio7 which support the syntax of different programming languages and a specialized Flow editor to drop files from the other editors for execution. The "language" editors support the syntax of the languages Java, BeanShell,Groovy, Jython and R. A text editor is also offered by default integrated in the platform (an editor for arbitrary files as well!). All editors if opened offer more or less customized menus and toolbars and also offer custom context menus for the work with the different languages. By activating a language editor, typical text tools are activated in the edit menu of the main menubar of the Bio7 application. Some creation notes are listed below.
figure images/chapter5/filewizard.jpg
Figure 5.1 Dialog to create projects and files with a wizard for the different editors

5.1.1 Editor Code Templates

Alternatively to the simple Snippets view (see 4.1.4↑) all language editors offer code templates by pressing the key combination Ctrl+Space (see below). Eventually the key settings have to be changed depending on the OS!
figure images/chapter5/codetemplatesdialog.jpg
Figure 5.2 Editor code templates
Templates for the Bio7 editors can be created and stored in the preferences dialog (Preferences ▷ Preferences Bio7 ▷ Preferences xxx-Editor  ▷ Template Editor xxx).
figure images/chapter5/codetemplates.jpg
Figure 5.3 Template preferences
For a detailed description of the Code Templates see:
By default it is possible to share this self defined code templates with others by using the integrated import/export functions of the different template editors available for each language in Bio7.

5.1.2 Preferences of the Editors

In the preferences dialog of Bio7 there are a lot of functions available to customize the different language editors. For example, the fonts for all editors can be customized under General ▷ Appearance ▷ Colours and Fonts. If the colours of the keywords, etc. should be changed, it could be done under Preferences Bio7 ▷ Preferences xxx-Editor for a selected editor.

5.1.3 The R Editor

Bio7 contains a R editor which is described in the R perspective section (see 4.7↑).

5.1.4 R Markdown Editor

Since Bio7 2.3 it is possible to write R markdown documents with the help of the rmarkdown package A simple markdown editor is available by default in Bio7 with helps in the creation of rmarkdown supported document types. A wizard in the file menu is available, too to help in the creation of a default rmarkdown document export type.

5.1.5 LaTeX Editor

The Texlipse editor integrated in Bio7 can be used to create LaTeX and LaTeX knitr documents. For a complete manual see: If the editor is opened with a *.Rtex knitr file an action will be available to compile the document to a valid *.tex file eventually with embedded R commands and plots.

5.1.6 HTML Editor

The HTML editor of Bio7 embedded, e.g., in the HTML perspective (see 4.8↑) is a graphical and text based editor (multi page) for the creation of pure HTML and rmarkdown HTML files.If the editor is opened with a *.Rhtml knitr file an action will be available to compile the document to a valid *.html file eventually with embedded R commands and plots.

5.1.7 Java

figure images/chapter5/javaeditor.jpg
Figure 5.4 The Java editor of Bio7 with opened context menu
Since Bio7 2.0 the JDT Java editor is used to edit Java source files. A description of the JDT editor can be found on the Eclipse documentation website or in the Bio7 help. Bio7 1.7.1 Full Class and Multiple Class Compilation is Supported!

In the Java preferences of Bio7 you can switch between full class and classbody compilation - deprecated in Bio7 2.0 - (1). In addition it is possible to adjust some compiler properties.
figure images/chapter5/javapreferences.jpg
Figure 5.5 Java compiler preferences to switch e.g. between dynamic classbody (deprecated) and (multiple) class compilation (1). The editors colours and fonts (2) can be adjusted, too.

5.1.8 BeanShell and Groovy

The BeanShell/Groovy editor as well as the Java editor supports the Java syntax. Code templates, (identically to that in the Java editor) are available, too (some script code templates may differ!). In general BeanShell or Groovy are capable to interpret ordinary Java code but also have complete scripting capabilities to facilitate the development process of programming. Scripting code as well as Java code can be executed with the actions which are shown in the toolbar.
The reasons that BeanShell, Groovy and a separate Java compiler have been added to Bio7 are the following:
  1. Need for speed in complex applications: The embedded Java compiler compiles the Java code to bytecode while the interpreted languages interpret the code which is much slower and sometimes is not sufficient for resource intensive calculations (though compiled code will be executed also very efficiently by BeanShell, Groovy or Jython!). However new versions of the different interpreters close this speed gap more and more.
  2. Scripting capabilities: With BeanShell, Groovy (and Jython) it is possible to create highly dynamic applications with customized scripts. Script templates like the snippets can easily be recycled for custom modifications. Scripts can be used to extend the Bio7 Script menus.
  3. Direct interaction: With the BeanShell, Groovy (or Jython) console you can interact directly with the methods and integrated API’s of Bio7.
Code, which was written for the Java compiler can easily be switched to BeanShell (supports full Java syntax up to version 1.4!) or Groovy (minor differences).
The default imports for the BeanShell, Groovy and Jython interpreter can be changed in the file ...\plugins\\bin\imports\ (Windows) Special Actions in the Context Menu of the Java and BeanShell/Groovy Editor

The context menu of the BeanShell/Groovy editor and the Java editor offers some methods for editing the source and for source conversions. These are (beside the regular actions of the platform):
  1. Add Block Comment: Surrounds the selected code with a block comment.
  2. Remove Block Comment: Removes a selected block comment. (A precise selection is necessary!).
  3. Format Java: Formats regular Java code (To work with BeanShell or Groovy please create Java code inside the BeanShell/Groovy editor!).
  4. Format selected Java: Formats only the selected code. This is sometimes necessary if the formatter can not format the entire code.
  5. R Source Conversion: Converts Rscript code. This converter helps to convert R expressions for the use e.g. in an BeanShell or Groovy script using the Rserve API.

5.1.9 The Python/Jython Editor

A Python/Jython editor is available to execute Python/Jython scripts. The Bio7 API can be used with Python/Jython, too. The editor comes with typical editor actions similiar to those which were already described for the other language editors.
1# A Jython example which overrides the run method
2# of the inherited Model class of Bio7!
3# The method run can be called from the Start/Pause action
4# of the Bio7 toolbar!
56class jythonClass(Model):
78def run(self):
9#print index
1213#We instantiate the class!
14model = jythonClass()
15#We set the class as the compiled class!
Table 5.1 Jython example which uses the Bio7 API Native Python Execution

It is also possible to execute Python scripts with the Jython editor if the native execution is enabled in the Native preferences of Bio7 (see: 10.1↓). If the Python package “Py4J” is installed ( in the Python distribution the Bio7 API and Java libs can be acessed from within CPython (see 5.2↓). Therefore the Java Py4J Server has to be started in the scripts menu of Bio7 (which is momentarily by default available in the Linux and Mac version of Bio7 2.0).
Note: It is also possible to install the popular “PyDev” Python editor ( into Bio7 and execute the opened Python scripts (you have to open them with the PyDev editor) with the available Bio7 action in the main toolbar. The available Bio7 action cares about the execution of the script in the Bio7 Python/Jython environment and console.
1# A Python Py4J example which transfers values
2# from the ImageJ Results table and plots them with
3# the Matplot lib.
4# For this example Py4J has to be installed in Python
5# and the Py4J Server has to be started!
67import numpy as np 
8import matplotlib.pyplot as plt 
9from py4j.java_gateway import JavaGateway 
10from py4j.java_collections import JavaArray
1112gateway = JavaGateway() 
1516#get the results from the Java ImageJ API!
2021values=[[0 for x in range(len(res))] for x in range(lastCol+1)]
22for x in range (0,lastCol+1): 
23	vals=rt.getColumnAsDoubles(x) 
24	if (isinstance(vals,JavaArray)): 	
25		print (’’)   		   		
26		for y in range (0,len(res)): 			
27			values[x][y]=vals[y]
2829#Plot the values!
Table 5.2 CPython Py4J example which uses the Java ImageJ API

5.1.5 The Flow Editor

The Flow editor of the Bio7 application is capable to handle and execute different files by their extension and display and arrange them in a flowchart like structure.The Flow editor is useful to:
The main strength of this tool is that you can assemble all methods and information, created by files for modeling, statistical analysis or image analysis in a profound analysis. The Flow editor of Bio7 helps to organize and visualize the creation and analysis of ecological models. A flowchart by definition is a graphic representation of a sequence of operations.
figure images/chapter5/flow.jpg
Figure 5.6 The Flow editor
If the editor is opened default actions will be added to the Bio7 toolbar (1) and a new menu will appear in the menubar of the application. Additionally, a specialized context menu will be available for calling different methods inside the Flow editor. In the flowchart of Bio7 files can simply be dragged from the Navigator view (2) of Bio7 and dropped into the Flow editor (3) of the application. According to their file extension these files are executed in the sequence of the flow which has been created. A created Flow editor file has the extension *.ecoflow. Some other files will be handled by default from the Flow editor when they are dragged from outside the workspace. Executable files (*.exe) will be executed, too and it is also possible to execute these files with an argument (by creating a file with the extension *.argument). Files from external that have different extensions will be executed according to their registration in the system environment. Furthermore an Outline view (4) on the left will show an overview of the flow - if the flow cannot easily be displayed in the main window because of its size a blue rectangle will be displayed in the Outline for a flow selection. The selection is the area of the flow which can be displayed in the main Flow editor window. A new Palette bar (5) will also be displayed for inserting flowchart elements in a newly created file. Execute and Verify a Flow

The execution of a flow will be triggered with the item FlowAction in the top-right of the toolbar (1). In addition since Bio7 1.5 a new action - left action - is available to verify the connections for a valid Bio7 flow graph. The Palette of the Flow Editor

For the creation of a running flowchart it is necessary to create a start and a stop element in the flowchart. By activating an element in the Palette these elements can be placed anywhere in the flowchart with the mouse at the appropriate coordinates (pressing mouse button will drop the component). Additionally when an element has been placed in the flow it can be dragged to any coordinates in the flow panel. All other elements in the Palette can be placed by this procedure too. The following elements are available and their values can be adjusted in the Properties view. Furthermore some properties can be changed directly in the shape (mouse click on the element) The following elements are available:
  1. Start : The start of the flow - necessary for execution !
  2. Stop : The end of the flow - necessary for execution !
  3. Loop : A loop will repeat a sequence in the flowchart. The number of iterations can be adjusted with an integer value directly in the shape (click and hold ca. one second to edit).
  4. Decision : A decision in the flow will execute an if statement. According to a self defined condition a static variable (Bio7Flow.setDecision(“true”)) can be set to true or false. The direction of the flow then depends on the linked connection which can be set to true or false in the properties dialog (select the connections to set the values).
  5. Info : A single line label for an info which can be edited in the shape.
  6. Connection: To determine the sequence of the flow Connections are available to connect components. If selected in the Palette directed connections can be drawn from component to component.
  7. Selections can be made with the Marquee tool and the Select tool (multiple selections are possible).
Options for the Layout
There are several tools available for adjusting the components and the layout of the flow. In the toolbar of Bio7 several items will be enabled when components are selected alone or in a group. By default the zoom action and the flow action are enabled.
The Context Menu
The context menu offers some of the aforementioned methods and several new methods. The new methods are:
  1. The options Manhatten Router and Shortest Path action are responsible for the layout of the connections.
    1. The Shortest Path action applies the shortest path algorithm to find paths around obstacles in the flow.
    2. The Manhatten Router algorithm will use rectangular lines for connections in the flow.
  2. The Save action will save the current flow to the before defined file (Save as in the Bio7 main menu available!).
  3. The Save Image action will save an image in the formats *.gif*, *.jpeg, *.ico to a file. The current size of the flow will determine the pic size (the rulers display the size of the flow in pixel. So be cautious not to store large images with a resized flow !).
  4. The Debug Mode option enables a visualization of the current flow by colouring the active shape white to mark files that are currently interpreted or compiled, etc. A mouse-click on the flow deletes marked components.
  5. Size Layout Grid opens a dialog to resize the grid (layout) if enabled.
The Properties for the Components
If a shape or a connection is activated the properties of the component or the connection can be adjusted in the Properties view. This view is activated by default below the Flow editor or can be activated with the Windows  ▷ Show View menu action. The properties dialog will only be necessary if you want create a decision inside a flow. All other component attributes are adjustable with the mouse. The following properties are displayed and can be adjusted:
  1. The File/Loop/Info/Condition property displays the following attributes in dependence of the selected component:
    1. The filepath of a dropped component (relative path in the workspace. This path will be used for execution!)
    2. The amount of loops which should be made when the loop component has been selected.
    3. An info text if the info component has been selected.
    4. When a decision component has been selected this property will be interpreted as a scripting expression in BeanShell.
  2. The filetype property shows the extension of the selected file, which has been dropped into the flow (has no effect on the other components).
  3. The properties Height,Width, X,Y display the size of the component and the location inside the flow which can also be adjusted in the properties view.
  4. There are two properties if a connection is selected.
    1. The property LineStyle can be set to dashed or solid (by default the style is solid).
    2. The Boolean property is important when a decision is created in the flow. The property can be set to true or false.
Note: The properties File and Filetype are important for the execution of a file inside the flow editor! The file type information is used to select the appropriate interpreter or compiler.
What to Consider when Creating a Flow
It should be mentioned that some rules are important for the creation of a regular flow in the Flow editor.
  1. A start and a stop component have to be placed in the flow and they have to be connected with the components for a regular Bio7 flow.
  2. A flow follows the outgoing direction (directed graph) marked with an outgoing arrowhead.
  3. Files:
    1. A dropped file in the flow editor (rectangular shape) can only be connected with another file or by means of a loop which connects on or two files.
    2. A file component has to have one outgoing connection.
    3. Files in the flow editor will be executed sequently by means of the information in the file property and the filetype property (the appropriate interpreter or program will be selected automatically).
  4. Loops:
    1. A loop can have one incoming and one outgoing connection.
    2. A loop cannot be the first component (after the start) in a Bio7 flow.
    3. It is possible to execute a loop with one file component.
    4. Loops can be created nested. The loops are executed “iteratively” (not “recursive” !).
    5. A loop can be connected (point) to a decision .
  5. Decisions:
    1. A decision gets an input from a component and has to have two outgoing connections. One connection has to be set to false and the other has to be set to true.
    2. A decision can be connected to another decision (else if).
    3. A decision cannot be connected (point) directly to a loop.
    4. It is allowed in Bio7 to place a decision right after the start.
    5. The condition of a decision component can be set directly in the properties view or in the component itself. The static variable decision has to be set to "true" or "false" (type: String) to follow a connection with the appropriate value - (API method: BatchModel.setDecision(“true”);).
  6. Info: An info component can be placed outside the connected flow for an information display. It is also allowed to draw connections to a file component as a pointer (optionally you can mark this connection with a changed line style).
How to Cancel a Flow!
A running flow can be interrupted at the next possible flow position with the Cancel action in the progress dialog (the dialog is only displayed for long operations) or by selecting the key combination Ctrl+x (short and long operations). If R is used in some operations it makes sense to start Rserve with a system console (see↑) before executing a flow. Only with a shell it is possible to interrupt an R calculation - if supported by the package creator. In some cases where the application Rserve is involved it can become necessary to stop and restart the application (this can be done with the Rserve connection action in the toolbar of Bio7). If possible it is highly recommend to test all files before they are used in the flow editor.
Dropped from the Navigator
The Flow editor recognizes several different file types. Files, created with the Bio7 editors, will be executed in the flow with the appropriate interpreter or the embedded compiler (e.g. *.bsh, *.java, *.py, *.r, *.txt, *.ecor). Additionally the Flow editor will also execute *.exe files. Files with the extension *.argument can be created and dropped before the *.exe file in the flow sequence. This will execute the dropped program with an argument (xxx -argument).
Dropped from Outside the Navigator
Files dropped from outside the navigator, will be opened or executed with the registered program of the operating system !
Important to Know
The dropped file components in the flow can be opened and edited with a double-click on that component. A static variable is available to trigger the flow interrupt - Bio7 method: Bio7Flow.setCancel(true) . Please consult the Bio7 API and examples for more reusable flow methods and components.

6 Preferences

6.1 The Bio7 Preferences

6.1.1 Application Paths

If the topmost item in the Bio7 Preferences dialog is selected several text fields are displayed which store different paths for the Bio7 application (Preferences ▷ Preferences Bio7). The two topmost paths (Path to R, Path to LibreOffice) are paths for the R application (embedded) and Open Office (if installed!) which will be eventually fetched from the registry (Windows) when Bio7 starts. They can also be adjusted manually to any location in the file system where R or LibreOffice are installed (Browse... button). It should be mentioned that the path to R can be changed to any R installation. The communication between Bio7 and R will be successful if the Rserve package is installed correctly in the referenced R application.
figure images/chapter6/preferencespaths.jpg
Figure 6.1 Bio7 path preferences

6.1.2 Script Paths

The following paths in the Preferences Bio7 are script path locations where scripts and macros (ImageJ macros) can be dropped which update the menu (except Startup Scripts!) of the Bio7 application at runtime (see 10.4↓). The import and export scripts will update the file menu. The other scripts and macros (General, R-Scripts, Spatial-Scripts, ImageJ-Macros, etc.) will update the scripts or special custom menus of Bio7.The locations of the scripts can be browsed easily with the browse action and files can be transferred simply by copy and paste from the Navigator. The files will be detected automatically and displayed in the appropriate menu for execution.

6.1.3 Bio7 Editor Preferences

The Preferences of the different language editors in Bio7 (R, BeanShell/Groovy, Java, Jython) offering methods to adjust the default colours and fonts and templates of the editors.
It should be mentioned that some aspects of the language editors can be changed in the default text preferences of the platform (e.g. font attributes).

6.1.4 Preferences Rserve

As already described the preferences for the Rserve application (Preferences Bio7 ▷ Preferences Rserve or R ▷ Preferences) offers some options for code templates, editor colors and general adjustments (see↑).

6.1.5 Default Platform Preferences

A detailed description of the preferences of the platform can be found on

7 Help

For a first help simply open the Bio7 browser Help ▷ Bio7 Internet By selecting the submenu Help ▷ Help Contents the Bio7 API can be opened in a HTML menu. The Welcome action opens a welcome page for the Bio7 application. The About Bio7 dialog opens an information about the current release of Bio7.

8 Update Manager

figure images/chapter8/updatemanager.jpg
Figure 8.1 The Update Manager
With the update manager Eclipse plugins can be easily installed or deleted. Update sites can be added as a installation source for existing external plugins. Installed third party plugins locations can be managed in the Available Software Sites preferences. Plugins can be deinstalled following the already installed link - it is even possible to return to a certain state of installation because the Eclipse Framework registers all configurations dates and changes. For more information about the update manager please consult the Eclipse documentation

9 Additional Views and Interfaces

9.1 Additional Eclipse views in Bio7

By default some more views are available in Bio7:

9.2 Java and Script Interaction with R

Additionally a nice feature in Bio7 is the direct interaction with the Rserve interpreter. Not only for evaluation, but also to obtain values from R to Java or BeanShell, Groovy and Jython is valuable for the creation and of models, etc. Not only a call to a R method is possible by means of compiled code but also calls from the BeanShell, Groovy and Jython interpreter can be made to transfer values e.g. to a BeanShell, Groovy, Jython workspace. R calculations can be interrupted (if supported by the package) with an opened system shell using the Strg+Break key combination on the shell (Windows), or with the pseudo terminal in in the Console view of Bio7 by typing: killall -INT Rserve (Linux, MacOSX). Because of the bidirectional transfer several things can be done, e.g.:
  1. Custom GUI’s can be created in Java or in the script interpreters and the values can be evaluated in R. After evaluation the results can be sent back to the interpreters workspace or to a method in Java.
  2. Build frontends for R methods with a scripted language (e.g. in JavaFX or SWT).
  3. Interaction between R and the API of ImageJ to automize image analysis tasks.
  4. Extend the script menus of Bio7 with R methods called by the script interpreters.

9.3 LibreOffice features of Bio7

If the free office software LibreOffice is installed, some methods for data acquisition and a small API for interaction with the LibreOffice spreadsheet are available in Bio7. To use the LibreOffice features it is necessary to establish a connection between LibreOffice and Bio7. This will be done automatically when selecting the action LibreOffice connection in the toolbar of Bio7. If a connection is established, several methods for the interaction with LibreOffice will be available in the LibreOffice menu.
  1. To receive or transfer values from or to the spreadsheet of LibreOffice it is necessary to open a spreadsheet. This can easily be done with the action LibreOffice ▷ Open Spreadsheet. After a spreadsheet has been opened (also possible by means of a small API) the spreadsheet can be filled with values by hand or with values from a file (in the opened spreadsheet menu of LibreOffice call the menu action: Insert ▷ Sheet from file).
  2. With the action Data to R LibreOffice spreadsheet values can be transferred to the active R workspace by means of the Rserve connection (the columns will be stored as lists and the selected values as a dataframe).
  3. With the action Data with head to R numeric values (type double) with a head can be transferred directly to R.
  4. With the menu Data to BeanShell values will be transferred to the workspace of BeanShell (they will be stored in a static double array - LibreOffice.sheetdata).
  5. With the action Send Bio7 counts counted values of the activated states in a simulation for all time steps are transferred to an opened spreadsheet which then can be stored to all kinds of data files.
  6. There is also a small API available for the transfer of data (get and set), inserting new sheets, getting values from sheets and the marking of the data in a spreadsheet (see Bio7 Snippets and Bio7 API docs).

10 What else ?

10.1 Native Preferences

In the native preferences some native connections to interpreters (R, Python) and OS shell preferences can be adjusted. The following preferences are available:
figure images/chapter10/nativepreferences.jpg
Figure 10.1 Native preferences of Bio7
(1) With the Shell preferences the OS shell can be started within Bio7 with some arguments.
(2) In the R preference the R editor script can be executed with the native connection instead of the Rserve connection (deprecated - only useful if Rserve is started independent from the shell!).
(3) In the Python/Blender preference it can be adjusted to execute Python code of the editor with a native Python connection instead of the default Jython interpreter. The path to a Python interpreter has to be adjusted. In addition a Blender Python interpreter (which is embedded in an Blender installation) can be used to execute editor code. The different options are described in (4). Once again the path has to be adjusted.
(4) In the Blender Default Options some preferences can be selected and changed to start the Python interpreter and execute editor code in different ways.

10.2 Drag, Drop, Compile and Start

Since Bio7 1.5 it is possible to store grid patterns in an *.xml file. If a Java editor is available the source code of an opened editor can be saved with the pattern. If source in a pattern file is available, too the source of the file will be loaded and compiled and the setup method (if available) will be executed. This can be used to execute a Java model with drag and drop. In addition this drag and drop action can also be used in conjunction with different java model types (3d models etc.). Some examples can be found on GitHub:

10.3 Drag and Drop Files

Several external file types can be dragged on the Bio7 interface. Here is an overview of the supported file types and the action involved:
GUI Comp. File Type Action
Global (1) *.exml Loads a pattern, compiles Java code (if availabe) and executes the setup method of the compiled code.
Global (1) *.RData Starts Rserve (if not alive) and loads the *RData into the R workspace.
Navigator *. Copies all file types in a project of Bio7 (in the Bio7 workspace).
ImageJ-Canvas *.png, *.jpg, etc. (2) Opens images, stacks, etc. in the ImageJ view.
ImageJ-Canvas *.jar Installs and loads ImageJ plugins (default folder has to be selected).
ImageJ-Toolbar *.png, *.jpg, etc. (2) Opens images, stacks, etc. in the ImageJ view
Points *.png, *.jpg, etc. (3) Opens images in the Points panel and adjusts the “Area of Analysis”.
Table 10.1 Drag And Drop actions in Bio7
(1) Except some Bio7 components with special drag and drop support and the editor area.
(2) All supported ImageJ file types and libs.
(3) Default Java supported image types.

10.4 Install Eclipse, R, ImageJ Plugins or Packages in Bio7

Bio7 can be extended in several different ways with Eclipse plugins, R packages, ImageJ plugins and custom scripts (scripts to extend a menu or executed at startup).
  1. To install (suitable) Eclipse plugins the Update-Manager can be used to install plugins from a remote website.
  2. R packages can be added in two different ways. One way is to use the package installer GUI of Bio7. Additionally the command line in R can be used to install packages.
  3. ImageJ plugins (*.class or *.jar files) have to be installed in the plugins folder of ImageJ which is is located in Bio7: Bio7/plugins/ Note: In the ImageJ Eclipse plugin the typical ImageJ folder structure can be found!
  4. Groovy, BeanShell, Jython and R scripts, as well as ImageJ macros can be dropped to special folders to extend the default Bio7 menu (startup) functionality. The folders which are scanned by default are shown in the table below.
Folder Location (see Preferences!) Script Type Menu Bio7 Component
Bio7\plugins\\export_scripts BeanShell,Groovy, Jython File->Export-Scripts Main Menu
Bio7\plugins\\import_scripts BeanShell,Groovy, Jython File->Import-Scripts Main Menu
Bio7\plugins\\image_scripts ImageJ Macros Scripts->ImageJ-Macros Main Menu
Bio7\plugins\\scripts BeanShell,Groovy, Jython Scripts->General-Scripts Main Menu
Bio7\plugins\\r_scripts R scripts Scripts->R-Scripts Main Menu
Bio7\plugins\\spatial_scripts BeanShell,Groovy, Jython Scripts->Spatial-Scripts Main Menu
Bio7\plugins\\grid_scripts BeanShell,Groovy, Jython, Rscripts Scripts Table View Menu
Bio7\plugins\\r_shell_scripts BeanShell,Groovy, Jython, Rscripts Scripts R-Shell Context Menu
Bio7\plugins\\startup_scripts Groovy Scripts executed at startup if startup folder available! -
Table 10.2 Scripts and their install locations for Bio7

10.5 Install Git

One useful plugin for Bio7 is the Git plugin which can easily installed with the Update Manager of Bio7. Open the Update Manager and select the Update site for the plugin (see screenshot below). Then select the appropriate plugins. After installation a vast amounts of Git methods can be used easily with a Graphical User Interface. For a documentation please visit:
figure images/chapter10/installgit.jpg
Figure 10.2 Installation of the EclipseGit plugin

10.6 Bio7 Browser

Bio7 embeds the default Webbrowser engine in a view with custom links to useful developer resources for R, ImageJ, etc. The view can be opened in the Help menu (Help ▷ Bio7 Internet).
figure images/chapter10/bio7browser.jpg
Figure 10.3 The Bio7 Browser view

10.7 Special Grid Visualizations

Since Bio7 1.0 a specialized OpenGL panel is available (beside the general 3d panel) to visualize the Quadgrid view matrix layered with an ImageJ image matrix. The current ImageJ image will be displayed as a layer (e.g. for the visualization of a nutrient matrix below plants).To open the view execute Window ▷ Show views ▷ Other ▷ Bio7-3D ▷ 3Dgrid.
figure images/chapter10/3dgrid.jpg
Figure 10.4 The 3Dgrid view

10.8 Uninstall Eclipse Plugins

The about dialog embeds an action to uninstall installed Eclipse plugins or revert the installation of Bio7 to a specific date of installation. In this way a corrupted installation can be reverted to a previous state of installation.

10.9 Programming Examples for Bio7

The application Bio7 is distributed with a rich set of programming examples, which should facilitate the development of ecological models. The examples are so called Snippets (short programming examples) which are numbered and divided into two projects. One project (Bio7_Java_Examples) contains Java snippets for the different components of Bio7 which demonstrates how to use them and the flexibility of the platform in general. The other project Bio7_Script_Examples contains snippets as examples for the scripting languages. This Snippets also show that you can use the different embedded application and modules to understand and analyze complex systems or bundle them in ecological modeling for more complex purposes. The examples are available as projects. Please import them with File ▷ Import ▷ Existing Projects into Workspace into your Bio7 workspace. The Snippets can also be browsed and downloaded on github:

11 Literature and Links

11.1 Scientific Libraries Available in Bio7

11.2 Documentation and Programming Links:

12 Addendum

With an ID perspectives and views can be opened or closed programmatically. Below the ID’s of the perspectives and views are listed.
View Id
Options Space
Custom Chart
Browser Editor
Options WorldWind
Custom Controlls
Custom 3d
Navigator org.eclipse.ui.views.ResourceNavigator
Progress org.eclipse.ui.views.ProgressView
Bookmark org.eclipse.ui.views.BookmarkView
Tasks org.eclipse.ui.views.TaskList
Problems org.eclipse.ui.views.ProblemView
Console org.eclipse.ui.console.ConsoleView
Properties org.eclipse.ui.views.PropertySheet
Outline org.eclipse.ui.views.ContentOutline
Geometry Selections
Debug (x)
Debug Text
Custom Controls
Table 12.1 View ID to call programmatically
Perspective ID
Resource org.eclipse.ui.resourcePerspective
Table 12.2 Perspective ID to call programmatically

13 Definition of Expressions


[1] T. Czárán. Spatiotemporal models of population and community dynamics. Chapman & Hall, 1998.

[2] Ulf Dieckmann, Richard Law, International Institute for Applied Systems Analysis. The geometry of ecological interactions: simplifying spatial complexity. Cambridge University Press, 2000.

[3] Nicholas J. Gotelli. A Primer of Ecology, Fourth Edition. Sinauer Associates, Inc., may 2008.

[4] James W. Haefner. Modeling Biological Systems:: Principles and Applications. Springer, may 2005.

[5] Sven Erik Jørgensen, T-S. Chon, Friedrich Recknagel. Handbook of ecological modelling and informatics. WIT Press, feb 2009.

[6] Dietmar Saupe. The Science of Fractal Images. In (Peitgen, Heinz-Otto and Saupe, Dietmar, ed.). Springer-Verlag New York, Inc., 1988. URL

[7] John Wainwright, Mark Mulligan. Environmental Modelling: Finding Simplicity in Complexity. Wiley, jan 2004.

List of Figures