Adding icons with functions in the toolbar

imagej
macro
tool

#1

Hi ,
I am trying to add a customized tool to the toolbar of image J. I finding it bit difficult to install the code or to create a tool either. installing the plugin saved in the macro folder is not working. i have attached the program here. Kindly help me with adding that macro program into the toolbar as an icon by suggesting relevant alterations to be made. :slight_smile:

makeRectangle(0, 0, 2048, 2052);
run("Crop");
run("Set Scale...", "distance=612 known=80 unit=unit global");
run("Select All");
run("Copy");
run("Add Slice");
run("Paste");
run("Invert", "slice");
setAutoThreshold("Default");
run("Convert to Mask", "method=Default background=Light calculate");
run("Remove Outliers...", "radius=2 threshold=50 which=Bright stack");
run("Remove Outliers...", "radius=2 threshold=50 which=Dark stack");
Stack.setFrame(1);
Stack.setSlice(1);
run("Analyze Particles...", "  show=[Overlay Outlines] display clear summarize in_situ stack");

#2

Just wrap it in a macro keyword and install it (or put it in the Macros/StartupMacros.ijm file):

 macro "Sample Tool - C0a0L18f8L818f" {
       getCursorLoc(x, y, z, flags);
       print("Sample: "+x+" "+y);
  }

More details about customizations can be found here:

https://imagej.nih.gov/ij/developer/macro/macros.html