// Color Transform Stack // // This macro runs the "Color Transformer" plugin // on all the images in an RGB stack. requires("1.39j"); Dialog.create("Color Transformer"); types = newArray("XYZ", "Yxy", "YUV", "YIQ", "Luv", "Lab", "AC1C2", "I1I2I3", "Yuv", "YQ1Q2", "HSI", "HSV", "HSL", "LCHLuv", "LSHLuv", "LSHLab"); Dialog.addChoice("Type:", types); Dialog.show(); type = Dialog.getChoice(); width = getWidth; height = getHeight; n = nSlices; input = getImageID(); setBatchMode(true); for (i=1; i<=n; i++) { showProgress(i, n); selectImage(input); setSlice(i); run("Color Transformer", "colour="+type); if (i==1) { output = getImageID(); setSlice(3); } else { temp = getImageID; for(j=1; j<=3; j++) { selectImage(temp); setSlice(j); run("Copy"); selectImage(output); run("Add Slice"); run("Paste"); } selectImage(temp); close; } } selectImage(output); setBatchMode(false); run("Stack to HyperStack...", "order=xyczt(default) channels=3 slices="+n+" frames=1 display=Grayscale");