001/******************************************************************************* 002 * This software is provided as a supplement to the authors' textbooks on digital 003 * image processing published by Springer-Verlag in various languages and editions. 004 * Permission to use and distribute this software is granted under the BSD 2-Clause 005 * "Simplified" License (see http://opensource.org/licenses/BSD-2-Clause). 006 * Copyright (c) 2006-2023 Wilhelm Burger, Mark J. Burge. All rights reserved. 007 * Visit https://imagingbook.com for additional details. 008 ******************************************************************************/ 009package ImageJ_Demos; 010 011import ij.IJ; 012import ij.ImagePlus; 013import ij.plugin.PlugIn; 014import imagingbook.core.jdoc.JavaDocHelp; 015 016/** 017 * This plugin demonstrates how to run another ImageJ "command" (plugin) from our own PlugIn using the IJ.run() method. 018 * 019 * @author WB 020 */ 021public class Run_Command_From_PlugIn implements PlugIn, JavaDocHelp { 022 023 public void run(String args) { 024 ImagePlus im = IJ.getImage(); 025 IJ.run(im, "Invert", ""); // run the "Invert" command on im 026 // IJ.run("Invert"); // alternatively, run "Invert" on the current image 027 } 028}