/* Plugins > Macros > Install... Written for ImageJ 1.49u This macro converts a folder of images that are .nd2 files to TIF. The macro was written for .nd2 four channel files where the first channel is TIRF green, the second channel is hilo green, the third channel is TIRF red, and the fourth is hilo red. User selects folder of files. This version only opens files ending with the extension ".nd2" and has only been tested with single image files. (Could be modified for Zeis .lsm or .czi too.) The converted images are saved in the same folder as the original images but with ".tif" replacing original extension. First file: same title, LUTs added. Second file: 2X2 montage Third file: CLAHE processing You can add/subtract processing steps as you see fit. For instance median filtering, merging, etc. This version has been only tested on Windows. 20150608 Michael.Cammer@med.nyu.edu Let me know how this works, if you want changes, etc. If you use this macro for data that are subsequently published, please acknowledge the OCS Microscopy Core at NYU Langone. */ var openpath = ""; // where files will be opened from; global to avoid having to pass to functions //============================================================== macro "convert a directory of files" { // requires ("v1.49m"); // commented out because as of 1.49k this command doesn't appear to work... openPath = getDirectory("Choose a Directory"); fileList = getFileList(openPath); run("Bio-Formats Macro Extensions"); for (i=0; i 2) { setSlice(3); run("Red"); setMinAndMax(200, 16120); } if (nSlices() > 3) { setSlice(4); run("Red"); setMinAndMax(200, 16120); } saveAs("Tiff", openPath+title); // Make Montage originalImage = getImageID(); run("Duplicate...", "title=duplicate duplicate"); run("Hyperstack to Stack"); duplicateImage = getImageID(); run("Make Montage...", "columns=2 rows=2 scale=1 first=1 last=4 increment=1 border=0 font=12"); setMinAndMax(200, 16120); // puts scalebar on image; comment out run("Scale Bar...", if not wanted setVoxelSize(pixwidth, pixheight, pixdepth, unit); run("Scale Bar...", "width=10 height=4 font=14 color=White background=None location=[Lower Right] bold"); saveAs("Tiff", openPath+title+"_montage"); close(); //CLAHE selectImage(duplicateImage); for (s=1; s<=nSlices; s++) { setSlice(s); run("Enhance Contrast...", "saturated=00"); run("CLAHE ", "blocksize=31 histogram=512 maximum=3"); run("CLAHE ", "blocksize=17 histogram=512 maximum=3"); } saveAs("Tiff", openPath+title+"_CLAHE"); close(); selectImage(originalImage); close(); } // end if endsWith nd2 } //for i } /macro make all 8 bit