Package ij.plugin

Class ImageCalculator

  • All Implemented Interfaces:
    PlugIn

    public class ImageCalculator
    extends java.lang.Object
    implements PlugIn
    This plugin implements the Process/Image Calculator command.
       // test script
       imp1 = IJ.openImage("http://imagej.nih.gov/ij/images/boats.gif")
       imp2 = IJ.openImage("http://imagej.nih.gov/ij/images/bridge.gif")
       ic = new ImageCalculator()
       imp3 = ic.run("Average create", imp1, imp2)
       imp3.show()
    
    • Constructor Summary

      Constructors 
      Constructor Description
      ImageCalculator()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void calculate​(java.lang.String options, ImagePlus img1, ImagePlus img2)
      Deprecated.
      replaced by run(String,ImagePlus,ImagePlus)
      static ImagePlus run​(ImagePlus img1, ImagePlus img2, java.lang.String options)
      Performs arithmetic options on two images where the 'options' argument ("add","subtract", "multiply","divide", "and", "or", "xor", "min", "max", "average", "difference" or "copy") specifies the operation.
      void run​(java.lang.String arg)
      This method is called when the plugin is loaded.
      ImagePlus run​(java.lang.String options, ImagePlus img1, ImagePlus img2)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ImageCalculator

        public ImageCalculator()
    • Method Detail

      • run

        public void run​(java.lang.String arg)
        Description copied from interface: PlugIn
        This method is called when the plugin is loaded. 'arg', which may be blank, is the argument specified for this plugin in IJ_Props.txt.
        Specified by:
        run in interface PlugIn
      • run

        public static ImagePlus run​(ImagePlus img1,
                                    ImagePlus img2,
                                    java.lang.String options)
        Performs arithmetic options on two images where the 'options' argument ("add","subtract", "multiply","divide", "and", "or", "xor", "min", "max", "average", "difference" or "copy") specifies the operation. The 'options' string can include up to three modifiers: "create" (e.g., "add create") causes the result to be stored in a new window, "32-bit" causes the result to be 32-bit floating-point and "stack" causes the entire stack to be processed. For example
                        imp3 = ImageCalculator.run(imp1, imp2, "divide create 32-bit");
                        
        divides 'imp1' by 'imp2' and returns the result as a new 32-bit image.
      • calculate

        public void calculate​(java.lang.String options,
                              ImagePlus img1,
                              ImagePlus img2)
        Deprecated.
        replaced by run(String,ImagePlus,ImagePlus)