Problem with IJ.run("Threshold...")

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with IJ.run("Threshold...")

gadea
Hello, I'm developing a plugin, and I need to use the method Huang for thresholding. But when I try doing:

IJ.run("Threshold...", "Huang Apply")

nothing, the window is open but the method it isn't runned.

I have tried with:

IJ.run("Threshold...", "method='Huang'")
IJ.run("Threshold...", "threshold='Huang'")
and IJ.run("Threshold","Huang'") too, but nothing.

I hope you can help me.

Thanks in advance!

Gadea
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IJ.run("Threshold...")

Volker Baecker
Hello,
try

setAutoThreshold("Huang");
run("Convert to Mask");

You can use the macro recorder to find out how to apply macro commands
(menu Plugins>Macros>Record)

Volker
On 26/06/12 16:06, gadea wrote:

> Hello, I'm developing a plugin, and I need to use the method Huang for
> thresholding. But when I try doing:
>
> IJ.run("Threshold...", "Huang Apply")
>
> nothing, the window is open but the method it isn't runned.
>
> I have tried with:
>
> IJ.run("Threshold...", "method='Huang'")
> IJ.run("Threshold...", "threshold='Huang'")
> and IJ.run("Threshold","Huang'") too, but nothing.
>
> I hope you can help me.
>
> Thanks in advance!
>
> Gadea
>
>
> --
> View this message in context: http://imagej.1557.n6.nabble.com/Problem-with-IJ-run-Threshold-tp4999217.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IJ.run("Threshold...")

Jan Eglinger-3
In reply to this post by gadea
Hi Gadea,

using the Macro recorder (Plugins>Macros>Record...), switching to
'Record: Plugin' and then executing Image>Adjust>Threshold, I got the
following code that should do what you expect:

IJ.setAutoThreshold(imp, "Huang");

Hth,
Jan


On 26.06.2012 4:06 PM, gadea wrote:

> Hello, I'm developing a plugin, and I need to use the method Huang for
> thresholding. But when I try doing:
>
> IJ.run("Threshold...", "Huang Apply")
>
> nothing, the window is open but the method it isn't runned.
>
> I have tried with:
>
> IJ.run("Threshold...", "method='Huang'")
> IJ.run("Threshold...", "threshold='Huang'")
> and IJ.run("Threshold","Huang'") too, but nothing.
>
> I hope you can help me.
>
> Thanks in advance!
>
> Gadea
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IJ.run("Threshold...")

Niko Ehrenfeuchter
In reply to this post by gadea
Dear Gadea,

On 26.06.2012 16:06, gadea wrote:

> Hello, I'm developing a plugin, and I need to use the method Huang for
> thresholding. But when I try doing:
>
> IJ.run("Threshold...", "Huang Apply")
>
> nothing, the window is open but the method it isn't runned.
>
> I have tried with:
>
> IJ.run("Threshold...", "method='Huang'")
> IJ.run("Threshold...", "threshold='Huang'")
> and IJ.run("Threshold","Huang'") too, but nothing.

to solve issues like this, just use the built-in macro recorder:

1) open your image
2) record a new macro (Plugins -> Macros -> Record)
3) switch from "Macro" to "Plugin" in the recorder window
4) open the Threshold dialog (Shift-Ctrl-T) and select your values
5) click Apply

The corresponding Java commands are now shown in the recorder window.

Cheers
~Niko

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IJ.run("Threshold...")

gadea
Hello!

it's perfect! thanks to all!

Sincerely,

Gadea
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IJ.run("Threshold...")

LIM Soon Yew John (IMB)
In reply to this post by Volker Baecker
Hi Gadea,

You can set the macro recorder to record as plugin. Please see attached image.

Below are the output from the recorder when it was set to record "Plugin":
IJ.setAutoThreshold(imp,"Huang");
IJ.run(imp, "Convert to Mask", "");

Best Regards,
John

________________________________________
From: ImageJ Interest Group [[hidden email]] On Behalf Of Volker Baecker [[hidden email]]
Sent: Tuesday, June 26, 2012 10:31 PM
To: [hidden email]
Subject: Re: Problem with IJ.run("Threshold...")

Hello,
try

setAutoThreshold("Huang");
run("Convert to Mask");

You can use the macro recorder to find out how to apply macro commands
(menu Plugins>Macros>Record)

Volker
On 26/06/12 16:06, gadea wrote:

> Hello, I'm developing a plugin, and I need to use the method Huang for
> thresholding. But when I try doing:
>
> IJ.run("Threshold...", "Huang Apply")
>
> nothing, the window is open but the method it isn't runned.
>
> I have tried with:
>
> IJ.run("Threshold...", "method='Huang'")
> IJ.run("Threshold...", "threshold='Huang'")
> and IJ.run("Threshold","Huang'") too, but nothing.
>
> I hope you can help me.
>
> Thanks in advance!
>
> Gadea
>
>
> --
> View this message in context: http://imagej.1557.n6.nabble.com/Problem-with-IJ-run-Threshold-tp4999217.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> 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

Recorder.jpg (45K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem with IJ.run("Threshold...")

mikka7
In reply to this post by gadea
Hi, gadea, try just:

run("Threshold", "Huang")

Mikka