Here you will find daily news and tutorials about R, contributed by over 573 bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

(This article was first published on » R, and kindly contributed to R-bloggers)

If you plot data in R and you would like to display the same data in the ImageJ view it is necessary to transfer the data matrix to ImageJ. The first thing which can be noticed is that the image data is displayed rotated because of the Bio7 approach to transfer data forth and back in the following way: imagedata(x,y) whereas (x0,y0) can be found in the upper left corner (Java coordinates in images!). In R values in a matrix are referenced with matrix(rows, columns) thats why images plotted with R and images (matrix data) displayed in ImageJ are different oriented.

Plot created with R using a spatstat (spatial analysis package) example and displayed in ImageJ

Pure R matrix data transferred as Floats, coloured with a LUT (LookUpTable) and displayed in ImageJ (Scalebar could be added, too).

If you would like to get the same view in ImageJ as the R plot simply transform the image (for the spatstat example rotate the image 90° in the left direction; for an image plot view like R flip the image vertically).

Of course another possibility to get the same result would be to adjust the coordinate system in the R plot. But this example illustrates the differences between the R coordinates and the ImageJ (Java) coordinates.

Related

To leave a comment for the author, please follow the link and comment on their blog: » R.