Hello there
I apologise if this has been asked before, as I'm new to ImageJ, but I did have a quick look through the archive and couldn't see anything immediately. What I want to do is this - (1) measure the length of two lines: a long one and a shorter one (2) calculate the percentage of the shorter line in relation to the longer one. I want to do this hundreds of times, and each time, the lines will be of different lengths. I was thinking of just exporting the pairs of figures to Excel and writing a function to calculate the percentages. But maybe you know of a way of getting ImageJ to do this for me automatically? (Save me a step or two!) I don't know anything about plug-ins, macros, strings, etc., so if you do have any suggestions, please give me very simple step-by-step instructions! Maybe I should just stick with Excel...? Thanks very much, Jenny |
My assumption is that, two people will ask similar questions, and one may find/have an answer that points to the solution of the other. Often, the problem is that questions are not 'nuclear' and problems are not first devolved into a list.
Though the relevance remains to be determined. I can sometimes generate questions that lead to answers. I believe that the url below, while not specific for ImageJ, or, perhaps the question, does relate to the question of finding lines in an image. http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/YOUNG2/ ????? Fred Monson Frederick C. Monson, PhD Technical Director Center for Microanalysis and Imaging, Research and Training (CMIRT) Schmucker Science Center South West Chester University, West Chester, PA 19383 610-738-0437 Home Page: http://cmirt.wcupa.edu Scheduler: http://cmirt.wcupa.edu/cgi-bin/ureserve_gold.pl -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Jennifer Marshall Sent: Monday, February 07, 2011 11:52 AM To: [hidden email] Subject: Calculate percentage of a line in relation to another Hello there I apologise if this has been asked before, as I'm new to ImageJ, but I did have a quick look through the archive and couldn't see anything immediately. What I want to do is this - (1) measure the length of two lines: a long one and a shorter one (2) calculate the percentage of the shorter line in relation to the longer one. I want to do this hundreds of times, and each time, the lines will be of different lengths. I was thinking of just exporting the pairs of figures to Excel and writing a function to calculate the percentages. But maybe you know of a way of getting ImageJ to do this for me automatically? (Save me a step or two!) I don't know anything about plug-ins, macros, strings, etc., so if you do have any suggestions, please give me very simple step-by-step instructions! Maybe I should just stick with Excel...? Thanks very much, Jenny |
In reply to this post by Jennifer Marshall
Jenny,
Can you segment the lines using the threshold (Image>Adjust>Threshold...)? If so, then you can get their lengths with the AnalyzeParticles routine and comp[are them anyway you like automatically. Send me a typical image if you need more help. Chris Coulon On Feb 7, 2011, at 8:51 AM, Jennifer Marshall wrote: Hello there I apologise if this has been asked before, as I'm new to ImageJ, but I did have a quick look through the archive and couldn't see anything immediately. What I want to do is this - (1) measure the length of two lines: a long one and a shorter one (2) calculate the percentage of the shorter line in relation to the longer one. I want to do this hundreds of times, and each time, the lines will be of different lengths. I was thinking of just exporting the pairs of figures to Excel and writing a function to calculate the percentages. But maybe you know of a way of getting ImageJ to do this for me automatically? (Save me a step or two!) I don't know anything about plug-ins, macros, strings, etc., so if you do have any suggestions, please give me very simple step-by-step instructions! Maybe I should just stick with Excel...? Thanks very much, Jenny Christopher Coulon, Ph.D. The GAIA Group http://gaiag.net PastedGraphic-2.tiff (114K) Download Attachment |
In reply to this post by Jennifer Marshall
It is a little unclear to me as to what data you already have. The phrase:
"I was thinking of just exporting the pairs of figures to Excel and writing a function to calculate the percentages." Implies that you already have something like line endpoint coordinates and want to compute line lengths and length ratios from them. Could you clarify this point please. David Webster On Mon, Feb 7, 2011 at 8:51 AM, Jennifer Marshall <[hidden email]>wrote: > Hello there > I apologise if this has been asked before, as I'm new to ImageJ, but I did > have a quick look through the archive and couldn't see anything > immediately. > > What I want to do is this - > (1) measure the length of two lines: a long one and a shorter one > (2) calculate the percentage of the shorter line in relation to the longer > one. > > I want to do this hundreds of times, and each time, the lines will be of > different lengths. > I was thinking of just exporting the pairs of figures to Excel and writing > a function to calculate the percentages. > But maybe you know of a way of getting ImageJ to do this for me > automatically? (Save me a step or two!) > > I don't know anything about plug-ins, macros, strings, etc., so if you do > have any suggestions, please give me very simple step-by-step > instructions! Maybe I should just stick with Excel...? > > Thanks very much, > Jenny > |
In reply to this post by Jennifer Marshall
On Feb 7, 2011, at 11:51 AM, Jennifer Marshall wrote:
> Hello there > I apologise if this has been asked before, as I'm new to ImageJ, but I did > have a quick look through the archive and couldn't see anything > immediately. > > What I want to do is this - > (1) measure the length of two lines: a long one and a shorter one > (2) calculate the percentage of the shorter line in relation to the longer > one. > > I want to do this hundreds of times, and each time, the lines will be of > different lengths. > I was thinking of just exporting the pairs of figures to Excel and writing > a function to calculate the percentages. > But maybe you know of a way of getting ImageJ to do this for me > automatically? (Save me a step or two!) > > I don't know anything about plug-ins, macros, strings, etc., so if you do > have any suggestions, please give me very simple step-by-step > instructions! Maybe I should just stick with Excel...? Here is a macro that measures the length of a line selection and displays the ratio (as a percent) of the length of that line and the length of the previously measured line. macro "Measure Relative Length [1]" { run("Measure"); length1 = getResult('Length', nResults-1); if (length1==0 || isNaN(length1)) exit("Line selection required"); length2 = getResult('Length', nResults-2); setResult('Percent', nResults-1, length1*100/length2); updateResults(); } You can create a "Measure Relative Length" command in the Plugins menu by saving the macro in the plugins folder as "Measure_Relative_Length.txt" and running Help>Refresh menus. This command will not have a keyboard shortcut but you can run it repeatedly by running it once and then pressing shift-r (Process>Repeat command). Or you can add a "Measure Relative Length [1]" command, with a keyboard shortcut of "1", to the Plugins>Macros menu by adding the macro to the end of the ImageJ/macros/StartupMacros.txt file and restarting ImageJ. -wayne |
In reply to this post by Jennifer Marshall
Hi there
Just to say a big THANK YOU to all of you who have helped me on this. I'm extremely grateful, as was rather out of my depth! Cheers, Jenny |
Free forum by Nabble | Edit this page |