// Close any open files run("Close All"); roiManager("reset"); setOption("ExpandableArrays", true); run("Clear Results"); // Set colors setForegroundColor(0, 0, 255); setBackgroundColor(255, 255, 255); // Prompt for directory to open run("Open..."); run("Set Scale...", "distance=0 known=0 pixel=1 unit=pixel"); workingDir=getDirectory("image"); // Get filename information mainTitle = getTitle(); selectWindow(mainTitle); setSlice(nSlices); treatmentname = ""; // Prompt to enter experiment name, and pick colony density of plates (default 1536) Dialog.create("Enter experiment name"); Dialog.addString("Experiment: ",treatmentname); Dialog.addChoice("Colony Density:", newArray("1536", "96", "384", "6144")); Dialog.show(); treatmentname = Dialog.getString(); density = Dialog.getChoice(); // Some clauses for row, column, circle radius (pixels) and multiplier for ROI creation if(density=="96") { ncols = 12; nrows = 8; r = 240; xmult = 51.9; ymult = 53.4; } else if(density=="384") { ncols = 24; nrows = 16; r = 120; xmult = 51.9; ymult = 53.4; } else if(density=="1536") { ncols = 48; nrows = 32; r = 60; xmult = 51.9; ymult = 53.4; } else if(density=="6144") { ncols = 96; nrows = 64; r = 30; xmult = 51.9; ymult = 53.4; } // Prompt user to crop plate if multiple plates are present waitForUser("Draw box around entire plate\nthen click ok"); // Prompt user to rotate plate, then save a publication resolution PNG run("Duplicate...", "title=RGB_window"); run("Rotate... "); saveAs("PNG", workingDir+treatmentname+"-fullPlate.png"); rename("RGB_window"); // Prompt user to crop colonies manually waitForUser("Draw box around just the colonies\n then click ok"); run("Crop"); roiManager("Show None"); selectWindow("RGB_window"); // Duplicate, convert to 8-bit greyscale, remove any burned in dimensions run("Duplicate...", " "); run("8-bit"); run("Calibrate...", "function=[Uncalibrated OD] unit=[Gray Value] text1= text2="); // Background subtract and save a 'colonies-only' file run("Subtract Background...", "rolling=50 light"); saveAs("PNG", workingDir+treatmentname+"-biomass.png"); rename("RGB_window-1"); // Invert for analysis purposes, and direct to acquire colony density run("Invert"); run("Set Measurements...", "integrated redirect=None decimal=6"); run("Select None"); // Intiate the 'grid' system of analysis, where the user can define the ROIs. Checking 'Okay?' will advance pipeline, // leaving it unchecked will replot the grid with the changes made by the user okay = false; xoffset = 27; yoffset = 29; do { roiManager("Show All without labels"); Dialog.create("Define grid"); Dialog.addNumber("xmult: ",xmult); Dialog.addNumber("ymult: ",ymult); Dialog.addNumber("offsetx: ",xoffset); Dialog.addNumber("offsety: ",yoffset); Dialog.addCheckbox("Okay? ",false) Dialog.show(); roiManager("reset"); xmult = Dialog.getNumber(); ymult = Dialog.getNumber(); xoffset = Dialog.getNumber(); yoffset = Dialog.getNumber(); okay = Dialog.getCheckbox(); for(y=1;y<=32;y++) { for(x=1;x<=48;x++) { makeOval((x*xmult)-xoffset,(y*ymult)-yoffset,r,r); roiManager("Add"); } } } while(okay==false); // White light biomass estimations roiManager("Measure"); biomass = newArray(); for(i=0;i<1536;i++) { biomass[i] = getResult("RawIntDen",i); } run("Clear Results"); close("RGB_window-1"); // Now get the congo red values selectWindow("RGB_window"); run("Subtract Background...", "rolling=50 light separate"); run("Colour Deconvolution", "vectors=[User values] hide [r1]=59 [g1]=149 [b1]=89 [r2]=78 [g2]=91 [b2]=90 [r3]=132 [g3]=147 [b3]=84"); close("RGB_window-(Colour_2)"); close("RGB_window-(Colour_3)"); selectWindow("RGB_window-(Colour_1)"); setMinAndMax(65, 182); run("Apply LUT"); saveAs("PNG", workingDir+treatmentname+"-congored.png"); rename("RGB_window"); run("8-bit"); run("Invert"); // Congo red estimations roiManager("Measure"); congored = newArray(); enrichment = newArray(); for(i=0;i<1536;i++) { congored[i] = getResult("RawIntDen",i); enrichment[i] = congored[i]/biomass[i]; } // Make custom results table f = "[Congo Red Deconvolution]"; run("New... ", "name="+f+" type=Table"); print(f,"\\Headings:Well\tBiomass\tCongoRed\tEnrichmentFactor"); counter = 0; rows = newArray("0A","0B","0C","0D","0E","0F","0G","0H","0I","0J","0K","0L","0M","0N","0O","0P","0Q","0R","0S","0T","0U","0V","0W","0X","0Y","0Z","1A","1B","1C","1D","1E","1F"); for(y=1;y<=32;y++) { for(x=1;x<=48;x++) { if (x < 10) labelname=rows[y-1]+"0"+x; else labelname=rows[y-1]+x; print(f,labelname+"\t"+biomass[counter]+"\t"+congored[counter]+"\t"+enrichment[counter]); counter = counter + 1; } } // Save everything and close saveAs("Text", workingDir+treatmentname+"-results.csv"); run("Close All"); roiManager("reset"); run("Clear Results");