I have photographs of plots that look like so: http://r.789695.n4.nabble.com/file/n4631960/Untitled.jpg I need to divide it up so each circle has an equal area surrounding it. So into 20 equal segments, each of which contains a circle. Quadratcount is not sufficient because if I divide it up into 36 equal quadrats, some quadrats do not contain one of the circles. I'm not even sure how to do it mathematically, let alone using R. Can anyone help? -- View this message in context: http://r.789695.n4.nabble.com/Quadrat-counting-with-spatstat-tp4631960.html Sent from the R help mailing list archive at Nabble.com.
On Thu, May 31, 2012 at 11:23 AM, AMFTom <the.quiet.room at gmail.com> wrote:> I have photographs of plots that look like so: > > http://r.789695.n4.nabble.com/file/n4631960/Untitled.jpg > > I need to divide it up so each circle has an equal area surrounding it. So > into 20 equal segments, each of which contains a circle. Quadratcount is not > sufficient because if I divide it up into 36 equal quadrats, some quadrats > do not contain one of the circles.I must admit I found this a little confusing -- are you trying to divide into twenty segments or 36? Also, what package does quadratcount come from? I'm guessing this might work better in an image processing/computer vision program than in R. Best, Michael> > I'm not even sure how to do it mathematically, let alone using R. > > Can anyone help? > > -- > View this message in context: http://r.789695.n4.nabble.com/Quadrat-counting-with-spatstat-tp4631960.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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.
Hello, There is more than one way to do it. I would divide space according to weighted distance. Specify a distance function. Euclidian distance will give you boundaries that consist of ellipse segments. Manhattan distance will give you straight lines which may be preferable. Assign to every circle i a distance weight wd[i]. You can start with equal weights. Associate every point j in space with the circle i to which it has the smallest weighted distance distance(i,j)/wd[i]. This will divide space into segments, each containing one circle. Use a set of points equally distributed over space (e.g. grid points or random) and calculate how segments area sizes relate to each other by counting how many points fall into each segment. Adjust distance weights - the larger the distance weight, the larger the area around the circle - until the areas are equal enough for your purpose. Exploit symmetries by keeping distance weights equal that should be equal due to symmetry. You can run an optimization algorithm by using an evaluation function that is minimal for equal areas. Hope this helps! Take care Oliver On Thu, May 31, 2012 at 11:23 AM, AMFTom <the.quiet.room at gmail.com> wrote:> I have photographs of plots that look like so: > > http://r.789695.n4.nabble.com/file/n4631960/Untitled.jpg > > I need to divide it up so each circle has an equal area surrounding it. So > into 20 equal segments, each of which contains a circle. Quadratcount is not > sufficient because if I divide it up into 36 equal quadrats, some quadrats > do not contain one of the circles. > > I'm not even sure how to do it mathematically, let alone using R. > > Can anyone help? > > -- > View this message in context: http://r.789695.n4.nabble.com/Quadrat-counting-with-spatstat-tp4631960.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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.-- Oliver Ruebenacker Bioinformatics Consultant (http://www.knowomics.com/wiki/Oliver_Ruebenacker) Knowomics, The Bioinformatics Network (http://www.knowomics.com) SBPAX: Turning Bio Knowledge into Math Models (http://www.sbpax.org)
On Thu, May 31, 2012 at 08:23:02AM -0700, AMFTom wrote:> I have photographs of plots that look like so: > > http://r.789695.n4.nabble.com/file/n4631960/Untitled.jpg > > I need to divide it up so each circle has an equal area surrounding it. So > into 20 equal segments, each of which contains a circle. Quadratcount is not > sufficient because if I divide it up into 36 equal quadrats, some quadrats > do not contain one of the circles. > > I'm not even sure how to do it mathematically, let alone using R.Hi. Try the following. a <- rbind( c(-1, -1), c(-1, 1), c( 1, 1), c( 1, -1), c(-1, -1)) plot(a, type="l") p <- rbind( c(0, 0), c(-0.6, 0.6), c(-0.6, -0.6), c(0.6, 0.6), c(0.6, -0.6)) points(p, col=4, pch=20, cex=4) v <- sqrt(2/5) b <- rbind( c(-1, 0), c( 0,-1), c( 1, 0), c( 0, 1)) for (i in 1:4) { lines(rbind(b[i, ], v*b[i, ])) lines(v*rbind(b[i, ], b[(i %% 4) + 1, ])) } This divides a square into 5 equal regions. The area of the middle square is 2 v^2 = 4/5 and the area of each of the four remaining parts is 1 - v^2/2 = 4/5. If the above is repeated in a grid 2 times 2, we get a partition of a larger square into 20 equal regions. I did not check, whether they contain the required points, since i do not know their exact coordinates, but they could. Hope this helps. Petr Savicky.