// ImageJ 1.47 macros by Michael Cammer June 2013 // Macros to custom color LSM files with three channels. // In the current version, only the first three channel are shown. // The second macro converts each channel to a color image and // merges them and makes a montage of the channels along with the merged image. //============================================================= macro "LSM to Color for 3 channels" { requires("1.47n"); Stack.setChannel(1); run("Blue"); Stack.setChannel(2); run("Green"); Stack.setChannel(3); run("Red"); Stack.setDisplayMode("composite"); Stack.setActiveChannels("1110"); } // end //============================================================= macro "LSM to Color for 4 channels" { requires("1.47n"); Stack.setChannel(1); run("Magenta"); Stack.setChannel(2); run("Red"); Stack.setChannel(3); run("Green"); Stack.setChannel(4); run("Blue"); // other option Yellow Stack.setDisplayMode("composite"); Stack.setActiveChannels("11110"); } // end "Assign Colors to Zeiss Z series" //============================================================ macro "Make Montage of 3 Channel Composite Color Image" { if (nImages() > 1) exit('Must only have one composite color image open'); originalTitle = getTitle(); original = getImageID(); run("RGB Color"); selectImage(original); run("Split Channels"); for (i=1; i<=nImages(); i++) { selectImage(i); run("RGB Color"); } run("Images to Stack", "name=Stack title=[] use"); run("Reverse"); rename(originalTitle + "_stack"); run("Make Montage...", "columns=2 rows=2 scale=1 first=1 last=4 increment=1 border=0 font=12"); rename(originalTitle + "_montage"); } //============================================================ macro "Make Montage of 4 Composite Color Image" { if (nImages() > 1) exit('Must only have one composite color image open'); originalTitle = getTitle(); original = getImageID(); Dialog.create("Select channels for last merge frame."); Dialog.addMessage("Select channels for last merge frame."); defaults = newArray(true, true, true, true); items = newArray("Ch1", "Ch2", "Ch3", "Ch4"); Dialog.addCheckboxGroup(4, 1, items, defaults); Dialog.show(); selectImage(original); run("Duplicate...", "title=[temp] duplicate channels=1-4"); temp = getImageID; showCh = ""; for (i=0; i<4; i++) { if (Dialog.getCheckbox()) showCh = showCh + "1"; else showCh = showCh + "0"; } Stack.setActiveChannels(showCh); run("RGB Color"); selectImage(temp); close(); selectImage(original); run("RGB Color"); selectImage(original); run("Split Channels"); for (i=1; i<=nImages(); i++) { selectImage(i); run("RGB Color"); } run("Images to Stack", "name=Stack title=[] use"); run("Reverse"); rename(originalTitle + "_stack"); run("Make Montage...", "columns=3 rows=2 scale=1 first=1 last=6 increment=1 border=0 font=12"); rename(originalTitle + "_montage"); }