Login  Register

how to call image calculator in a plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

how to call image calculator in a plugin

jvander
I am not a java programmer but I am using the plugins -> macro -> record approach to creating and compiling plugins.  I have used this approach successfully in the past for various functions.  I am having trouble calling the image calculator. I have reduced the program to just calling image calculator and multiplying two existing images together.  Below is the java that is generated followed by the error.  My guess is that I need to specify a type for ic when it is introduced in the code below.  Can someone give me a tip to get past this hurdle?  Thanks

Joe v.

here is the java that is generated by compile and run

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.plugin.frame.*;

public class image_calc_only implements PlugIn {

        public void run(String arg) {
                ImagePlus imp1 = IJ.getImage();
               ImagePlus imp2 = IJ.getImage();
                ImagePlus imp3 = IJ.getImage();
                ic = new ImageCalculator();
                imp3 = ic.run("Multiply create 32-bit", imp1, imp2);
        }

}

Here are the errors.    

/Applications/ImageJ/plugins/myplugins/image_calc_only.java:14: cannot find symbol
symbol  : variable ic
location: class image_calc_only
                ic = new ImageCalculator();
                ^
/Applications/ImageJ/plugins/myplugins/image_calc_only.java:15: cannot find symbol
symbol  : variable ic
location: class image_calc_only
                imp3 = ic.run("Multiply create 32-bit", imp1, imp2);
                       ^
2 errors

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

Re: how to call image calculator in a plugin

Rob van 't Hof-2
Hi Joe,
You need to declare what type of variable the "ic" is, so line becomes:

ImageCalculator ic = new ImageCalculator();

it should work now.

bye,
Rob


On 13/02/2013 20:16, Joe Vandergracht wrote:

> I am not a java programmer but I am using the plugins -> macro -> record approach to creating and compiling plugins.  I have used this approach successfully in the past for various functions.  I am having trouble calling the image calculator. I have reduced the program to just calling image calculator and multiplying two existing images together.  Below is the java that is generated followed by the error.  My guess is that I need to specify a type for ic when it is introduced in the code below.  Can someone give me a tip to get past this hurdle?  Thanks
>
> Joe v.
>
> here is the java that is generated by compile and run
>
> import ij.*;
> import ij.process.*;
> import ij.gui.*;
> import java.awt.*;
> import ij.plugin.*;
> import ij.plugin.frame.*;
>
> public class image_calc_only implements PlugIn {
>
> public void run(String arg) {
> ImagePlus imp1 = IJ.getImage();
>                 ImagePlus imp2 = IJ.getImage();
>                  ImagePlus imp3 = IJ.getImage();
> ic = new ImageCalculator();
> imp3 = ic.run("Multiply create 32-bit", imp1, imp2);
> }
>
> }
>
> Here are the errors.
>
> /Applications/ImageJ/plugins/myplugins/image_calc_only.java:14: cannot find symbol
> symbol  : variable ic
> location: class image_calc_only
> ic = new ImageCalculator();
> ^
> /Applications/ImageJ/plugins/myplugins/image_calc_only.java:15: cannot find symbol
> symbol  : variable ic
> location: class image_calc_only
> imp3 = ic.run("Multiply create 32-bit", imp1, imp2);
>       ^
> 2 errors
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
_____________________________
Dr. Rob van 't Hof
Reader

Centre for Molecular Medicine
MRC IGMM
University of Edinburgh
Western General Hospital
Crewe Road, Edinburgh EH4 2XU
United Kingdom

Phone: (+44)-131-6511031
email: [hidden email]
_____________________________

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