Dear all,

I have a set od 30,000 binary landscapes, which represent habitat and
non-habitat cover.
I need to generate images that identify those neighbour (rule 8) pixels as
one patch ID,
and a different patch ID for each clump of pixels. I coded it using
labcon(adehabitat),
but as some of my landscapes have so many patches, labcon not finish and
entry in
a eternal looping. By other side, I coded another solution using R & grass
(r.clump),
but the solution is so slow, and as I need to run it a lot of time, I will
need about 3 weeks
to finish... I was thinking if raster package could do the job fastly than
R-grass.
Below you can find a simulation of what I need. On the second image, each
color
have different values.

MyMatrix<-matrix(rep(0,100), ncol=10)
MyMatrix[2:4,3:6]<-1
MyMatrix[7:8,1:3]<-1
MyMatrix[8,7:8]<-1
MyMatrix[8,7:8]<-1
MyMatrix[6:7,8:9]<-1
x11(800,400)
par(mfrow=c(1,2))
image(MyMatrix)

MyClusters<-matrix(rep(0,100), ncol=10)
MyClusters[2:4,3:6]<-1
MyClusters[7:8,1:3]<-2
MyClusters[8,7:8]<-3
MyClusters[8,7:8]<-4
MyClusters[6:7,8:9]<-4
image(MyClusters, col=c("transparent", 1,3,4,5))

Regards a lot,

milton
brazil=toronto.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to