Hello, all-
Last night I was trying to use the List.setMeasurements("limit") command and wanted to figure out how to toggle it on and off. I was getting unexpected results on microscopy data so wrote a macro to test it. The following gave unexpected results and I'd appreciate if someone could please point out how I am misusing the new command. Using the following code, I expected either of these two outputs: 191.5 191.5 191.5 127.5 or 191.5 127.5 191.5 127.5 However, this is the output: 127.5 127.5 191.5 127.5 macro "test limit command" { newImage("Untitled", "8-bit ramp", 256, 256, 1); run("Select All"); setThreshold(128, 255); List.setMeasurements("limit"); // enables the "Limit to threshold" option. print(getValue("Mean")); List.setMeasurements(""); print(getValue("Mean")); run("Set Measurements...", "mean limit redirect=None decimal=3"); run("Measure"); print(getResult("Mean", nResults-1)); run("Set Measurements...", "mean redirect=None decimal=3"); run("Measure"); print(getResult("Mean", nResults-1)); } Thank you! Michael Cammer Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY 10016 [hidden email]<mailto:[hidden email]> http://nyulmc.org/micros http://microscopynotes.com/ Voice direct only, no text or messages: 1-914-309-3270 and 1-646-501-0567 ------------------------------------------------------------ This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is proprietary, confidential, and exempt from disclosure under applicable law. Any unauthorized review, use, disclosure, or distribution is prohibited. If you have received this email in error please notify the sender by return email and delete the original message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email. ================================= -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
> On Sep 17, 2020, at 9:14 PM, Cammer, Michael <[hidden email]> wrote:
> > Hello, all- > > Last night I was trying to use the List.setMeasurements("limit") command and wanted to figure out how to toggle it on and off. I was getting unexpected results on microscopy data so wrote a macro to test it. The following gave unexpected results and I'd appreciate if someone could please point out how I am misusing the new command. The List.setMeasurements function will work as expected if you use List.getValue() to read the values. The easiest way to get the mean with “limit to threshold” set is to use getValue(“Mean limit”). Here is an example: newImage("Untitled", "8-bit ramp", 256, 256, 1); setThreshold(128, 255); //easy way print("Mean with limit: "+getValue("Mean limit")); print("Mean without limit: "+getValue("Mean")); // harder way List.setMeasurements("limit"); print("Mean with limit: "+List.getValue("Mean")); List.setMeasurements; print("Mean without limit: "+List.getValue("Mean")); -wayne > Using the following code, I expected either of these two outputs: > > 191.5 > 191.5 > 191.5 > 127.5 > > or > > 191.5 > 127.5 > 191.5 > 127.5 > > However, this is the output: > > 127.5 > 127.5 > 191.5 > 127.5 > > > macro "test limit command" { > newImage("Untitled", "8-bit ramp", 256, 256, 1); > run("Select All"); > setThreshold(128, 255); > List.setMeasurements("limit"); // enables the "Limit to threshold" option. > print(getValue("Mean")); > List.setMeasurements(""); > print(getValue("Mean")); > run("Set Measurements...", "mean limit redirect=None decimal=3"); > run("Measure"); > print(getResult("Mean", nResults-1)); > run("Set Measurements...", "mean redirect=None decimal=3"); > run("Measure"); > print(getResult("Mean", nResults-1)); > } -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |