Mike,
If you can use a circular selection, these macros (first one taken from Wayne) will count the number of rays crossing the selection. Be sure to mak the image binary first. You could easily modify this to use the various line selection tools and then make use of the get.Profile command. Chuck ****** var xcenter, ycenter, radius, steps; //global variables macro "Circular Selection Tool -C00b-B11-O11cc-F6622" { requires("1.30k"); getCursorLoc(x, y, z, flags); xcenter = x; ycenter = y; getBoundingRect(x2, y2, w, h) if (selectionType==1 && x>x2-4 && x<x2+w+4 && y>y2-4 && y<y2+h+4) move(w, h); else create(xcenter, ycenter); } // move existing circular selection until mouse released function move(width, height) { x2=-1; y2=-1; while (true) { getCursorLoc(x, y, z, flags); if (flags==0) return; if (x!=x2 || y!=y2) makeOval(x-width/2, y-height/2, width, height); x2=x; y2=y; wait(10); }; } // draw circular selections until mouse released function create(xcenter, ycenter) { radius2 = -1; while (true) { getCursorLoc(x, y, z, flags); if (flags==0) { getBoundingRect(x, y, width, height); if (width==0 || height==0) run("Select None"); return; } dx = (x - xcenter); dy = (y - ycenter); radius = sqrt(dx*dx + dy*dy); if (radius!=radius2) makeOval(xcenter-radius, ycenter-radius, radius*2, radius*2); radius2 = radius; wait(10); }; } macro "Plot Circular Selection [p]"{ requires("1.31k"); degrees = getNumber("Angle between points = ?" 4); steps = 360/degrees; values = newArray(steps); for (i = 0; i<steps; i++){ angleInRadians = (6.2832/steps) * i; offsetX = cos(angleInRadians) * radius; //radius from circular selection offsetY = sin(angleInRadians) * radius; x = xcenter + offsetX; y = ycenter + offsetY; value = getPixel(x,y); values[i] = value; }; objects = 0; thisValue = -1; lastValue = -1; for (i=0; i<steps; i++){ //print(j+" "+values[j]); thisValue = values[i]; if (thisValue == 255 && lastValue == 0) objects = objects+1; lastValue = thisValue; }; print(objects+" objects were found"); } ****Mike wrote: Hi, Does anyone know if Image J has the ability to measure the number of projections on the perimeter of an object? For example, I have created binary images of cells growing on a substrate. Some are neuronal in shape. I'd like to measure the number of projections (e.g. axons) emanating from the cell body. Any suggestions on how to do this? Thanks. Mike McIntyre ****End of quote. |
Free forum by Nabble | Edit this page |