// "Invert all LUTs" // Converts all LUTs in a multi-channel image between // inverted and non inverted and switches the // composite rendering mode accordingly. // !! Only works with linear LUTs (one color). // Author: Kevin Terretaz requires("1.53o"); getDimensions(width, height, channels, slices, frames); REDS = newArray(256); GREENS = newArray(256); BLUES = newArray(256); for (c = 1; c <= channels; c++) { if (is("composite")) Stack.setChannel(c); getLut(reds,greens,blues); RED = reds[255]; GREEN = greens[255]; BLUE = blues[255]; if (is("Inverting LUT")) { for(i=0; i<256; i++) { REDS[i] = (RED/256)*(i+1); GREENS[i] = (GREEN/256)*(i+1); BLUES[i] = (BLUE/256)*(i+1); } setLut(REDS, GREENS, BLUES); if (RED+GREEN+BLUE == 0) { run("Grays"); } } else { //make inverted LUT REDS = newArray(256); GREENS = newArray(256); BLUES = newArray(256); for(i=0; i<256; i++) { REDS[i] = 255-(((255-RED)/256)*i); GREENS[i] = 255-(((255-GREEN)/256)*i); BLUES[i] = 255-(((255-BLUE)/256)*i); } setLut(REDS, GREENS, BLUES); if (RED+GREEN+BLUE == 765) { run("Grays"); run("Invert LUT"); } } } // CompositeProjection mode switch : if (Property.get("CompositeProjection") == "Invert") Property.set("CompositeProjection", "Sum"); else if (Property.get("CompositeProjection") == "Min") Property.set("CompositeProjection", "Max"); else if (Property.get("CompositeProjection") == "Max") Property.set("CompositeProjection", "Min"); else Property.set("CompositeProjection", "Invert"); // if Composite Sum updateDisplay();