Login  Register

RE: Measuring images in screen pixels

Posted by Elkee on Nov 25, 2013; 5:19pm
URL: http://imagej.273.s1.nabble.com/Measuring-images-in-screen-pixels-tp5005667p5005698.html

This is perfect for the lines, thank you.  However, I put in a macro to mark the end and quarter points of the line segment when I hit "draw" but this still puts them too large and often off-centered on the image rather than the overlay.  I'm terrible with making macros, but I figure the general idea is already there.  Is there any way to get it to go to the overlay?
 
This is the macro I am using:
 
// The macro "quarters" draws dots along a line selection
// at the beginning, 1/4 way point, 1/2 way point, 3/4 point, and ending of the line.
 

macro "quarters [q]" {
 

getLine(x1,y1,x5,y5,width);
 

// Make oval size and line width a function of line length
if(x1==x5) {
orient = "v";
length = abs(y5-y1);
ovwit = length/35;
}
 

if(y1==y5) {
orient = "h";
length = abs(x5-x1);
ovwit = length/55;
}
 

y2 = y1 + ((y5-y1)/4);
y3 = y1 + ((y5-y1)/2);
y4 = y5 - ((y5-y1)/4);
 

x2 = x1 + ((x5-x1)/4);
x3 = x1 + ((x5-x1)/2);
x4 = x5 - ((x5-x1)/4);
 

// Adjust coordinates for the fillOval function
adj = ovwit/2;
x1 = x1 - adj;
x2 = x2 - adj;
x3 = x3 - adj;
x4 = x4 - adj;
x5 = x5 - adj;
 

y1 = y1 - adj;
y2 = y2 - adj;
y3 = y3 - adj;
y4 = y4 - adj;
y5 = y5 - adj;
 

setTool("brush");
setColor("magenta");
setLineWidth(3);
fillOval(x1,y1,ovwit,ovwit);
fillOval(x2,y2,ovwit,ovwit);
fillOval(x3,y3,ovwit,ovwit);
fillOval(x4,y4,ovwit,ovwit);
fillOval(x5,y5,ovwit,ovwit);
setLineWidth(1);
setTool("line");
 

}

 

Date: Mon, 25 Nov 2013 06:42:13 -0800
From: [hidden email]
To: [hidden email]
Subject: Re: Measuring images in screen pixels

Hi Elkee,

you can use an overlay instead of drawing. The overlay can have a line thickness of "zero", which means as thin as possible at any magnification.
  Image>Overlay>Add Selection.  Hold the alt key to set the properties of the overlay.

Another (similar) approach is saving the lines to the ROI Manager instead of drawing them, and using 'show all' in the Roi Manager.

To save the image with an overlay or rois, save it as tiff or zip.

Michael
________________________________________________________________
On Nov 25, 2013, at 02:16, Elkee wrote:

> I guess I did not explain this well.  I tried to get a real picture to show
> you what I am talking about.  I am dealing with ratios, so I do not care
> whether or not I am measuring in screen pixels or image pixels, though I
> think screen pixels would allow for finer measurements.  However, I find
> when I draw the segment and do not click "draw" on the I have very fine
> lines and the endpoints and center point are also a great size and re
> integrated with the line as the center.  I assume this is because the tool
> is using screen pixels.  However, when I click to have the segment drawn on
> the image the line and points I am measuring from get much thicker because
> they fill a pixel on the image.  This works fine with the larger bacteria,
> but with the smaller bacteria my image becomes almost completely filled in
> with lines (as you can see in the picture), making it difficult to see the
> bacteria.  However, if I could base my line segments off of screen pixels,
> as is done before I click "draw" to the right of the smaller measured
> bacteria, I can see what I am doing much better and be far more accurate
> when I am doing my 2nd, 3rd, and 4th measurement.  Plus, I would never have
> an off set as seen in the larger bacteria.
>
> Maybe there is a way to use multiple segment tools and measure rather then
> draw on the actual image?  Or select to measure and mark screen pixels
> rather than image pixels?
>
> I hope this clears it up slightly better.  Thank you for your help
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html



If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/Measuring-images-in-screen-pixels-tp5005667p5005691.html
To unsubscribe from Measuring images in screen pixels, click here.
NAML