/** * NeSys_Labeling_Detection_Macro.txt * @version 1.1 * @author e.a.papp at medisin.uio.no * * This ImageJ macro performs Colour Deconvolution on series of color (RGB) images * using the plugin from G. Landini based on the method of A.C. Ruifrok. * @see http://imagejdocu.tudor.lu/doku.php?id=plugin:color:colour_deconvolution:start * * The images are expected to be within the same directory. Vectors for Colour * Deconvolution should be acquired in advance and saved in the colourdeconvolution.txt file * located in the plugins/Macros folder together with this macro. The file is formatted * according to the example provided by Benjamin Pavie (bpavie) on GitHub. * @see https://github.com/bpavie/Colour_Deconvolution/tree/externaltxt/src/main/java/sc/fiji/colourDeconvolution * * Processing steps for each image: * 1. The primary channel resulting from Colour Deconvolution is calculated using the same vectors for all images. * 2. The resulting image is converted to 8-bit (greyscale). * 3. The greyscale image is thresholded using the default method in ImageJ (IsoData). * 4. The end result is a binary image that is saved in .gif format in a separate directory. * * Requirements: * - Imagej version 1.39f or later * - CDgetPrimaryChannel plugin installed (CDgetPrimaryChannel.class in ImageJ/plugins) * - Colour Deconvolution vectors to be used should be listed in ImageJ/plugins/Macros/colourdeconvolution.txt * - RGB images required in one of the following formats: * .gif, .jpg, .jpe, .jpeg, .png, .tif, .tiff, .bmp, .pgm * * This macro is part of a workflow for automated detection of axonal labeling * in series of microscopic images. See the ImageJ DokuWiki for details: * http://imagejdocu.tudor.lu/doku.php?id=plugin:analysis:autodetection_of_neuronal_labeling_in_histological_image_series:start */ paramfile = getDirectory("plugins") + "Macros" + "\\" + "colourdeconvolution.txt"; if (!File.exists(paramfile)) exit("Missing parameter file:" + "\n" + "colourdeconvolution.txt"); bigstr = File.openAsString(paramfile); lines=split(bigstr,"\n"); lines = Array.slice(lines, 1); stains = newArray(lengthOf(lines)); for (i=0;i