var lut = -1; var lutdir = getDirectory("startup")+"luts"+File.separator; var list; var color = 0; var colors = newArray("Red", "Green", "Blue", "Cyan", "Magenta", "Yellow"); var luts = getLutMenu(); var lCmds = newMenu("LUT Menu Tool", luts); macro "LUT Menu Tool - C037T0b11LT6b09UTcb09T" { cmd = getArgument(); if (cmd!="-") run(cmd); } function getLutMenu() { list = getLutList(); menu = newArray(16+list.length); menu[0] = "Invert LUT"; menu[1] = "Apply LUT"; menu[2] = "-"; menu[3] = "Fire"; menu[4] = "Grays"; menu[5] = "Ice"; menu[6] = "Spectrum"; menu[7] = "3-3-2 RGB"; menu[8] = "Red"; menu[9] = "Green"; menu[10] = "Blue"; menu[11] = "Cyan"; menu[12] = "Magenta"; menu[13] = "Yellow"; menu[14] = "Red/Green"; menu[15] = "-"; for (i=0; i" { cycleLUTs(1); } macro "Invert LUT Action Tool - C037R12ccL12cc" { run("Invert LUT"); } // Based on the LUTFileTool by Gabriel Landini function cycleLUTs(inc) { if (lut==-1) createLutList(); if (nImages==0) { call("ij.gui.ImageWindow.centerNextImage"); newImage("LUT", "8-bit ramp", 256, 32, 1); } if (bitDepth==24) exit("RGB images do not have LUTs"); if (isKeyDown("alt")) lut = 0; else lut += inc; if (lut<0) lut = list.length-1; if (lut>list.length-1) lut = 0; name = list[lut]; run("LUT... ", "open=["+lutdir+name+"]"); name = substring(name, 0, lengthOf(name)-4); if (getWidth==256 && getHeight==32) rename(name); showStatus((lut+1) + ". " + name); } function createLutList() { err = "No LUTs in the '/ImageJ/luts' folder"; if (!File.exists(lutdir)) exit(err); rawlist = getFileList(lutdir); if (rawlist.length==0) exit(err); count = 0; for (i=0; i< rawlist.length; i++) { if (endsWith(rawlist[i], ".lut")) count++; } if (count==0) exit(err); list = newArray(count); index = 0; for (i=0; i< rawlist.length; i++) { if (endsWith(rawlist[i], ".lut")) list[index++] = rawlist[i]; } } macro "Generate Icon String" { colors = 9; getLut(reds, greens, blues); str = ""; for (i=0; i