// This is a set of tools similar to the pencil, paintbrush and // eraser tools in NIH Image. The pencil and paintbrush draw // in the current foreground color and the eraser draws in the // current background color. Hold down the alt key to have the // pencil and paintbrush draw in the background color. The // foreground and background colors can be set by double- // clicking on the eye dropper tool. Double-click on a tool icon // to set the drawing width. // // Rename as "StartupMacros.txt" and move to the macros folder // to have these tools automatically loaded when ImageJ starts. // // The icons were contributed by Tony Collins. var pencilWidth=1, leftClick=16, alt=8, ctrl=2, shift=1; var floodType="8-connected"; //var floodType = call("ij.Prefs.get", "startup.flood", "8-connected"); var GLlut=0; var lutdir=getDirectory("startup")+"luts"+File.separator; var list = getFileList(lutdir); macro "AutoRun" { // My defaults // G. Landini at bham. ac. uk //if ((getInfo("os.name")=="Linux") && (parseFloat(substring(getInfo("java.version"),0,3))<1.6)) //run("Menu Font", "menufontsize=15 bold"); run("About ImageJ..."); selectWindow("About ImageJ"); run("Line Width...", "line=1"); run("Wand Tool...", "mode=8-connected tolerance=0"); run("Profile Plot Options...", "width=400 height=400 minimum=0 maximum=0"); run("Point Tool...", "mark=0"); run("Colors...", "foreground=white background=black selection=yellow"); run("Appearance...", "cancel menu=14 16-bit=Automatic"); run("Conversions...", "scale weighted"); run("Misc...", "divide=Infinity antialiased_text antialiased_tool use"); run("Options...", "iterations=1 black pad edm=Overwrite count=1"); run("Input/Output...", "jpeg=75 gif=-1 file=.xls use save_column"); setPasteMode("Copy"); wait(500); snapshot(); for (i=0;i<200;i+=5){ reset(); selectWindow("About ImageJ"); setMinAndMax(i, 200+i); wait(10); } run("8-bit"); setThreshold(127, 255); run("Threshold", "thresholded remaining"); //so from now on thresholds in white run("Enhance Contrast", "saturated=0"); run("Close"); } //macro "Unused Tool-1 - " {} // leave slot between text tool and magnifying glass unused //macro "Unused Tool-2 - " {} // leave slot between dropper and pencil unused //macro "Run... Tool - Cf00o11eeC000O11ee" {} // run Record or Compile // // macro "Run... Tool Selected" { // requires("1.34j"); // //run("Record... "); // run("Compile and Run...") ; // restorePreviousTool(); // } // macro "Pencil Tool - C037L494fL4990L90b0Lc1c3L82a4Lb58bL7c4fDb4L5a5dL6b6cD7b" { // getCursorLoc(x, y, z, flags); // if (flags&alt!=0) // setColorToBackgound(); // draw(pencilWidth); // } var sCmds = newMenu("Stacks Menu Tool", newArray("Add Slice", "Delete Slice", "Next Slice [>]", "Previous Slice [<]", "Set Slice...", "-", "Convert Images to Stack", "Convert Stack to Images", "Make Montage...", "Reslice [/]...", "Z Project...", "3D Project...", "Plot Z-axis Profile", "-", "Start Animation", "Stop Animation", "Animation Options...","-", "MRI Stack (528K)")); macro "Stacks Menu Tool - C037T0b11ST8b09tTcb09k" { cmd = getArgument(); if (cmd!="-") run(cmd); } var dCmds = newMenu("Developer Menu Tool", newArray("ImageJ Website","News", "ImageJ Wiki", "Resources", "Macro Language", "Macros", "Macro Functions", "Startup Macros...", "Plugins", "Source Code", "List Archives", "-", "Record...", "Capture Screen ", "Monitor Memory...", "List Commands...", "Control Panel...", "Search...", "Debug Mode")); macro "Developer Menu Tool - C037T0b11DT7b09eTcb09v" { cmd = getArgument(); if (cmd=="ImageJ Website") run("URL...", "url=http://rsbweb.nih.gov/ij/"); else if (cmd=="News") run("URL...", "url=http://rsbweb.nih.gov/ij/notes.html"); else if (cmd=="ImageJ Wiki") run("URL...", "url=http://imagejdocu.tudor.lu/imagej-documentation-wiki/"); else if (cmd=="Resources") run("URL...", "url=http://rsbweb.nih.gov/ij/developer/"); else if (cmd=="Macro Language") run("URL...", "url=http://rsbweb.nih.gov/ij/developer/macro/macros.html"); else if (cmd=="Macros") run("URL...", "url=http://rsbweb.nih.gov/ij/macros/"); else if (cmd=="Macro Functions") run("URL...", "url=http://rsbweb.nih.gov/ij/developer/macro/functions.html"); else if (cmd=="Plugins") run("URL...", "url=http://rsbweb.nih.gov/ij/plugins/"); else if (cmd=="Source Code") run("URL...", "url=http://rsbweb.nih.gov/ij/developer/source/"); else if (cmd=="List Archives") run("URL...", "url=https://list.nih.gov/archives/imagej.html"); else if (cmd=="Debug Mode") setOption("DebugMode", true); else if (cmd!="-") run(cmd); } var pmCmds = newMenu("Popup Menu", newArray("Undo", "Create Selection", "Restore Selection","Select None","-", "Cut", "Copy", "Paste", "-", "Clear", "Fill", "Draw", "-", "Rename...", "Duplicate...", "Crop", "-", "8-bit", "RGB Color", "RGB Stack", "HSB Stack", "-","Help..." )); macro "Popup Menu" { cmd = getArgument(); if (cmd=="Help...") showMessage("About Popup Menu", "To customize this menu, edit the line that starts with\n"+ "\"var pmCmds\" in ImageJ/macros/StartupMacros.txt."); else run(cmd); } macro "Brush Built-in Tool" {} macro "Flood Fill Tool -C000B21P085373b75d0L4d1aL3135L4050L6166D57D77D68D09D94Ce00La5adLb6bc" { requires("1.37e"); getCursorLoc(x, y, z, flags); if (flags&ctrl!=0){ c= getPixel(x,y); if (bitDepth()==24) setForegroundColor(c&0xff0000>>16, c&0x00ff00>>8, c&0x0000ff); else setForegroundColor(c, c, c); wait(50); } else{ setupUndo(); //getCursorLoc(x, y, z, flags); if (flags&alt!=0) setColor(getValue("color.background")); floodFill(x, y, floodType); } } // ImageJ runs this macro when user double-clicks on the flood tool icon macro "Flood Fill Tool Options..." { Dialog.create("Flood Fill Tool"); Dialog.addChoice("Flood Type:", newArray("4-connected", "8-connected"), floodType); Dialog.show(); floodType = Dialog.getChoice(); //call("ij.Prefs.set", "startup.flood", floodType); } // ****************** action tools ***************************** macro "Look Up Tables Action Tool - C900L222e Cf00L323e Cf90L424e Cfd0L525e Cff3L626e Cce4L727e C4f0L828e C3ecL929e C5cdLa2ae C79fLb2be C77fLc2ce Cb6fLd2de CfafLe2ee CfefLf2fe C000R11fe"{ if (!File.exists(lutdir) || list.length<1){ showMessage("No LUTs in the \'\/Image\/luts\' folder.\nThe LUT Tool will not work."); return; } if (isKeyDown("alt")) GLlut=0; else if (isKeyDown("shift")) GLlut-=1; else GLlut+=1; if (GLlut<0) GLlut=list.length-1; if (GLlut>list.length-1) GLlut=0; if (bitDepth()!=24) run("LUT... ", "open=["+lutdir+list[GLlut]+"]"); wait(20); restorePreviousTool(); showStatus(list[GLlut]); } macro "Threshold Action Tool - Cfffo22ccC000L838dL939dLa3adLb4bcLc5cbLd6daO22cc" { requires("1.34j"); if (bitDepth()==24) run("Threshold Colour"); else run("Threshold..."); } macro "Brightness/Contrast Action Tool - Cfffo22ccCeeeL444bCdddL535cCcccL626dCbbbL727dCaaaL828dC999L939dC888La3adC777Lb4bcC666Lc5cbC555Ld6daC000O22cc" { requires("1.34j"); run("Brightness/Contrast..."); }