Dear Michaels,
I've just written off-list to Gabriel with the same conclusion and the
attached image. In short, the effect is in fact a consequence of the
"Legacy"-scheme.
Best
Herbie
::::::::::::::::::::::::::::::::::::::::::::
Am 04.07.25 um 11:39 schrieb Michael Schmid:
Hi Michael,
the reason for the problem is the following:
The wand starts from the image center and then goes to the right until
it finds an edge of the thresholded region. In the
'wand_tool_does_not_work' file it finds an inner hole (one pixel not
thresholded) and thresholds that single pixel.
You can avoid this by using wand mode '8-connected' instead of the
default (legacy mode).
doWand(getWidth/2, getHeight/2, 0, "8-connected");
8-connected mode is also more robust in some other aspects.
Don't care about the tolerance value (3rd argument, here set to 0), it
is ignored for thresholded images.
Michael
________________________________________________________________
On 03.07.25 18:38, Cammer, Michael wrote:
I posted images at
https://microscopynotes.com/temp/wand_tool_works.png
https://microscopynotes.com/temp/wand_tool_does_not_work.png
The following code always works when the run("Median...", "radius=2");
is run.
But looking at the image that does not work, I don’t see a single
pixel near getWidth/2, getHeight/2 which does not fall withing the
threshold range.
Cheers-
Michael
run("Select None");
run("8-bit");
//run("Median...", "radius=2");
setAutoThreshold("Default no-reset");
getThreshold(min, max);
max = max * 1.25; // grab additional periphery which
may be thin and light
setThreshold(0, max, "raw");
doWand(getWidth/2, getHeight/2);
run("Set Measurements...", "area display redirect=None decimal=2");
run("Measure");
print(getTitle + "\t " + getResult("Area") + "\t pixels -- result
really should be reported as um^2");
selectWindow("Log");
-----Original Message-----
From: Gluender <[email protected]>
Sent: Thursday, July 3, 2025 9:56 AM
To: [email protected]
Subject: Re: help with wand tool
[EXTERNAL]
Greetings Michael,
do have images to test?
Best
Herbie
:::::::::::::::::::::::::::::::::::::::::::::
Am 03.07.25 um 15:48 schrieb Cammer, Michael:
We have images where there is dark object at the center of the field
that we want to measure. We are very puzzled because the following
code works for some images and not for others. When we manually
click using the wand tool, it always works, but this code only works
on some images and not others.
We are using ImageJ 1.54q14 with java 1.8.0_172.
Help would be appreciated. Thank you!
// This only reports area. Best fitting ellipse or
other morphometrics could be reported.
run("Select None");
run("8-bit");
setAutoThreshold("Default no-reset");
getThreshold(min, max);
max = max *
1.25; // grab additional
periphery which may be thin and light
setThreshold(0, max, "raw");
doWand(getWidth/2, getHeight/2);
run("Set Measurements...", "area display
redirect=None decimal=2");
run("Measure");
print(getTitle + "\t " + getResult("Area") + "\t
pixels -- result really should be reported as um^2");
selectWindow("Log");
Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory NYU
Langone Health, 540 First Avenue, New York, NY 10016
Office: RB (formerly Skirball) 4-102 -- call if door is locked (phone
near elevators)
Office: 646-501-0567 Cell (voice only, not text): 914-309-3270
[email protected]<mailto:[email protected]>
https://urldefense.com/v3/__http://nyulmc.org/micros__;!!MXfaZl3l!ZXZzBOssOTsy1L_yBR01V3HlavHaYYXIQsn6k_-gmg0nJ1i0f77fj1Ji4siraz3ftIUS7LOL6rDlOCJeaXfxFlo$
https://urldefense.com/v3/__http://microscopynotes.com/__;!!MXfaZl3l!ZXZzBOssOTsy1L_yBR01V3HlavHaYYXIQsn6k_-gmg0nJ1i0f77fj1Ji4siraz3ftIUS7LOL6rDlOCJeYipsd6Y$
Scheduling the time you want is far more reliable by phone call. Why
not provide your phone number?
------------------------------------------------------------
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
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html