[R-sig-Geo] as.raster() does not work for RImageJ objects

Agustin Lobo alobolistas at gmail.com
Thu Jan 16 16:09:44 CET 2014


Hi!

While the following works fine:
install.packages("/home/alobo/Downloads/RImageJ_0.2-146.tar.gz", repos
= NULL, type="source")
require(RImageJ)
require(raster)
logo <- system.file( "images", "R.jpg", package = "RImageJ" )
image = IJ$openImage( logo )
class(image)
plot(c(100, 250), c(300, 450), type = "n", xlab="", ylab="")
rasterImage(image, 100, 300, 150, 350, interpolate=FALSE)

(note that the example in
http://romainfrancois.blog.free.fr/index.php?category/R-package/RImageJ
is currently wrong, it must be rasterImage() and not raster()

But as.raster() (the most important for me) does not work:

> class(image)
[1] "jobjRef"
attr(,"package")
[1] "rJava"
> r <- as.raster(image)
Error in as.raster.jobjRef(image) : attempt to apply non-function

see ?as.raster.jobjRef

Any fix?

Thanks
Agus



More information about the R-sig-Geo mailing list