Dear group,
I want to use Wayne's macro to measure length of multiple points in the image. I noticed when macro is implemented on the "raw" image without calibration it works as it should. Each mouse click draws a lebel on the image. However it is not truth when the image is calibrated (set in the scale option). Basically macro works, result table is generated, but for the better confidence I would prefer to see also the label marks. Can somebody help, please. Regards Vlado Assoc. Prof. Vladimir Hegyi, MD., PhD. Here is the macro listing: // This tool macro calculates the 3D distance between // points defined by successive mouse clicks. // // Double-click on the tool icon to set the mark // width or to enable label drawing. Alt-click on // the end point to display one distance value // per point pair and to display the same // label on the starting and ending points. var x1, y1, z1 var markSize = 0; var label = false; macro "3D Distance Tool -C669-F3333-Fbb33" { requires("1.32f"); getCursorLoc(x2, y2, z2, flags); alt = flags&8!=0; getPixelSize(unit, pixelWidth, pixelHeight, pixelDepth); x2*=pixelWidth; y2*=pixelHeight; z2*=pixelDepth; distance = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1)); x1=x2; y1=y2; z1=z2; if (unit=="pixel") unit = "pixels"; row = nResults; if (row>0 && alt) row--; setResult("Distance ("+unit+")", row, distance); updateResults(); if (markSize>0) { setLineWidth(markSize); drawLine(x2, y2, x2, y2); } if (label && nResults>0) { setKeyDown("none"); makeRectangle(x2, y2, 1, 1); run("Label"); makeRectangle(0, 0, 0, 0); } } macro "3D Distance Tool Options" { markSize = getNumber("Mark Size:", markSize); label = getBoolean("Draw Labels?"); } |
> I want to use Wayne's macro to measure length of multiple
> points in the image. I noticed when macro is implemented on > the "raw" image without calibration it works as it should. > Each mouse click draws a lebel on the image. However it is > not truth when the image is calibrated (set in the scale > option). Basically macro works, result table is generated, > but for the better confidence I would prefer to see also the > label marks. Can somebody help, please. There is an updated version of the 3D Distance Tool at http://rsb.info.nih.gov/ij/macros/tools/3D-Distance-Tool.txt that fixes this problem. -wayne > Here is the macro listing: > // This tool macro calculates the 3D distance between > // points defined by successive mouse clicks. > // > // Double-click on the tool icon to set the mark > // width or to enable label drawing. Alt-click on > // the end point to display one distance value > // per point pair and to display the same > // label on the starting and ending points. > > var x1, y1, z1 > var markSize = 0; > var label = false; > > macro "3D Distance Tool -C669-F3333-Fbb33" { > requires("1.32f"); > getCursorLoc(x2, y2, z2, flags); > alt = flags&8!=0; > getPixelSize(unit, pixelWidth, pixelHeight, pixelDepth); > x2*=pixelWidth; y2*=pixelHeight; z2*=pixelDepth; > distance = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)+(z2-z1)*(z2-z1)); > x1=x2; y1=y2; z1=z2; > if (unit=="pixel") unit = "pixels"; > row = nResults; > if (row>0 && alt) row--; > setResult("Distance ("+unit+")", row, distance); > updateResults(); > if (markSize>0) { > setLineWidth(markSize); > drawLine(x2, y2, x2, y2); > } > if (label && nResults>0) { > setKeyDown("none"); > makeRectangle(x2, y2, 1, 1); > run("Label"); > makeRectangle(0, 0, 0, 0); > } > } > > macro "3D Distance Tool Options" { > markSize = getNumber("Mark Size:", markSize); > label = getBoolean("Draw Labels?"); > } > |
Free forum by Nabble | Edit this page |