The following and the macro at 
https://imagej.net/ij/macros/examples/AutoThresholdingDemo.txt work.  Seems 
specifiying the background color updated the mask.


setAutoThreshold("Default dark no-reset");
waitForUser;
setAutoThreshold("Huang dark no-reset");
waitForUser;
setAutoThreshold("IsoData dark no-reset");
waitForUser;
setAutoThreshold("Mean dark no-reset");
waitForUser;
setAutoThreshold("RenyiEntropy dark no-reset");
waitForUser;
setAutoThreshold("Shanbhag dark no-reset");


Cheers-

Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory
NYU Langone Health, 540 First Avenue, office MSB 0657A (elevator to MSB 6 or 
Smilow 4)
main lab Smilow C-17, New York, NY  10016
Office: 646-501-0567 Cell (DO NOT TEXT): 914-309-3270  
[email protected]  
http://nyulmc.org/micros  http://microscopynotes.com/
 





-----Original Message-----
From: CARL Philippe (LBP) <[email protected]> 
Sent: Thursday, January 11, 2024 8:24 AM
To: [email protected]
Subject: setAutoThreshold through macro code

[EXTERNAL]

Dear all,
Isn't it possible to perform a setAutoThreshold within a macro and visualyze 
this selection within the Threshold... window ?
As the min and max levels seem to be updated, it is not the case of the 
threshold method as illustrated by the following small macro code:
        run("Blobs (25K)");
        setAutoThreshold("Otsu dark");
        run("Threshold...");
        waitForUser;
        setAutoThreshold("Minimum dark");
        run("Threshold...");
        waitForUser;
        setAutoThreshold("Default dark");
        run("Threshold...");
        waitForUser;
        setAutoThreshold("Huang dark");
        run("Threshold...");
        waitForUser;
        setAutoThreshold("Intermodes dark");
        run("Threshold...");
        waitForUser;
        setAutoThreshold("IsoData dark");
        run("Threshold...");
Looking briefly within the code, I found the setMethod method within the 
ij.process.AutoThresholder which could be doing the job (through the 
"instance.methodChoice.select(method);" line).
But the setAutoThreshold of the ij.macro.Functions class is calling the 
setAutoThreshold method of the ij.process.ImageProcessor class which will 
finally be calling the getThreshold method of the AutoThresholder class.
And there is no call to a "instance.methodChoice.select(method);" instruction 
or equivalent.
Looking forward for your lightings on this, please receive my best wishes for 
this new year!
My best regards,
Philippe

Philippe CARL
Laboratoire de Bioimagerie et Pathologies UMR 7021 CNRS - Université de 
Strasbourg Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 41 41

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

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

Reply via email to