### Get Examples Menu Source: https://imagej.net/ij/developer/api/ij/ij/Menus.html Retrieves the 'Examples' menu with an associated action listener. ```APIDOC ## GET /api/menus/getExamplesMenu ### Description Retrieves the 'Examples' menu with an associated action listener. ### Method GET ### Endpoint /api/menus/getExamplesMenu ### Parameters #### Query Parameters - **listener** (string) - Required - Identifier for the ActionListener to associate with the menu items. ### Request Example ``` GET /api/menus/getExamplesMenu?listener=myActionListener ``` ### Response #### Success Response (200) - **menu** (object) - An object representing the 'Examples' menu. #### Response Example ```json { "menu": { "name": "Examples", "items": [ "Example 1", "Example 2" ] } } ``` ``` -------------------------------- ### Get ImageJ Examples Menu Source: https://imagej.net/ij/developer/api/ij/ij/Menus.html Retrieves the 'Examples' menu with an associated action listener. ```java public static java.awt.Menu getExamplesMenu​(java.awt.event.ActionListener listener) ``` -------------------------------- ### Tool Management and Configuration Source: https://imagej.net/ij/developer/api/ij/ij/gui/Toolbar.html API methods for installing startup tools, getting the number of tools, and configuring tool behavior. ```APIDOC ## installStartupMacrosTools ### Description Installs startup macros and tools. ### Method public static boolean installStartupMacrosTools() ### Endpoint N/A (Static method) ### Parameters None ### Request Example None ### Response - **boolean** - True if installation was successful, false otherwise. ### Response Example ``` true ``` ## getNumTools ### Description Retrieves the current number of tools available. ### Method public int getNumTools() ### Endpoint N/A (Instance method, context dependent) ### Parameters None ### Request Example None ### Response - **int** - The number of tools. ### Response Example ``` 5 ``` ## setLongClickDelay ### Description Sets the tool menu long click delay in milliseconds. A delay of 0 disables long click triggering. ### Method public static void setLongClickDelay(int delay) ### Endpoint N/A (Static method) ### Parameters - **delay** (int) - The delay in milliseconds. Set to 0 to disable. ### Request Example ```json { "delay": 600 } ``` ### Response None (void method) ### Response Example None ## setIcon ### Description Sets the icon of the specified macro or plugin tool. Refer to Help > Examples > Tool > Animated Icon Tool for usage examples. ### Method public static void setIcon(String toolName, String icon) ### Endpoint N/A (Static method) ### Parameters - **toolName** (String) - The name of the tool whose icon needs to be set. - **icon** (String) - The icon to set for the tool. This is typically a path to an icon file or a base64 encoded string. ### Request Example ```json { "toolName": "MyMacroTool", "icon": "path/to/my/icon.png" } ``` ### Response None (void method) ### Response Example None ``` -------------------------------- ### Install Startup Macros Tools Source: https://imagej.net/ij/developer/api/ij/ij/gui/Toolbar.html Installs startup macros tools. ```java public static boolean installStartupMacrosTools() ``` -------------------------------- ### setup Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/Binary.html Details of the setup method for the Binary plugin, used for filter initialization. ```APIDOC ## setup(java.lang.String arg, ImagePlus imp) ### Description This method is called once when the filter is loaded. It should return a flag word specifying the filter's capabilities. If `PlugInFilter.FINAL_PROCESSING` is set, `setup` will be called again with `arg = "final"` after all other processing. ### Method `public int setup(java.lang.String arg, ImagePlus imp)` ### Parameters * **arg** (string) - The argument specified for this plugin in configuration files. * **imp** (ImagePlus) - The currently active image. ### Returns A flag word indicating the filter's capabilities (e.g., `PlugInFilter.DOES_8G`, `PlugInFilter.KEEP_THRESHOLD`). ``` -------------------------------- ### PluginInstaller install Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/PluginInstaller.html Installs a plugin from the specified file path. Returns true if the installation was successful, false otherwise. ```java public boolean install (java.lang.String path) ``` -------------------------------- ### setup Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/FFTCustomFilter.html Details on the setup method for the FFTCustomFilter, used for initializing the filter. ```APIDOC ## POST /setup ### Description This method is called once when the filter is loaded. It configures the filter based on the provided arguments and image. ### Method `public int setup(String arg, ImagePlus imp)` ### Parameters - **arg** (String) - Required - The argument specified for this plugin. - **imp** (ImagePlus) - Required - The currently active image. ### Returns - **int** - A flag word specifying the filter's capabilities. For example, `PlugInFilter.FINAL_PROCESSING`. ``` -------------------------------- ### setup Method Source: https://imagej.net/ij/developer/api/ij/ij/gui/HistogramWindow.html Sets up the histogram window. ```java public void setup() ``` -------------------------------- ### Example GenericDialog Usage Source: https://imagej.net/ij/developer/api/ij/ij/gui/GenericDialog.html This example demonstrates how to create and use a GenericDialog to get user input for creating a new image. It includes adding string and numeric fields, showing the dialog, and retrieving the user's input. Ensure component labels are unique for macro compatibility. ```java public class Generic_Dialog_Example implements PlugIn { static String title="Example"; static int width=512,height=512; public void run(String arg) { GenericDialog gd = new GenericDialog("New Image"); gd.addStringField("Title: ", title); gd.addNumericField("Width: ", width, 0); gd.addNumericField("Height: ", height, 0); gd.showDialog(); if (gd.wasCanceled()) return; title = gd.getNextString(); width = (int)gd.getNextNumber(); height = (int)gd.getNextNumber(); IJ.newImage(title, "8-bit", width, height, 1); } } ``` -------------------------------- ### Setup Dialog Source: https://imagej.net/ij/developer/api/ij/ij/gui/GenericDialog.html Protected method for internal dialog setup procedures. ```java protected void setup() ``` -------------------------------- ### Benchmark Plugin Setup Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/Benchmark.html The setup method is called once when the filter is loaded. It receives an argument string and the current ImagePlus object, returning a flag word specifying the filter's capabilities. ```java public int setup​(java.lang.String arg, ImagePlus imp) ``` -------------------------------- ### Info setup Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/Info.html The setup method for the Info plugin. This method is called once when the filter is loaded and is deprecated. It returns a flag word specifying the filter's capabilities. ```java public int setup ( java.lang.String arg, ImagePlus imp) ``` -------------------------------- ### Show Dialog Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/Convolver.html Called after setup to display a dialog for user input. This method is invoked unless the DONE flag is set in the setup method. ```java public int showDialog​(ImagePlus imp, ``` -------------------------------- ### FileInfo_Test Example Source: https://imagej.net/ij/developer/api/ij/ij/io/FileOpener.html An example demonstrating how to use FileInfo and FileOpener to open an image file. This requires setting image dimensions, offset, filename, and directory. ```java public class FileInfo_Test implements PlugIn { public void run(String arg) { FileInfo fi = new FileInfo(); fi.width = 256; fi.height = 254; fi.offset = 768; fi.fileName = "blobs.tif"; fi.directory = "/Users/wayne/Desktop/"; new FileOpener(fi).open(); } } ``` -------------------------------- ### ImageJ Plugin API - Macro Installer Source: https://imagej.net/ij/developer/api/ij/ij/macro/class-use/Program.html API for installing macros as plugins. ```APIDOC ## GET /api/plugins/macroInstaller/program ### Description Retrieves the Program object from the MacroInstaller. ### Method GET ### Endpoint /api/plugins/macroInstaller/program ### Response #### Success Response (200) - **program** (object) - The Program object. #### Response Example { "program": { "type": "Program", "code": "run(\"Hello World\");" } } ``` -------------------------------- ### Install User Plugin Source: https://imagej.net/ij/developer/api/ij/ij/Menus.html Installs a user-defined plugin. ```APIDOC ## POST /api/menus/installUserPlugin ### Description Installs a user-defined plugin. ### Method POST ### Endpoint /api/menus/installUserPlugin ### Parameters #### Request Body - **className** (string) - Required - The fully qualified class name of the plugin. - **force** (boolean) - Optional - If true, forces installation even if the plugin is already present. ### Request Example ```json { "className": "com.example.MyUserPlugin", "force": false } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. #### Response Example ```json { "status": "User plugin installed successfully" } ``` ``` -------------------------------- ### Plugin Filter Setup Methods Source: https://imagej.net/ij/developer/api/ij/ij/class-use/ImagePlus.html Details the `setup` method for various ImageJ plugin filters. This method is typically called once when the filter is loaded. ```APIDOC ## Plugin Filter Setup Methods ### Description Provides information on the `setup` method for various ImageJ plugin filters. This method is generally invoked once upon filter initialization. ### Method `int setup(java.lang.String arg, ImagePlus imp)` ### Endpoints This documentation pertains to methods within different plugin classes, not specific API endpoints. ### Parameters - **arg** (java.lang.String) - Required - An argument string passed to the setup method. - **imp** (ImagePlus) - Required - The ImagePlus object associated with the filter operation. ### Examples ```java Filters.setup(arg, imp); FractalBoxCounter.setup(arg, imp); GaussianBlur.setup(arg, imp); // Method to return types supported ImageMath.setup(arg, imp); ImageProperties.setup(arg, imp); Info.setup(arg, imp); // Deprecated. LineGraphAnalyzer.setup(arg, imp); LutApplier.setup(arg, imp); LutViewer.setup(arg, imp); MaximumFinder.setup(arg, imp); // Method to return types supported ParticleAnalyzer.setup(arg, imp); PlugInFilter.setup(arg, imp); // This method is called once when the filter is loaded. Printer.setup(arg, imp); RankFilters.setup(arg, imp); // Setup of the PlugInFilter. RGBStackSplitter.setup(arg, imp); RoiWriter.setup(arg, imp); Rotator.setup(arg, imp); SaltAndPepper.setup(arg, imp); ScaleDialog.setup(arg, imp); Shadows.setup(arg, imp); StackLabeler.setup(arg, imp); ThresholdToSelection.setup(arg, imp); Transformer.setup(arg, imp); Translator.setup(arg, imp); UnsharpMask.setup(arg, imp); // Method to return types supported Writer.setup(arg, imp); // Deprecated. XYWriter.setup(arg, imp); ``` ``` -------------------------------- ### RoiWriter Setup Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/RoiWriter.html Called once when the filter is loaded. It specifies the filter's capabilities by returning a flag word. The setup method may be called again with arg = "final" for final processing. ```java public int setup​(java.lang.String arg, ImagePlus imp) ``` -------------------------------- ### Start Server - OtherInstance Source: https://imagej.net/ij/developer/api/ij/ij/OtherInstance.html Starts the server for inter-instance communication. This is a static method. ```java public static void startServer() ``` -------------------------------- ### ParticleAnalyzer Constructor Example Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/ParticleAnalyzer.html Example of how to initialize and use the ParticleAnalyzer to analyze particles in an image. Requires opening an image, setting an auto-threshold, creating a ResultsTable, defining analysis options and measurements, and then running the analysis. ```java imp = IJ.openImage("https://imagej.net/images/blobs.gif"); IJ.setAutoThreshold(imp, "Default"); rt = new ResultsTable(); options = ParticleAnalyzer.SHOW_NONE; measurements = Measurements.AREA + Measurements.PERIMETER; pa = new ParticleAnalyzer(options, measurements, rt, 0, Double.MAX_VALUE, 0, 1); pa.analyze(imp); rt.show("Results"); ``` -------------------------------- ### Image Calculator Example with 'divide create 32-bit' Source: https://imagej.net/ij/developer/api/ij/ij/plugin/ImageCalculator.html Example demonstrating how to divide one image by another and return the result as a new 32-bit image. This utilizes the 'create' and '32-bit' modifiers. ```java imp3 = ImageCalculator.run(imp1, imp2, "divide create 32-bit"); ``` -------------------------------- ### Macro Installation Methods Source: https://imagej.net/ij/developer/api/ij/ij/plugin/MacroInstaller.html Methods for installing various types of macros and tools into ImageJ. ```APIDOC ## installStartupMacros ### Description Installs startup macros and runs AutoRun macro on current thread. ### Method void ### Endpoint installStartupMacros(java.lang.String path) ### Parameters #### Path Parameters - **path** (java.lang.String) - Required - The path to the startup macros. ## installTool ### Description Installs a tool into ImageJ. ### Method void ### Endpoint installTool(java.lang.String path) ### Parameters #### Path Parameters - **path** (java.lang.String) - Required - The path to the tool. ## install ### Description Installs a macro set. ### Method int ### Endpoint install(java.lang.String text) ### Parameters #### Path Parameters - **text** (java.lang.String) - Required - The macro content to install. ## install ### Description Installs a macro set with an associated menu. ### Method int ### Endpoint install(java.lang.String text, java.awt.Menu menu) ### Parameters #### Path Parameters - **text** (java.lang.String) - Required - The macro content to install. - **menu** (java.awt.Menu) - Required - The menu to associate with the macro. ## installFile ### Description Installs a macro file. ### Method void ### Endpoint installFile(java.lang.String path) ### Parameters #### Path Parameters - **path** (java.lang.String) - Required - The path to the macro file. ## installLibrary ### Description Installs a macro library. ### Method void ### Endpoint installLibrary(java.lang.String path) ### Parameters #### Path Parameters - **path** (java.lang.String) - Required - The path to the macro library. ## installFromJar ### Description Installs a macro set contained in ij.jar. ### Method static void ### Endpoint installFromJar(java.lang.String path) ### Parameters #### Path Parameters - **path** (java.lang.String) - Required - The path to the ij.jar file. ## installFromIJJar ### Description Installs a macro set contained in ij.jar. ### Method void ### Endpoint installFromIJJar(java.lang.String path) ### Parameters #### Path Parameters - **path** (java.lang.String) - Required - The path to the ij.jar file. ## installSingleTool ### Description Installs a single tool. ### Method void ### Endpoint installSingleTool(java.lang.String text) ### Parameters #### Path Parameters - **text** (java.lang.String) - Required - The tool content to install. ``` -------------------------------- ### ParticleAnalyzer Example Usage Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/ParticleAnalyzer.html Example of how to use the ParticleAnalyzer class. ```APIDOC ## ParticleAnalyzer Example Usage ```javascript imp = IJ.openImage("https://imagej.net/images/blobs.gif"); IJ.setAutoThreshold(imp, "Default"); rt = new ResultsTable(); options = ParticleAnalyzer.SHOW_NONE; measurements = Measurements.AREA + Measurements.PERIMETER; pa = new ParticleAnalyzer(options, measurements, rt, 0, Double.MAX_VALUE, 0, 1); pa.analyze(imp); rt.show("Results"); ``` ``` -------------------------------- ### Display Macro Commands in Plugins Menu Source: https://imagej.net/ij/developer/macro/macros.html Macros with assigned shortcuts, when installed, will appear in the Plugins > Macros submenu. This example shows how 'Macro 1 [a]' and 'Macro 2 [1]' would be listed. ```ImageJ Macro Macro 1 [a] Macro 2 [1] ``` -------------------------------- ### Tool Installation and Management Source: https://imagej.net/ij/developer/api/ij/ij/gui/Toolbar.html Methods for adding, installing, and removing tools from the ImageJ toolbar. ```APIDOC ## addTool ### Description Adds a tool to the toolbar. The 'toolTip' string is displayed in the status bar when the mouse is over the tool icon. The 'toolTip' string may include icon (http://imagej.net/ij/developer/macro/macros.html#tools). Returns the tool ID, or -1 if all tool slots are in use. ### Method `public int addTool(java.lang.String toolTip)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **toolTip** (String) - Required - The tooltip for the tool. ### Request Example None ### Response #### Success Response (200) - **toolId** (int) - The ID of the added tool, or -1 if all slots are in use. ``` ```APIDOC ## addMacroTool ### Description Used by the MacroInstaller class to install a set of macro tools. ### Method `public void addMacroTool(java.lang.String name, MacroInstaller macroInstaller, int id)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **name** (String) - Required - The name of the macro tool. - **macroInstaller** (MacroInstaller) - Required - The MacroInstaller instance. - **id** (int) - Required - The ID of the macro tool. ### Request Example None ### Response None ``` ```APIDOC ## addMacroTool ### Description Used by the MacroInstaller class to add a macro tool to the toolbar. ### Method `public void addMacroTool(java.lang.String name, MacroInstaller macroInstaller)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **name** (String) - Required - The name of the macro tool. - **macroInstaller** (MacroInstaller) - Required - The MacroInstaller instance. ### Request Example None ### Response None ``` ```APIDOC ## removeMacroTools ### Description Removes all macro tools from the toolbar. ### Method `public static void removeMacroTools()` ### Parameters None ### Request Example None ### Response None ``` ```APIDOC ## addPlugInTool ### Description Adds a plugin tool to the first available toolbar slot, or to the last slot if the toolbar is full. ### Method `public static void addPlugInTool(PlugInTool tool)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **tool** (PlugInTool) - Required - The plugin tool to add. ### Request Example None ### Response None ``` ```APIDOC ## getPlugInTool ### Description Retrieves the currently active plugin tool. ### Method `public static PlugInTool getPlugInTool()` ### Parameters None ### Request Example None ### Response #### Success Response (200) - **tool** (PlugInTool) - The active plugin tool. ``` ```APIDOC ## installStartupTools ### Description Installs the startup tools for ImageJ. ### Method `public void installStartupTools()` ### Parameters None ### Request Example None ### Response None ``` ```APIDOC ## showCode ### Description Displays a dialog with the provided code. ### Method `public static void showCode(java.lang.String title, java.lang.String code)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **title** (String) - Required - The title of the dialog window. - **code** (String) - Required - The code to display. ### Request Example None ### Response None ``` -------------------------------- ### PlugInFilter Setup Parameters Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/ImageMath.html Parameters available to the setup method of a PlugInFilter. ```APIDOC ## Setup Parameters for PlugInFilter ### Description Parameters passed to the `setup(arg, imp)` method of a plugin-filter. ### Parameters #### Path Parameters - **imp** (ImagePlus) - The active image passed in the `setup(arg, imp)` call. Can be null if `NO_IMAGE_REQUIRED` flag is set. - **command** (String) - The command that invoked the plugin-filter, useful for dialog titles. - **pfr** (PlugInFilterRunner) - The PlugInFilterRunner calling this plugin-filter. Can be used for preview functionality via `addPreviewCheckbox` and for callbacks to obtain the current slice number. ``` -------------------------------- ### Translator Plugin Setup Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/Translator.html Called once when the filter is loaded. It receives an argument and the active image, returning flags that specify the filter's capabilities. The setup method may be called again for final processing if the FINAL_PROCESSING flag is set. ```java public int setup( java.lang.String arg, ImagePlus imp) ``` -------------------------------- ### Install Plugin Source: https://imagej.net/ij/developer/api/ij/ij/Menus.html Adds a plugin-based command to a specified menu. ```APIDOC ## POST /api/menus/installPlugin ### Description Adds a plugin based command to the end of a specified menu. ### Method POST ### Endpoint /api/menus/installPlugin ### Parameters #### Request Body - **plugin** (string) - Required - The name or path of the plugin. - **menuCode** (char) - Required - A character code representing the menu (e.g., 'P' for Plugins). - **command** (string) - Required - The name of the command to be displayed in the menu. - **shortcut** (string) - Optional - A keyboard shortcut for the command. - **ij** (object) - Required - The ImageJ instance object. ### Request Example ```json { "plugin": "ij.plugin.MyPlugin", "menuCode": "P", "command": "My Plugin Command", "shortcut": "Ctrl+M" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. #### Response Example ```json { "status": "Plugin installed successfully" } ``` ``` -------------------------------- ### Get Plugin Count Source: https://imagej.net/ij/developer/api/ij/ij/Menus.html Returns the number of plugins installed. ```APIDOC ## GET /api/menus/getPluginCount ### Description Returns the number of plugins installed. ### Method GET ### Endpoint /api/menus/getPluginCount ### Response #### Success Response (200) - **pluginCount** (integer) - The total number of plugins. #### Response Example ```json { "pluginCount": 100 } ``` ``` -------------------------------- ### DownsizeTable Example Usage Source: https://imagej.net/ij/developer/api/ij/ij/process/DownsizeTable.html Example demonstrating how to instantiate and use the DownsizeTable for downsizing a row of pixel data. It shows the creation of a DownSizeTable object and a loop for processing source pixels. ```java DownSizeTable dt = new DownsizeTable(width, roi.x, roi.width, destinationWidth, ImageProcessor.BICUBIC); int tablePointer = 0; for (int srcPoint=dt.srcStart, srcPoint<=dt.srcEnd; srcPoint++) { float v = pixels[srcPoint]; for (int i=0; i ``` -------------------------------- ### Image Calculator Plugin Script Example Source: https://imagej.net/ij/developer/api/ij/ij/plugin/ImageCalculator.html Example script demonstrating how to use the ImageCalculator plugin to perform an 'add' operation on two opened images and display the result. Requires images to be opened first. ```javascript // test script imp1 = IJ.openImage("http://imagej.net/ij/images/boats.gif") imp2 = IJ.openImage("http://imagej.net/ij/images/bridge.gif") imp3 = ImageCalculator.run(imp1, imp2, "add create 32-bit"); imp3.show(); ``` -------------------------------- ### Writer Plugin Setup Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/Writer.html The setup method for the Writer plugin. This method is called once when the filter is loaded and is deprecated. It specifies the filter's capabilities. ```java public int setup (java.lang.String arg, ImagePlus imp) ``` -------------------------------- ### setup Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/RankFilters.html Sets up the PlugInFilter and returns flags specifying the filter's capabilities and needs. ```APIDOC ## setup Method ### Description Setup of the PlugInFilter. Returns the flags specifying the capabilities and needs of the filter. ### Method public int setup(java.lang.String arg, ImagePlus imp) ### Endpoint N/A (Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **int** - Flags specifying further action of the PlugInFilterRunner #### Response Example ``` // Example return value (flags) 1 ``` ``` -------------------------------- ### Get Macro Count Source: https://imagej.net/ij/developer/api/ij/ij/Menus.html Returns the number of macros installed. ```APIDOC ## GET /api/menus/getMacroCount ### Description Returns the number of macros installed. ### Method GET ### Endpoint /api/menus/getMacroCount ### Response #### Success Response (200) - **macroCount** (integer) - The total number of macros. #### Response Example ```json { "macroCount": 50 } ``` ``` -------------------------------- ### Get ROIs as Array Source: https://imagej.net/ij/developer/api/ij/ij/plugin/frame/RoiManager.html Returns all ROIs currently in the ROI Manager as an array. No setup is required. ```java public Roi[] getRoisAsArray() ``` -------------------------------- ### Get Selected ROI Count Source: https://imagej.net/ij/developer/api/ij/ij/plugin/frame/RoiManager.html Returns the number of currently selected ROIs. No setup is required. ```java public int selected() ``` -------------------------------- ### Get Plugin Count Source: https://imagej.net/ij/developer/api/ij/ij/Menus.html Returns the total number of plugins currently installed or available in ImageJ. ```java public int getPluginCount() ``` -------------------------------- ### Get ROI Count Source: https://imagej.net/ij/developer/api/ij/ij/plugin/frame/RoiManager.html Returns the total number of ROIs currently in the ROI Manager. No setup is required. ```java public int getCount() ``` -------------------------------- ### SaltAndPepper Setup Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/SaltAndPepper.html Initializes the plugin when it's loaded. It receives an argument string and the active ImagePlus object, returning a flag word specifying filter capabilities. ```java public int setup​( java.lang.String arg, ImagePlus imp) ``` -------------------------------- ### Get Draw Labels Status Source: https://imagej.net/ij/developer/api/ij/ij/plugin/frame/RoiManager.html Checks if ROI labels are currently set to be drawn. No setup is required. ```java public boolean getDrawLabels() ``` -------------------------------- ### Get Raw ROI Manager Instance Source: https://imagej.net/ij/developer/api/ij/ij/plugin/frame/RoiManager.html Returns a raw reference to the ROI Manager instance. No setup is required. ```java public static RoiManager getRawInstance() ``` -------------------------------- ### Get ROI Manager Instance Source: https://imagej.net/ij/developer/api/ij/ij/plugin/frame/RoiManager.html Returns a reference to the ROI Manager. Opens it if it is not already open. No setup is required. ```java public static RoiManager getRoiManager() ``` -------------------------------- ### Setup Dialog Source: https://imagej.net/ij/developer/api/ij/ij/IJ.html Displays a dialog to confirm processing across multiple images. ```APIDOC ## POST /ij/setupDialog ### Description Displays a "Process all images?" dialog to confirm an operation on multiple images. ### Method POST ### Endpoint /ij/setupDialog ### Parameters #### Query Parameters - **imp** (ImagePlus) - Optional - The ImagePlus object associated with the dialog. - **flags** (int) - Optional - Flags that control the dialog's behavior. ### Request Example ```json { "imp": null, "flags": 0 } ``` ### Response #### Success Response (200) - **result** (int) - The user's choice from the dialog. #### Response Example ```json { "result": 0 } ``` ``` -------------------------------- ### Get Selected ROIs as Array Source: https://imagej.net/ij/developer/api/ij/ij/plugin/frame/RoiManager.html Returns the selected ROIs as an array. If no ROIs are selected, it returns all ROIs. No setup is required. ```java public Roi[] getSelectedRoisAsArray() ``` -------------------------------- ### Method: setup Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/MaximumFinder.html Sets up the plugin filter, returning codes that describe supported formats. ```APIDOC ## POST /api/setup ### Description Sets up the plugin filter, returning codes that describe supported formats. ### Method POST ### Endpoint /api/setup ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **arg** (string) - Required - Not used by this plugin-filter - **imp** (ImagePlus) - Required - The image to be filtered ### Request Example ```json { "arg": "some_argument", "imp": "ImagePlus_object" } ``` ### Response #### Success Response (200) - **return_code** (int) - Code describing supported formats etc. (see ij.plugin.filter.PlugInFilter & ExtendedPlugInFilter) #### Response Example ```json { "return_code": 1 } ``` ``` -------------------------------- ### Get ROI by Index Source: https://imagej.net/ij/developer/api/ij/ij/plugin/frame/RoiManager.html Returns a reference to the ROI at the specified index. Returns null if the index is out of range. No setup is required. ```java public Roi getRoi(int index) ``` -------------------------------- ### Retrieve Current Angle in ImageJ Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/Rotator.html A static method to get the current angle value. No specific setup or constraints are mentioned. ```java public static double getAngle() ``` -------------------------------- ### Binary Plugin Setup Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/Binary.html Initializes the filter when loaded by ImageJ. Returns flags indicating filter capabilities. ```java public int setup ( java.lang.String arg, ImagePlus imp) ``` -------------------------------- ### RankFilters.setup Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/RankFilters.html The initial setup method for the PlugInFilter. It receives arguments and the ImagePlus object, and returns flags indicating filter capabilities. ```java int setup​(java.lang.String arg, ImagePlus imp) ``` -------------------------------- ### Get Background Color Source: https://imagej.net/ij/developer/macro/functions.html Returns the background color as a string, for example "cyan" or "#00ffff". ```ImageJ Macro Color.background ``` -------------------------------- ### Get Foreground Color Source: https://imagej.net/ij/developer/macro/functions.html Returns the foreground color as a string, for example "red" or "#ff0000". ```ImageJ Macro Color.foreground ``` -------------------------------- ### ScaleDialog.setup Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/ScaleDialog.html Details the setup method of the ScaleDialog class, which is part of the PlugInFilter interface. ```APIDOC ## Method: setup(String arg, ImagePlus imp) ### Description This method is called once when the filter is loaded. 'arg', which may be blank, is the argument specified for this plugin in IJ_Props.txt or in the plugins.config file of a jar archive containing the plugin. 'imp' is the currently active image. This method should return a flag word that specifies the filters capabilities. For Plugin-filters specifying the `PlugInFilter.FINAL_PROCESSING` flag, the setup method will be called again, this time with arg = "final" after all other processing is done. ### Signature ```java public int setup(String arg, ImagePlus imp) ``` ### Parameters - **arg** (String) - The argument specified for this plugin. - **imp** (ImagePlus) - The currently active image. ### Returns A flag word specifying the filter's capabilities. ``` -------------------------------- ### Get ROI Index by Object Source: https://imagej.net/ij/developer/api/ij/ij/plugin/frame/RoiManager.html Returns the index of a specific ROI object, or -1 if the ROI is not found in the manager. No setup is required. ```java public int getRoiIndex(Roi roi) ``` -------------------------------- ### Instance Method: run() Source: https://imagej.net/ij/developer/api/ij/ij/plugin/LutLoader.html The main method for the LutLoader plugin, responsible for initiating the LUT loading process. ```APIDOC ## Instance Method ### `run(String arg)` - **Description**: If 'arg' is an empty string, this method displays a file open dialog and opens the specified LUT. Otherwise, it processes the argument as a LUT identifier. - **Parameters**: - `arg` (String) - An argument string that can specify the LUT to load or be empty to open a file dialog. - **Returns**: void ``` -------------------------------- ### Get First Selected ROI Index Source: https://imagej.net/ij/developer/api/ij/ij/plugin/frame/RoiManager.html Returns the index of the first selected ROI, or -1 if no ROI is currently selected. No setup is required. ```java public int getSelectedIndex() ``` -------------------------------- ### Get Image Description String Source: https://imagej.net/ij/developer/api/ij/ij/io/FileSaver.html Retrieves a string containing information about the specified image. No specific setup is required beyond having an image object. ```Java public java.lang.String getDescriptionString() ``` -------------------------------- ### Get ImageJ Plugins List Source: https://imagej.net/ij/developer/api/ij/ij/Menus.html Returns a list of the plugins currently available in the ImageJ plugins menu. This is useful for discovering and interacting with installed plugins. ```java public static java.lang.String[] getPlugins() ``` -------------------------------- ### Startup Plugin API Source: https://imagej.net/ij/developer/api/ij/ij/plugin/Startup.html Details of the Startup plugin's constructors and methods. ```APIDOC ## Startup Plugin API ### Description This plugin implements the Edit/Options/Startup command in ImageJ. ### Constructor #### Startup() - Description: Initializes the Startup plugin. ### Methods #### run(String arg) - Description: This method is called when the plugin is loaded. 'arg' may be blank and is the argument specified for this plugin in IJ_Props.txt. - Implements: `PlugIn.run` #### getStartupMacro() - Returns: (String) The startup macro. #### itemStateChanged(ItemEvent e) - Description: Handles item state changes for the plugin. - Implements: `java.awt.event.ItemListener.itemStateChanged` ``` -------------------------------- ### Get LUT by Name Source: https://imagej.net/ij/developer/api/ij/ij/plugin/LutLoader.html Retrieves a LUT by its name as an IndexColorModel. The name must correspond to an entry in the Image/Lookup Tables menu. See HelpExamplesJavaScript/Show all LUTs for examples. ```java public static java.awt.image.IndexColorModel getLut(java.lang.String name) ``` -------------------------------- ### Get Selected Indexes as String (Macro Callable) Source: https://imagej.net/ij/developer/api/ij/ij/plugin/frame/RoiManager.html A macro-callable version of getSelectedIndexes() that returns the selected indexes as a string. Example: indexes=split(call("ij.plugin.frame.RoiManager.getIndexesAsString")); ```Java public static java.lang.String getIndexesAsString() ``` -------------------------------- ### Get Lookup Table Intensities Source: https://imagej.net/ij/developer/macro/functions.html Returns three arrays containing the red, green, and blue intensity values from the current lookup table. See the LookupTables macros for examples. ```ImageJ Macro Color.getLut(reds, greens, blues) ``` -------------------------------- ### FFTCustomFilter setup Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/FFTCustomFilter.html This method is called once when the filter is loaded to configure its capabilities. It returns a flag word specifying the filter's properties and can be called again for final processing. ```java public int setup​(java.lang.String arg, ImagePlus imp) ``` -------------------------------- ### Startup Plugin getStartupMacro() Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/Startup.html Retrieves the startup macro associated with the plugin. ```java public java.lang.String getStartupMacro() ``` -------------------------------- ### Get ROI Manager Instance (Null if Not Exists) Source: https://imagej.net/ij/developer/api/ij/ij/plugin/frame/RoiManager.html Returns a reference to the ROI Manager window or the macro batch mode ROI Manager, or null if neither exists. No setup is required. ```java public static RoiManager getInstance2() ``` -------------------------------- ### Set Key Up Event Source: https://imagej.net/ij/developer/api/ij/ij/IJ.html Simulates a key up event for a specified key. Use with caution. ```java public static void setKeyUp​(int key) ``` -------------------------------- ### Get Font with Fallback Source: https://imagej.net/ij/developer/api/ij/ij/util/FontUtil.html Returns a font with the specified family name, style, and size. If the requested font family is not available, it attempts to return a similar font. For example, Helvetica might be replaced by Arial. ```java public static java.awt.Font getFont(java.lang.String fontFamilyName, int style, float size) ``` -------------------------------- ### Get Look-Up Tables (LUTs) Source: https://imagej.net/ij/developer/api/ij/ij/ImagePlus.html Retrieves the array of Look-Up Tables (LUTs) used by the image, one for each channel. Returns an empty array if the image is RGB. The example shows how to iterate through LUTs and log their min/max values. ```java public LUT[] getLuts() ``` ```javascript luts = imp.getLuts(); for (i=0; iluts.length; i++) IJ.log((i+1)+“: “+luts[i].min+“-“+luts[i].max); ``` -------------------------------- ### Singleton Instance and Command Handling Source: https://imagej.net/ij/developer/api/ij/ij/plugin/frame/SyncWindows.html Methods for obtaining a singleton instance and handling commands. ```APIDOC ## getInstance ### Description Returns the singleton instance of SyncWindows. ### Method public static SyncWindows getInstance() ### Endpoint N/A (Class Method) ### Response Example N/A ``` ```APIDOC ## commandExecuting ### Description Specified by: commandExecuting in interface CommandListener. ### Method public java.lang.String commandExecuting(java.lang.String command) ### Endpoint N/A (Interface Method) ### Parameters - **command** (java.lang.String) - The command being executed. ### Response Example N/A ``` -------------------------------- ### Get Image Statistics - ImageJ Source: https://imagej.net/ij/developer/api/ij/ij/ImagePlus.html Retrieves calibrated statistics for the current image or ROI, including histogram, area, mean, min, max, standard deviation, and mode. This example shows how to log the area, mean, and max values. ```java imp = IJ.getImage(); stats = imp.getStatistics(); IJ.log("Area: "+stats.area); IJ.log("Mean: "+stats.mean); IJ.log("Max: "+stats.max); ``` -------------------------------- ### Install User Plugin Source: https://imagej.net/ij/developer/api/ij/ij/Menus.html Installs a user-defined plugin into ImageJ. The 'force' parameter can be used to override existing installations. ```java public void installUserPlugin​(java.lang.String className, boolean force) ``` -------------------------------- ### setup Method for PlugInFilter Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/XYWriter.html This method is called once when the filter is loaded. It receives an argument string and the active ImagePlus object. It should return a flag word specifying the filter's capabilities. The setup method may be called again with 'final' as the argument after all other processing is done if PlugInFilter.FINAL_PROCESSING is set. ```java public int setup(java.lang.String arg, ImagePlus imp) ``` -------------------------------- ### Method: showDialog Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/MaximumFinder.html Displays a dialog for user interaction after setup, unless the DONE flag is set. ```APIDOC ## POST /api/showDialog ### Description Displays a dialog for user interaction after setup, unless the DONE flag is set. This method is called after `setup(arg, imp)` unless the `DONE` flag has been set. ### Method POST ### Endpoint /api/showDialog ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **imp** (ImagePlus) - Required - The active image already passed in the `setup(arg, imp)` call. It will be null, however, if the `NO_IMAGE_REQUIRED` flag has been set. - **command** (string) - Required - The command that has led to the invocation of the plugin-filter. Useful as a title for the dialog. - **pfr** (PlugInFilterRunner) - Required - The PlugInFilterRunner calling this plugin-filter. It can be passed to a GenericDialog by `addPreviewCheckbox` to enable preview by calling the `run(ip)` method of this plugin-filter. `pfr` can be also used later for calling back the PlugInFilterRunner, e.g., to obtain the slice number currently processed by `run(ip)`. ### Request Example ```json { "imp": "ImagePlus_object", "command": "Find Maxima", "pfr": "PlugInFilterRunner_object" } ``` ### Response #### Success Response (200) - **flags** (int) - A combination (bitwise OR) of the flags specified in interfaces `PlugInFilter` and `ExtendedPlugInFilter`. #### Response Example ```json { "flags": 1 } ``` ``` -------------------------------- ### MacroInstaller Methods Source: https://imagej.net/ij/developer/api/ij/ij/plugin/MacroInstaller.html Documentation for the various methods available in the MacroInstaller class for installing and managing macros. ```APIDOC ## Methods ### actionPerformed(java.awt.event.ActionEvent evt) - Description: Handles action events, typically from UI components. - Modifier: Instance - Return Type: void ### autoRun() - Description: Runs the StartupMacros AutoRun macro on the current thread. - Modifier: Static - Return Type: void ### getFileName() - Description: Retrieves the name of the currently processed macro file. - Modifier: Static - Return Type: java.lang.String ### getMacroCount() - Description: Returns the number of macros currently installed or processed. - Modifier: Instance - Return Type: int ### getProgram() - Description: Retrieves the macro program associated with this installer instance. - Modifier: Instance - Return Type: Program ### install(java.lang.String text) - Description: Installs a macro from the provided text. - Modifier: Instance - Parameters: - text (java.lang.String) - The macro code as a string. - Return Type: int - The number of macros installed. ### install(java.lang.String text, java.awt.Menu menu) - Description: Installs a macro from the provided text into a specific menu. - Modifier: Instance - Parameters: - text (java.lang.String) - The macro code as a string. - menu (java.awt.Menu) - The menu to which the macro should be added. - Return Type: int - The number of macros installed. ### installFile(java.lang.String path) - Description: Installs macros from a file specified by its path. - Modifier: Instance - Parameters: - path (java.lang.String) - The file path to the macro file. - Return Type: void ### installFromIJJar(java.lang.String path) - Description: Installs a macro set contained within the ij.jar file, specified by its path. - Modifier: Instance - Parameters: - path (java.lang.String) - The path to the macro set within ij.jar. - Return Type: void ### installFromJar(java.lang.String path) - Description: Installs a macro set contained within a JAR file, specified by its path. - Modifier: Static - Parameters: - path (java.lang.String) - The file path to the JAR file containing the macro set. - Return Type: void ### installLibrary(java.lang.String path) - Description: Installs a macro library from the specified file path. - Modifier: Instance - Parameters: - path (java.lang.String) - The file path to the macro library. - Return Type: void ### installSingleTool(java.lang.String text) - Description: Installs a single macro as a tool from the provided text. - Modifier: Instance - Parameters: - text (java.lang.String) - The macro code as a string. - Return Type: void ``` -------------------------------- ### Open Folder as Stack (Instance Method) Source: https://imagej.net/ij/developer/api/ij/ij/plugin/FolderOpener.html Opens images in the specified directory as a stack using an instance method. Displays directory chooser and options dialogs if the path is null. ```java public ImagePlus openFolder(java.lang.String path) ``` -------------------------------- ### Open Folder as Stack (Simple) Source: https://imagej.net/ij/developer/api/ij/ij/plugin/FolderOpener.html Opens images in a directory as a stack. Displays a directory chooser and options dialog if the path is null. ```java public static ImagePlus open(java.lang.String path) ``` -------------------------------- ### Undo Setup Method Source: https://imagej.net/ij/developer/api/ij/ij/Undo.html Sets up the undo mechanism for a given operation type and image. ```java public static void setup( int what, ImagePlus imp) ``` -------------------------------- ### ImageMath showDialog Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/ImageMath.html This method is called after setup(arg, imp) unless the DONE flag has been set. It is used to display the plugin's dialog. ```java publicintshowDialog( ImagePlusimp, java.lang.Stringcommand, PlugInFilterRunnerpfr) ``` -------------------------------- ### MacroInstaller Class Overview Source: https://imagej.net/ij/developer/api/ij/ij/plugin/MacroInstaller.html Provides an overview of the MacroInstaller class, its purpose, and inherited interfaces. ```APIDOC ## MacroInstaller Class This plugin implements the Plugins/Macros/Install Macros command. It is also used by the Editor class to install macros in menus and by the ImageJ class to install macros at startup. ### Implemented Interfaces - `MacroConstants` - `PlugIn` - `java.awt.event.ActionListener` - `java.util.EventListener` ### Fields inherited from interface ij.macro.MacroConstants [List of constants available from MacroConstants interface] ``` -------------------------------- ### JavaScript Example: Populate and Show ResultsTable Source: https://imagej.net/ij/developer/api/ij/ij/measure/ResultsTable.html Demonstrates creating a ResultsTable, adding rows and values for 'n', 'Sine(n)', and 'Cos(n)', and then displaying the table with a specified title. ```javascript rt = new ResultsTable(); for (n=0; n<=2*Math.PI; n+=0.1) { rt.addRow(); rt.addValue("n", n); rt.addValue("Sine(n)", Math.sin(n)); rt.addValue("Cos(n)", Math.cos(n)); } rt.show("Sine/Cosine Table"); ``` -------------------------------- ### Get Toolbar Instance Source: https://imagej.net/ij/developer/api/ij/ij/gui/class-use/Toolbar.html This snippet shows how to get a reference to the ImageJ toolbar instance. ```APIDOC ## Get Toolbar Instance ### Description Returns a reference to the ImageJ toolbar. ### Method `static Toolbar` ### Endpoint `Toolbar.getInstance()` ### Parameters None ### Request Example None ### Response #### Success Response (200) - **Toolbar** (Toolbar) - A reference to the ImageJ toolbar instance. #### Response Example ```java Toolbar toolbar = Toolbar.getInstance(); ``` ``` -------------------------------- ### ImageMath setup Method Source: https://imagej.net/ij/developer/api/ij/ij/plugin/filter/ImageMath.html This method is called once when the filter is loaded. It should return a flag word specifying the filter's capabilities. It is called again with arg = "final" after all other processing is done if PlugInFilter.FINAL_PROCESSING is specified. ```java publicintsetup( java.lang.Stringarg, ImagePlusimp) ``` -------------------------------- ### Get Show All Color (Obsolete) Source: https://imagej.net/ij/developer/api/ij/ij/gui/ImageCanvas.html Obsolete static method to get the 'show all' color. ```java public static java.awt.Color getShowAllColor() ``` -------------------------------- ### Install Plugin with Menu Code Source: https://imagej.net/ij/developer/api/ij/ij/Menus.html Installs a plugin into ImageJ and associates it with a specific menu code. ```java public static int installPlugin​(java.lang.String plugin, char menuCode, ``` -------------------------------- ### Open Folder as Stack (with Options) Source: https://imagej.net/ij/developer/api/ij/ij/plugin/FolderOpener.html Opens images in a directory as a stack, with customizable options. Supports virtual stacks, filtering, and image properties like bit depth and scale. Displays the Import/Sequence dialog if the path is null. ```java public static ImagePlus open(java.lang.String path, java.lang.String options) ``` -------------------------------- ### Get ROIs (Deprecated) Source: https://imagej.net/ij/developer/api/ij/ij/plugin/frame/RoiManager.html Deprecated method to get all ROIs. Use getCount() or getRoisAsArray() instead. ```java public java.util.Hashtable getROIs() ``` -------------------------------- ### Get Preferred Size Source: https://imagej.net/ij/developer/api/ij/ij/gui/ProgressBar.html Overrides the getPreferredSize method from java.awt.Component to get the preferred size of the component. ```APIDOC ## getPreferredSize ### Description Overrides the getPreferredSize method from java.awt.Component. ### Method public java.awt.Dimension getPreferredSize() ### Response #### Success Response (200) - **Dimension** (java.awt.Dimension) - The preferred size of the component. ``` -------------------------------- ### StartupRunner run(boolean batchMode) Method Source: https://imagej.net/ij/developer/api/ij/ij/macro/StartupRunner.html Runs the RunAtStartup and AutoRun macros. If batchMode is true, macros run on the current thread; otherwise, they run on a separate thread. ```java public void run​(boolean batchMode) ```