Romain Francois, Professional R Enthusiast

To content | To menu | To search

Thursday, February 18 2010

raster images and RImageJ

The next version of R includes support for raster images in standard and grid graphics.

The RImageJ package uses ImageJ through rJava to read and manipulate images from various formats

Paul Murrell closed the gap and contributed code that allows using images from the RImageJ package as raster objects.

makes the graph :

Rplot001.png

This feature depends on R >= 2.11.0, so will only get available when this version becomes current, in the meantime, you can get the package from its rforge project page

Monday, June 22 2009

using ImageJ from R: the RImageJ package

I've pushed to CRAN the initial version of the RImageJ package. ImageJ is a java based image processing and analysis platform

This version of the package creates an instance of the IJ class as the IJ object in R, so that many methods of this class can be called using the dollar expansion of rJava.

Here is a simple example that uses the package:

download.file( "http://www.google.fr/intl/en_en/images/logo.gif", 
    dest = "google.gif" )

image = IJ$openImage( "google.gif" )
image$show()
IJ$run( "8-bit" )
IJ$run( "Invert" )
IJ$save( "bw-google.gif" )
image$close()


This downloads the google logo, convert it to black and white and inverts it

google logo bw-google.gif Future plans for this package contain:
  • integration of imagej and javagd
  • integration of the imagej macro recorder so that it creates R code instead of code in the imagej macro language