On Tue, 16 Jul 1996, Ana Pombo wrote: > Is there a procedure (in NIH Image or elsewhere) to automatically obtain the > gravity centres directly from my images, taking into account the grey level > information? Could I get the details? Hello, Ana. The easiest way we found was just a straightforward mathematical implementation of the center of mass equation. While I'm not yet familiar with NIH Image, I'll assume it supports basic math functions, which is all you need: 1) Create an image for each dimention (x and y) that is just a slope in that dimention. ie, g1(x,y) = x for the x dimention, g2(x,y) = y for the y dimention. 2) Multiply the original image you want the center of by each of the 2 slope images (x and y). Make sure the multiplication is element by element, not a matrix mult. 3) From each result (x and y), sum the values in the product image to get a single scalar value. 4) Divide each of these values (x and y) by the sum of the values in the original image. The quotients (x and y) are the x and y coordinates of the center of mass. I imagine this process can easily be made into a script or macro that will perform the task at a keystroke. BEWARE: One problem I've encountered is a non-zero black level. Make sure that, if your image has a "background" (a black space where the "mass" object is not), that the values for the black are set to zero. Scale your image if necessary to provide this. If you do not, it's much like finding the center of mass of a pizza with toppings (background and objects), instead of just the toppings (which are the objects of the image). Hope this helps... apologies in advance if this is all stuff you already knew and I totally misunderstood the question. :) -Joe _________ \\ | Joseph Mancuso, Research Scientist II \\ Advanced Information Systems Group \\ E R I M Environmental Research Institute of Michigan / ~~~~~~~~~~ - - - - - - - - - - - - - - - - - - - - - - - - - - / (313) 994-1200 x2750 /========| [log in to unmask] http://www.erim.org/~mancuso/