I think I fixed the problem.  At least practically, although I wonder if there 
is still a bug.

Even though the image shows that every pixel falls under the threshold, I 
thought that maybe median filtering it would help.  
I added a run("Median...", "radius=2"); following the 8 bit conversion and now 
it seems to work.

Cheers-
Michael

-----Original Message-----
From: Cammer, Michael <[email protected]> 
Sent: Thursday, July 3, 2025 9:48 AM
To: [email protected]
Subject: help with wand tool

[EXTERNAL]

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!cApvnrpaNujFpFgF27I1baAnhFcAD-LxX8APC_fsORg3nglwtdiHJPxHbxez2V4sSgdG4i6apjBfxULjt81a884bgo5PuNKKHQiSj4o$
   
https://urldefense.com/v3/__http://microscopynotes.com/__;!!MXfaZl3l!cApvnrpaNujFpFgF27I1baAnhFcAD-LxX8APC_fsORg3nglwtdiHJPxHbxez2V4sSgdG4i6apjBfxULjt81a884bgo5PuNKKf5PJLww$
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: 
https://urldefense.com/v3/__http://imagej.nih.gov/ij/list.html__;!!MXfaZl3l!cApvnrpaNujFpFgF27I1baAnhFcAD-LxX8APC_fsORg3nglwtdiHJPxHbxez2V4sSgdG4i6apjBfxULjt81a884bgo5PuNKK1NnXqo4$

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Reply via email to