/* Modify_Map_1b.txt https://sils.fnwi.uva.nl/bcb/objectj/examples/Coli-Inspector/utils/Modify_Map/ N. Vischer 20.01.20, 16:50 From a sorted Map as created by Coli-Inspector, a duplicate is created by performing these steps: - scales horizontally to 'newWidth' using (down-)averaging - scales vertically by 'yFactor' (=1 by default) - crops to remove upper and lower black space - displays upper hull as white overlay line - displays lower hull as white overlay line - applies individual color LUTs to channels 2 and 3 - optionally makes upper and lower half symmetrial (symmetrial=false by default) More tips: - You also can use manual horizontal smoothing via: Process>Filters>Convolve with single line containing an odd number of '1 's - change color appearance per channel by choosing ImageJ>Lookup Tables... - change color appearance per channel by choosing Image>Adjust>Brightness and Contrast - choose Plugins>Utilities>Capture Image to create an RGB image of current appearance (honors zoom but image must be fully inside screen) - Alternatively choose channel 1 (to avoid ImageJ bug before version 1.52t24) and choose: Image>Overlay>Flatten to create an RGB image or stack (ignores zoom) - renaming "Modified_Map" (Image>Rename...) will avoid automatic closing - Note that 'newWidth' expands or shrinks the map horizontally, it does not create a sub-poulation */ macro "Modify Sorted Map"{ newWidth = 300; yFactor = 1; lut2 = "Green Fire Blue"; lut3 = "Orange Hot"; hullColor = "white"; symmetrical = false;// set true for averaging upper and lowerhalf setSlice(1); if(bitDepth != 32 || getPixel(1,0) >= 0)//negative ID expected exit("Image '" + getTitle + "' is no Coli-Inspector Map"); Overlay.remove; height = getHeight; len = getWidth-1; xHi = newArray(len);//upper hull yHi = newArray(len); xLo = newArray(len);//lower hull yLo = newArray(len); yHi[0] =getPixel(1, 1); yLo[0] =getPixel(1, 1) + getPixel(1, 2); cntHi = 0; cntLo = 0; xFactor = newWidth/len; for(x = 2; x < getWidth; x++){ up =getPixel(x, 1); lo =up + getPixel(x, 2); if(up < yHi[cntHi]){ cntHi++; yHi[cntHi] = up; xHi[cntHi] = x * xFactor; } if(lo > yLo[cntLo]){ cntLo++; yLo[cntLo] = lo; xLo[cntLo] = x * xFactor; } } yHi = Array.trim(yHi, cntHi); yLo = Array.trim(yLo, cntLo); xHi = Array.trim(xHi, cntHi); xLo = Array.trim(xLo, cntLo); for(jj = 0; jj=2){ setSlice(2); run(lut2); } if(nSlices >=3){ setSlice(3); run(lut3); } }