Hi R users,

I would like to be able to calculate how many cells of a raster, and their values (1 or 0), lie at a distance r from a particular cell in the raster. In other words, I need to calculate the number and values of the cells lying on a ring with radius r and centred in x0 and y0.

This is as far I got:



require(spatstat)

# Build an example image of 0's and 1's:

M <- im(matrix(sample(0:1,500*500,TRUE),nrow=500),xcol=seq(0,10,length=500),

               yrow=seq(0,10,length=500))

Thanks
Lorenzo


	[[alternative HTML version deleted]]

