Login  Register

Re: Run macros/commands in Plugin

Posted by mia589 on Aug 19, 2014; 5:43pm
URL: http://imagej.273.s1.nabble.com/Run-macros-commands-in-Plugin-tp5000744p5009272.html

Hi Jan,

Thanks for your reply.

I have also tried your suggested approach of specifying the ImagePlus with no luck. 

With regards to macro recording, would it be possible to record a sequence and then call that sequence using a java command in the plugin code?

I'm trying to create a plugin for imageJ as part of my project and I'm using the Eclipse IDE. I've coupled the ImageJ jar file and source code to the Eclipse build path library. 

If you have any other suggestions I would be extremely grateful.

Many thanks!

On 19 Aug 2014, at 18:34, "gankaku [via ImageJ]" <[hidden email]> wrote:

Hi Mia,

Your first problem might be related the activation of an image. For simple
IJ-functions it is best and easiest if you record your commands with the
Macro Recorder (>Plugins >Macros > Record...).
Therefore, you need to select "Java" from the dropdown menu to not record
it in the IJ macro language.

In your first case, I would expect something like this:
IJ.run(imp, "Enhance Contrast...", "saturated=0 normalize");

the "imp" makes sure that the enhancement is applied to the ImagePlus you
really want to apply it, so you need to specify the correct one.

The same is true for the "Despeckle" command and so on.
IJ.run(imp, "Despeckle", "");

This might solve the problem.
If you are more familiar with Java you can also implement it directly by
using the respective methods (http://rsbweb.nih.gov/ij/developer/api/).

I can unfortunately not comment on your second "Class not found" problem at
the moment.

Kind regards,
Jan




2014-08-19 17:17 GMT+02:00 mia589 <[hidden email]>:

> Hi,
>
> I was wondering if someone can help with a related problem.
>
> I've been trying to implement the IJ.run() command in my ImageJ plugin to
> call upon some ImageJ functions.
> However, it doesn't seem to work even though the syntax of my code is
> correct. When I write the following code to enhance contrast, the IJ.run()
> command works:
>
> IJ.run("Enhance Contrast");
>
> But when I want to run a denoising command "Despeckle" or use a "Median..."
> filter the code doesn't initiate any processes. I am writing the code for
> these as follows:
>
> IJ.run("Despeckle");
> IJ.run("Median...");
>
> Similarly, I am also having trouble using the IJ.runPlugIn() command where
> I
> get the error message "Class not found" even though the target PlugIn class
> is in the ImageJ plugin directory.
>
> Your advice would be most appreciated!
> Thank you!
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Run-macros-commands-in-Plugin-tp5000744p5009268.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>


--

CEO: Dr. rer. nat. Jan Brocher
phone:  +49 (0)6234 917 03 39
mobile: +49 (0)176 705 746 81
e-mail: [hidden email]
info: [hidden email]
inquiries: [hidden email]
web: www.biovoxxel.de

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



If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/Run-macros-commands-in-Plugin-tp5000744p5009270.html
To unsubscribe from Run macros/commands in Plugin, click here.
NAML