[R-sig-Geo] Calculations with images
adrian at maths.uwa.edu.au
adrian at maths.uwa.edu.au
Tue Jul 17 05:09:46 CEST 2007
Agustin Lobo <Agustin.Lobo at ija.csic.es> writes:
> ai <- as.im(a)
> ai$v[ai$v==0]<-NA #0 values in the raster are the background
> adist <- distmap(as.owin(ai))
> adistlog <- adist
> adistlog$v <- log(adistlog$v+1) #log transform
In spatstat you can also use 'solutionset' to find the pixels that satisfy
a logical statement, and `eval.im' to do calculations with pixel values.
The code above is equivalent to
ai <- as.im(a)
aw <- solutionset(ai != 0)
adist <- distmap(aw)
adistlog <- eval.im(log(adist)+1)
Adrian Baddeley
More information about the R-sig-Geo
mailing list