// ---------------------------------------------------------------------------------------------------------------------------------------------------------------- // This ImageJ macro measures the location of zebrafish larvae in culture dishes, plates with 6-24 wells, or plates with 5-24 lanes // It carries out the analysis on all wells, one image at a time, so large numbers of images can be analyzed. // // Version: Macro26bc // // To try it out, open ImageJ and select: Plugins, macros, run. // Or install the macro as a plugin: open ImageJ, Plugins, Install // // Created by Robbert Creton, edited by Robert J Thorn // ---------------------------------------------------------------------------------------------------------------------------------------------------------------- // DEFAULT PARAMETERS - CAN CHANGE THESE NUMBERS FOR NEW EXPERIMENTS. // default parameters, general n = 100; // Number of images wells = 24; // Number of wells or lanes wl = "wells"; // Wells or lanes: "lanes", "wells" flip = "no"; // Flip image: "no", "vertical", "horizontal", "rotate180" bg = "yes"; // Background subtraction:"yes", "no" pz = "100"; // Particle size: "200", "100", "50", "25" batch = "yes"; // Batch mode (skips display): "yes", "no" lr = "no"; // Analyze half image: "no", "left", "right" lines = "yes"; // Draw lines between larvae: ", "yes", "no" nmd = 1; // Draw measurements over time (0-600+ timepoints) FileName = "Results"; // Name the results file // RJT add for Results Save // default parameters for well tags exp1 = "Tricaine"; // Tag for experiment 1 exp2 = "Ablated"; // Tag for experiment 2 exp3 = ""; // Tag for experiment 3 exp4 = ""; // Tag for experiment 4 firstwellexp1 = 1; // First well of experiment 1 firstwellexp2 = 13; // First well of experiment 2 firstwellexp3 = 100; // First well of experiment 3 firstwellexp4 = 100; // First well of experiment 4 // default parameters for multiple periods (100 images at 6 sec int = 10 minute period) startper1 = 1; // First image of period 1 startper2 = 101; // First image of period 2 startper3 = 201; // First image of period 3 startper4 = 301; // First image of period 4 startper5 = 401; // First image of period 5 startper6 = 501; // First image of period 6 startper7 = 601; // First image of period 7 startper8 = 701; // First image of period 8 startper9 = 801; // First image of period 9 startper10 = 901; // First image of period 10 startper11 = 1001; // First image of period 11 startper12 = 1101; // First image of period 12 colorper1 = "red"; // Color channel for analysis: "red", "green", "blue", "yellow", "cyan", "gray" colorper2 = "red"; // Color channel for analysis: "red", "green", "blue", "yellow", "cyan", "gray" colorper3 = "red"; // Color channel for analysis: "red", "green", "blue", "yellow", "cyan", "gray" colorper4 = "red"; // Color channel for analysis: "red", "green", "blue", "yellow", "cyan", "gray" colorper5 = "red"; // Color channel for analysis: "red", "green", "blue", "yellow", "cyan", "gray" colorper6 = "red"; // Color channel for analysis: "red", "green", "blue", "yellow", "cyan", "gray" colorper7 = "red"; // Color channel for analysis: "red", "green", "blue", "yellow", "cyan", "gray" colorper8 = "red"; // Color channel for analysis: "red", "green", "blue", "yellow", "cyan", "gray" colorper9 = "red"; // Color channel for analysis: "red", "green", "blue", "yellow", "cyan", "gray" colorper10 = "red"; // Color channel for analysis: "red", "green", "blue", "yellow", "cyan", "gray" colorper11 = "red"; // Color channel for analysis: "red", "green", "blue", "yellow", "cyan", "gray" colorper12 = "red"; // Color channel for analysis: "red", "green", "blue", "yellow", "cyan", "gray" // May need ImageJ version 1.47o to show summary at end requires("1.47o"); // version > 1.47o needed to add strings in results table // First Dialog Box to change the general default parameters Dialog.create("IMAGE ANALYSIS"); Dialog.addMessage("This macro measures the location of zebrafish larvae \n in multiwell or multilane plates."); Dialog.addString("Name your results file:","Results",FileName); //RJT add for Results Save Dialog.addNumber("Number of images to be analyzed: ", n); Dialog.addNumber("Total number of wells or lanes (1-24): ", wells); Dialog.addChoice("Wells or lanes: ", newArray("lanes", "wells"), wl); Dialog.addChoice("Flip image: ", newArray("no", "vertical", "horizontal", "rotate180"), flip); Dialog.addChoice("Background subtraction: ", newArray("yes", "no"), bg); Dialog.addChoice("Particle size: ", newArray("200", "100", "50", "25"), pz); Dialog.addChoice("Batch mode ('yes' is fast, 'no' to see analysis ): ", newArray("yes", "no"), batch); Dialog.addChoice("Analyze half image: ", newArray("no", "left", "right"), lr); Dialog.addChoice("Draw lines between larvae: ", newArray("yes", "no"), lines); Dialog.addNumber("Draw points over time (0-600 timepoints): ", nmd); Dialog.show(); FileName = Dialog.getString(); //RJT add for Results Save n = Dialog.getNumber(); wells = Dialog.getNumber(); wl = Dialog.getChoice(); flip = Dialog.getChoice(); bg = Dialog.getChoice(); pz = Dialog.getChoice(); batch = Dialog.getChoice(); lr = Dialog.getChoice(); lines = Dialog.getChoice(); nmd = Dialog.getNumber(); // Second Dialog Box to change the default parameters for the Well Tags Dialog.create("WELL TAGS"); Dialog.addMessage("Tags identify experimental groups. \n Precise naming is important when \n combining files at a later time."); Dialog.addString("Tag for exp. 1: ", exp1, 5); Dialog.addString("Tag for exp. 2: ", exp2, 5); Dialog.addString("Tag for exp. 3: ", exp3, 5); Dialog.addString("Tag for exp. 4: ", exp4, 5); Dialog.addMessage("Unused experimental groups: leave at 100 or delete"); Dialog.addNumber("First well in exp. 1 (1-24): ", firstwellexp1); Dialog.addNumber("First well in exp. 2 (1-24): ", firstwellexp2); Dialog.addNumber("First well in exp. 3 (1-24): ", firstwellexp3); Dialog.addNumber("First well in exp. 4 (1-24): ", firstwellexp4); Dialog.show(); exp1 = Dialog.getString(); // Tag for experiment 1 exp2 = Dialog.getString(); // Tag for experiment 2 exp3 = Dialog.getString(); // Tag for experiment 3 exp4 = Dialog.getString(); // Tag for experiment 4 firstwellexp1 = Dialog.getNumber(); // First well of experiment 1 firstwellexp2 = Dialog.getNumber(); // First well of experiment 2 firstwellexp3 = Dialog.getNumber(); // First well of experiment 3 firstwellexp4 = Dialog.getNumber(); // First well of experiment 4 if(isNaN(firstwellexp2)==1){firstwellexp2=1000;} // If input is blank, make number 1000 (so program doesn't break) if(isNaN(firstwellexp3)==1){firstwellexp3=1000;} if(isNaN(firstwellexp4)==1){firstwellexp4=1000;} // Third Dialog Box to change the default parameters for the Time Periods Dialog.create("TIME PERIODS"); Dialog.addMessage("Time periods, e.g. with different visual stimuli. \n 100 images at 6 sec interval = 10 minutes. \n Unused periods: delete."); Dialog.addNumber("First image in period 1: ", startper1); Dialog.addNumber("First image in period 2: ", startper2); Dialog.addNumber("First image in period 3: ", startper3); Dialog.addNumber("First image in period 4: ", startper4); Dialog.addNumber("First image in period 5: ", startper5); Dialog.addNumber("First image in period 6: ", startper6); Dialog.addNumber("First image in period 7: ", startper7); Dialog.addNumber("First image in period 8: ", startper8); Dialog.addNumber("First image in period 9: ", startper9); Dialog.addNumber("First image in period 10: ", startper10); Dialog.addNumber("First image in period 11: ", startper11); Dialog.addNumber("First image in period 12: ", startper12); Dialog.addMessage("Use red channel for red visual stimuli."); Dialog.addChoice("Analyze period 1 in: ", newArray("red", "green", "blue", "yellow", "cyan", "gray"), colorper1); Dialog.addChoice("Analyze period 2 in: ", newArray("red", "green", "blue", "yellow", "cyan", "gray"), colorper2); Dialog.addChoice("Analyze period 3 in: ", newArray("red", "green", "blue", "yellow", "cyan", "gray"), colorper3); Dialog.addChoice("Analyze period 4 in: ", newArray("red", "green", "blue", "yellow", "cyan", "gray"), colorper4); Dialog.addChoice("Analyze period 5 in: ", newArray("red", "green", "blue", "yellow", "cyan", "gray"), colorper5); Dialog.addChoice("Analyze period 6 in: ", newArray("red", "green", "blue", "yellow", "cyan", "gray"), colorper6); Dialog.addChoice("Analyze period 7 in: ", newArray("red", "green", "blue", "yellow", "cyan", "gray"), colorper7); Dialog.addChoice("Analyze period 8 in: ", newArray("red", "green", "blue", "yellow", "cyan", "gray"), colorper8); Dialog.addChoice("Analyze period 9 in: ", newArray("red", "green", "blue", "yellow", "cyan", "gray"), colorper9); Dialog.addChoice("Analyze period 10 in: ", newArray("red", "green", "blue", "yellow", "cyan", "gray"), colorper10); Dialog.addChoice("Analyze period 11 in: ", newArray("red", "green", "blue", "yellow", "cyan", "gray"), colorper11); Dialog.addChoice("Analyze period 12 in: ", newArray("red", "green", "blue", "yellow", "cyan", "gray"), colorper12); Dialog.show(); startper1 = Dialog.getNumber(); // First image of period 1 startper2 = Dialog.getNumber(); // First image of period 2 startper3 = Dialog.getNumber(); // First image of period 3 startper4 = Dialog.getNumber(); // First image of period 4 startper5 = Dialog.getNumber(); // First image of period 5 startper6 = Dialog.getNumber(); // First image of period 6 startper7 = Dialog.getNumber(); // First image of period 7 startper8 = Dialog.getNumber(); // First image of period 8 startper9 = Dialog.getNumber(); // First image of period 9 startper10 = Dialog.getNumber(); // First image of period 10 startper11 = Dialog.getNumber(); // First image of period 11 startper12 = Dialog.getNumber(); // First image of period 12 colorper1 = Dialog.getChoice(); // Analysis in color channel colorper2 = Dialog.getChoice(); // Analysis in color channel colorper3 = Dialog.getChoice(); // Analysis in color channel colorper4 = Dialog.getChoice(); // Analysis in color channel colorper5 = Dialog.getChoice(); // Analysis in color channel colorper6 = Dialog.getChoice(); // Analysis in color channel colorper7 = Dialog.getChoice(); // Analysis in color channel colorper8 = Dialog.getChoice(); // Analysis in color channel colorper9 = Dialog.getChoice(); // Analysis in color channel colorper10 = Dialog.getChoice(); // Analysis in color channel colorper11 = Dialog.getChoice(); // Analysis in color channel colorper12 = Dialog.getChoice(); // Analysis in color channel if(isNaN(startper2)==1) {startper2=10000;} // If input is blank, make number 10000 (so program doesn't break) if(isNaN(startper3)==1) {startper3=10000;} if(isNaN(startper4)==1) {startper4=10000;} if(isNaN(startper5)==1) {startper5=10000;} if(isNaN(startper6)==1) {startper6=10000;} if(isNaN(startper7)==1) {startper7=10000;} if(isNaN(startper8)==1) {startper8=10000;} if(isNaN(startper9)==1) {startper9=10000;} if(isNaN(startper10)==1) {startper10=10000;} if(isNaN(startper11)==1) {startper11=10000;} if(isNaN(startper12)==1) {startper12=10000;} // Ask user to open first image waitForUser("FIRST IMAGE","FIRST open an image. THEN click OK"); wait(100); dir=getDirectory("image"); title=getTitle(); canvaswidth=getWidth(); midcanvas=0.5*canvaswidth; canvasheight=getHeight(); // First image: flip inverted image, convert to 8-bit greyscale, subtract background, set threshold. if(lr=="left"){run("Canvas Size...", "width=midcanvas height=canvasheight position=Top-Left");} if(lr=="right"){run("Canvas Size...", "width=midcanvas height=canvasheight position=Top-Right");} if(flip=="verticle"){run("Flip Vertically");} //"no", "vertical", "horizontal", "rotate180" if(flip=="horizontal"){run("Flip Horizontally");} if(flip=="rotate180"){ run("Rotate 90 Degrees Right"); run("Rotate 90 Degrees Right"); } color = colorper1; // color analysis for first image if(color=="red"){ run("RGB Stack"); setSlice(3); run("Delete Slice"); setSlice(2); run("Delete Slice"); } if(color=="green"){ run("RGB Stack"); setSlice(3); run("Delete Slice"); setSlice(1); run("Delete Slice"); } if(color=="blue"){ run("RGB Stack"); setSlice(2); run("Delete Slice"); setSlice(1); run("Delete Slice"); } if(color=="yellow"){ // analyze yellow in red channel run("RGB Stack"); setSlice(3); run("Delete Slice"); setSlice(2); run("Delete Slice"); } run("8-bit"); // gray and cyan images are analyzed without color separation setTool("oval"); // selects circular tool for moving the ovals around if (wl=="lanes") {setTool("rectangle");} // selects retangular tool for lanes // create 1- 24 ROIs (wells A1, A2, A3,...C4 are numbered 1-24) and store ROI settings makeOval(150, 140, 560, 560); if (wl=="lanes") {makeRectangle(190, 180, 350, 1400);} waitForUser("ROI-01","FIRST adjust ROI. THEN click OK"); getBoundingRect(x1, y1, width1, height1); wait(100); // needed after waitForUser to avoid error message if(wells>1){ // more than 1 well? true if wells=2, false if wells=1 makeOval(960, 140, 560, 560); if (wl=="lanes") {makeRectangle(630, 180, 350, 1400);} waitForUser("ROI-02","FIRST adjust ROI. THEN click OK"); getBoundingRect(x2, y2, width2, height2); wait(100); } if(wells>2){ makeOval(1770, 140, 560, 560); if (wl=="lanes") {makeRectangle(1080, 180, 350, 1400);} waitForUser("ROI-03","FIRST adjust ROI. THEN click OK"); getBoundingRect(x3, y3, width3, height3); wait(100); } if(wells>3){ makeOval(150, 950, 560, 560); if (wl=="lanes") {makeRectangle(1530, 180, 350, 1400);} waitForUser("ROI-04","FIRST adjust ROI. THEN click OK"); getBoundingRect(x4, y4, width4, height4); wait(100); } if(wells>4){ makeOval(970, 950, 560, 560); if (wl=="lanes") {makeRectangle(1970, 180, 350, 1400);} waitForUser("ROI-05","FIRST adjust ROI. THEN click OK"); getBoundingRect(x5, y5, width5, height5); wait(100); } if(wells>5){ makeOval(1770, 950, 560, 560); if (wl=="lanes") {makeRectangle(190, 1920, 350, 1400);} waitForUser("ROI-06","FIRST adjust ROI. THEN click OK"); getBoundingRect(x6, y6, width6, height6); wait(100); } if(wells>6){ makeOval(180, 1900, 560, 560); if (wl=="lanes") {makeRectangle(620, 1920, 350, 1400);} waitForUser("ROI-07","FIRST adjust ROI. THEN click OK"); getBoundingRect(x7, y7, width7, height7); wait(100); } if(wells>7){ makeOval(990, 1900, 560, 560); if (wl=="lanes") {makeRectangle(1080, 1920, 350, 1400);} waitForUser("ROI-08","FIRST adjust ROI. THEN click OK"); getBoundingRect(x8, y8, width8, height8); wait(100); } if(wells>8){ makeOval(1800, 1900, 560, 560); if (wl=="lanes") {makeRectangle(1530, 1920, 350, 1400);} waitForUser("ROI-09","FIRST adjust ROI. THEN click OK"); getBoundingRect(x9, y9, width9, height9); wait(100); } if(wells>9){ makeOval(180, 2720, 560, 560); if (wl=="lanes") {makeRectangle(1970, 1920, 350, 1400);} waitForUser("ROI-10","FIRST adjust ROI. THEN click OK"); getBoundingRect(x10, y10, width10, height10); wait(100); } if(wells>10){ makeOval(990, 2720, 560, 560); if (wl=="lanes") {makeRectangle(2800, 200, 350, 1400);} waitForUser("ROI-11","FIRST adjust ROI. THEN click OK"); getBoundingRect(x11, y11, width11, height11); wait(100); } if(wells>11){ makeOval(1800, 2720, 560, 560); if (wl=="lanes") {makeRectangle(3240, 200, 350, 1400);} waitForUser("ROI-12","FIRST adjust ROI. THEN click OK"); getBoundingRect(x12, y12, width12, height12); wait(100); } if(wells>12){ makeOval(2810, 140, 560, 560); if (wl=="lanes") {makeRectangle(3670, 200, 350, 1400);} waitForUser("ROI-13","FIRST adjust ROI. THEN click OK"); getBoundingRect(x13, y13, width13, height13); wait(100); } if(wells>13){ makeOval(3610, 140, 560, 560); if (wl=="lanes") {makeRectangle(4130, 200, 350, 1400);} waitForUser("ROI-14","FIRST adjust ROI. THEN click OK"); getBoundingRect(x14, y14, width14, height14); wait(100); } if(wells>14){ makeOval(4430, 140, 560, 560); if (wl=="lanes") {makeRectangle(4570, 200, 350, 1400);} waitForUser("ROI-15","FIRST adjust ROI. THEN click OK"); getBoundingRect(x15, y15, width15, height15); wait(100); } if(wells>15){ makeOval(2810, 950, 560, 560); if (wl=="lanes") {makeRectangle(2800, 1930, 350, 1400);} waitForUser("ROI-16","FIRST adjust ROI. THEN click OK"); getBoundingRect(x16, y16, width16, height16); wait(100); } if(wells>16){ makeOval(3610, 950, 560, 560); if (wl=="lanes") {makeRectangle(3240, 1930, 350, 1400);} waitForUser("ROI-17","FIRST adjust ROI. THEN click OK"); getBoundingRect(x17, y17, width17, height17); wait(100); } if(wells>17){ makeOval(4430, 950, 560, 560); if (wl=="lanes") {makeRectangle(3670, 1930, 350, 1400);} waitForUser("ROI-18","FIRST adjust ROI. THEN click OK"); getBoundingRect(x18, y18, width18, height18); wait(100); } if(wells>18){ makeOval(2810, 1890, 560, 560); if (wl=="lanes") {makeRectangle(4130, 1930, 350, 1400);} waitForUser("ROI-19","FIRST adjust ROI. THEN click OK"); getBoundingRect(x19, y19, width19, height19); wait(100); } if(wells>19){ makeOval(3610, 1890, 560, 560); if (wl=="lanes") {makeRectangle(4570, 1930, 350, 1400);} waitForUser("ROI-20","FIRST adjust ROI. THEN click OK"); getBoundingRect(x20, y20, width20, height20); wait(100); } if(wells>20){ makeOval(4430, 1890, 560, 560); if (wl=="lanes") {makeRectangle(4250, 1750, 350, 1400);} waitForUser("ROI-21","FIRST adjust ROI. THEN click OK"); getBoundingRect(x21, y21, width21, height21); wait(100); } if(wells>21){ makeOval(2810, 2700, 560, 560); if (wl=="lanes") {makeRectangle(4250, 1750, 350, 1400);} waitForUser("ROI-22","FIRST adjust ROI. THEN click OK"); getBoundingRect(x22, y22, width22, height22); wait(100); } if(wells>22){ makeOval(3610, 2700, 560, 560); if (wl=="lanes") {makeRectangle(4250, 1750, 350, 1400);} waitForUser("ROI-23","FIRST adjust ROI. THEN click OK"); getBoundingRect(x23, y23, width23, height23); wait(100); } if(wells>23){ makeOval(4430, 2700, 560, 560); if (wl=="lanes") {makeRectangle(4250, 1750, 350, 1400);} waitForUser("ROI-24","FIRST adjust ROI. THEN click OK"); getBoundingRect(x24, y24, width24, height24); wait(100); } run("Revert"); run("Select None"); close(); // Measure particles in well 1-20 starting with image 1 (s=1), then go on to image 2 (s=2), .... until slice counter s=n getDateAndTime(year1, month1, dayOfWeek1, dayOfMonth1, hour1, minute1, second1, msec1); if (batch=="yes") {setBatchMode(true);} // speed up analysis (skips updated display on monitor) open(dir+title); // opens first image run("Set Measurements...", "area mean centroid center bounding fit display redirect=None decimal=3"); s=0; // slice counter, set to 0 while (s=startper1 && s=startper2 && s=startper3 && s=startper4 && s=startper5 && s=startper6 && s=startper7 && s=startper8 && s=startper9 && s=startper10 && s=startper11 && s=startper12) {color= colorper12;} // TEST colors per period if(color=="red"){ run("RGB Stack"); setSlice(3); run("Delete Slice"); setSlice(2); run("Delete Slice"); } if(color=="green"){ run("RGB Stack"); setSlice(3); run("Delete Slice"); setSlice(1); run("Delete Slice"); } if(color=="blue"){ run("RGB Stack"); setSlice(2); run("Delete Slice"); setSlice(1); run("Delete Slice"); } if(color=="yellow"){ // analyze yellow in red channel run("RGB Stack"); setSlice(3); run("Delete Slice"); setSlice(2); run("Delete Slice"); } run("8-bit"); // gray and cyan images are analyzed without color separation if (bg=="yes"){run("Subtract Background...", "rolling=50 light");} makeOval(x1, y1, width1, height1); if (wl=="lanes") {makeRectangle(x1, y1, width1, height1);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} if(wells>1) { makeOval(x2, y2, width2, height2); if (wl=="lanes") {makeRectangle(x2, y2, width2, height2);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>2) { makeOval(x3, y3, width3, height3); if (wl=="lanes") {makeRectangle(x3, y3, width3, height3);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>3) { makeOval(x4, y4, width4, height4); if (wl=="lanes") {makeRectangle(x4, y4, width4, height4);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>4) { makeOval(x5, y5, width5, height5); if (wl=="lanes") {makeRectangle(x5, y5, width5, height5);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>5) { makeOval(x6, y6, width6, height6); if (wl=="lanes") {makeRectangle(x6, y6, width6, height6);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>6) { makeOval(x7, y7, width7, height7); if (wl=="lanes") {makeRectangle(x7, y7, width7, height7);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>7) { makeOval(x8, y8, width8, height8); if (wl=="lanes") {makeRectangle(x8, y8, width8, height8);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>8) { makeOval(x9, y9, width9, height9); if (wl=="lanes") {makeRectangle(x9, y9, width9, height9);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>9) { makeOval(x10, y10, width10, height10); if (wl=="lanes") {makeRectangle(x10, y10, width10, height10);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>10) { makeOval(x11, y11, width11, height11); if (wl=="lanes") {makeRectangle(x11, y11, width11, height11);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>11) { makeOval(x12, y12, width12, height12); if (wl=="lanes") {makeRectangle(x12, y12, width12, height12);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>12) { makeOval(x13, y13, width13, height13); if (wl=="lanes") {makeRectangle(x13, y13, width13, height13);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>13) { makeOval(x14, y14, width14, height14); if (wl=="lanes") {makeRectangle(x14, y14, width14, height14);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>14) { makeOval(x15, y15, width15, height15); if (wl=="lanes") {makeRectangle(x15, y15, width15, height15);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>15) { makeOval(x16, y16, width16, height16); if (wl=="lanes") {makeRectangle(x16, y16, width16, height16);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>16) { makeOval(x17, y17, width17, height17); if (wl=="lanes") {makeRectangle(x17, y17, width17, height17);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>17) { makeOval(x18, y18, width18, height18); if (wl=="lanes") {makeRectangle(x18, y18, width18, height18);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>18) { makeOval(x19, y19, width19, height19); if (wl=="lanes") {makeRectangle(x19, y19, width19, height19);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>19) { makeOval(x20, y20, width20, height20); if (wl=="lanes") {makeRectangle(x20, y20, width20, height20);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>20) { makeOval(x21, y21, width21, height21); if (wl=="lanes") {makeRectangle(x21, y21, width21, height21);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>21) { makeOval(x22, y22, width22, height22); if (wl=="lanes") {makeRectangle(x22, y22, width22, height22);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>22) { makeOval(x23, y23, width23, height23); if (wl=="lanes") {makeRectangle(x23, y23, width23, height23);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } if(wells>23) { makeOval(x24, y24, width24, height24); if (wl=="lanes") {makeRectangle(x24, y24, width24, height24);} setAutoThreshold("MaxEntropy"); if (pz=="200"){run("Analyze Particles...", "size=200-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="100"){run("Analyze Particles...", "size=100-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="50"){run("Analyze Particles...", "size=50-1000 circularity=0.00-1.00 show=Nothing display");} if (pz=="25"){run("Analyze Particles...", "size=25-1000 circularity=0.00-1.00 show=Nothing display");} } run("Revert"); run("Select None"); run("Open Next"); // get next image ready } // end of all images close(); // Add image numbers, well numbers, midpoints, and exp goups to Results data sheet (for row 0 - end) row=0; imagecount = 0; while (row0) {prevname=getResultLabel(row-1);} currentname=getResultLabel(row); if(currentname != prevname) {imagecount = imagecount +1;} // image counter setResult("Image", row, imagecount); // Add time period based on image number if(startper1>0 && imagecount >= startper1) {setResult("Period", row, 1);} if(startper2>0 && imagecount >= startper2) {setResult("Period", row, 2);} if(startper3>0 && imagecount >= startper3) {setResult("Period", row, 3);} if(startper4>0 && imagecount >= startper4) {setResult("Period", row, 4);} if(startper5>0 && imagecount >= startper5) {setResult("Period", row, 5);} if(startper6>0 && imagecount >= startper6) {setResult("Period", row, 6);} if(startper7>0 && imagecount >= startper7) {setResult("Period", row, 7);} if(startper8>0 && imagecount >= startper8) {setResult("Period", row, 8);} if(startper9>0 && imagecount >= startper9) {setResult("Period", row, 9);} if(startper10>0 && imagecount >= startper10) {setResult("Period", row, 10);} if(startper11>0 && imagecount >= startper11) {setResult("Period", row, 11);} if(startper12>0 && imagecount >= startper12) {setResult("Period", row, 12);} // Add well numbers based on larval location and add midpoint of well Xfish=getResult ("X", row); //getResult("Column", row) Yfish=getResult ("Y", row); if(Xfish>=x1 && Xfish<=x1+width1 && Yfish>=y1 && Yfish<=y1+height1){ // well 1 setResult("Well", row, 1); setResult("X midp", row, x1+0.5*width1); setResult("Y midp", row, y1+0.5*height1); } // end of well1 if(wells>1){ if(Xfish>=x2 && Xfish<=x2+width2 && Yfish>=y2 && Yfish<=y2+height2){ // well 2 setResult("Well", row, 2); setResult("X midp", row, x2+0.5*width2); setResult("Y midp", row, y2+0.5*height2); } // end of well2 } if(wells>2){ if(Xfish>=x3 && Xfish<=x3+width3 && Yfish>=y3 && Yfish<=y3+height3){ // well 3 setResult("Well", row, 3); setResult("X midp", row, x3+0.5*width3); setResult("Y midp", row, y3+0.5*height3); } // end of well3 } if(wells>3){ if(Xfish>=x4 && Xfish<=x4+width4 && Yfish>=y4 && Yfish<=y4+height4){ // well 4 setResult("Well", row, 4); setResult("X midp", row, x4+0.5*width4); setResult("Y midp", row, y4+0.5*height4); } // end of well4 } if(wells>4){ if(Xfish>=x5 && Xfish<=x5+width5 && Yfish>=y5 && Yfish<=y5+height5){ // well 5 setResult("Well", row, 5); setResult("X midp", row, x5+0.5*width5); setResult("Y midp", row, y5+0.5*height5); } // end of well5 } if(wells>5){ if(Xfish>=x6 && Xfish<=x6+width6 && Yfish>=y6 && Yfish<=y6+height6){ // well 6 setResult("Well", row, 6); setResult("X midp", row, x6+0.5*width6); setResult("Y midp", row, y6+0.5*height6); } // end of well6 } if(wells>6){ if(Xfish>=x7 && Xfish<=x7+width7 && Yfish>=y7 && Yfish<=y7+height7){ // well 7 setResult("Well", row, 7); setResult("X midp", row, x7+0.5*width7); setResult("Y midp", row, y7+0.5*height7); } // end of well7 } if(wells>7){ if(Xfish>=x8 && Xfish<=x8+width8 && Yfish>=y8 && Yfish<=y8+height8){ // well 8 setResult("Well", row, 8); setResult("X midp", row, x8+0.5*width8); setResult("Y midp", row, y8+0.5*height8); } // end of well8 } if(wells>8){ if(Xfish>=x9 && Xfish<=x9+width9 && Yfish>=y9 && Yfish<=y9+height9){ // well 9 setResult("Well", row, 9); setResult("X midp", row, x9+0.5*width9); setResult("Y midp", row, y9+0.5*height9); } // end of well9 } if(wells>9){ if(Xfish>=x10 && Xfish<=x10+width10 && Yfish>=y10 && Yfish<=y10+height10){ // well 10 setResult("Well", row, 10); setResult("X midp", row, x10+0.5*width10); setResult("Y midp", row, y10+0.5*height10); } // end of well10 } if(wells>10){ if(Xfish>=x11 && Xfish<=x11+width11 && Yfish>=y11 && Yfish<=y11+height11){ // well 11 setResult("Well", row, 11); setResult("X midp", row, x11+0.5*width11); setResult("Y midp", row, y11+0.5*height11); } // end of well11 } if(wells>11){ if(Xfish>=x12 && Xfish<=x12+width12 && Yfish>=y12 && Yfish<=y12+height12){ // well 12 setResult("Well", row, 12); setResult("X midp", row, x12+0.5*width12); setResult("Y midp", row, y12+0.5*height12); } // end of well12 } if(wells>12){ if(Xfish>=x13 && Xfish<=x13+width13 && Yfish>=y13 && Yfish<=y13+height13){ // well 13 setResult("Well", row, 13); setResult("X midp", row, x13+0.5*width13); setResult("Y midp", row, y13+0.5*height13); } // end of well13 } if(wells>13){ if(Xfish>=x14 && Xfish<=x14+width14 && Yfish>=y14 && Yfish<=y14+height14){ // well 14 setResult("Well", row, 14); setResult("X midp", row, x14+0.5*width14); setResult("Y midp", row, y14+0.5*height14); } // end of well14 } if(wells>14){ if(Xfish>=x15 && Xfish<=x15+width15 && Yfish>=y15 && Yfish<=y15+height15){ // well 15 setResult("Well", row, 15); setResult("X midp", row, x15+0.5*width15); setResult("Y midp", row, y15+0.5*height15); } // end of well15 } if(wells>15){ if(Xfish>=x16 && Xfish<=x16+width16 && Yfish>=y16 && Yfish<=y16+height16){ // well 16 setResult("Well", row, 16); setResult("X midp", row, x16+0.5*width16); setResult("Y midp", row, y16+0.5*height16); } // end of well16 } if(wells>16){ if(Xfish>=x17 && Xfish<=x17+width17 && Yfish>=y17 && Yfish<=y17+height17){ // well 17 setResult("Well", row, 17); setResult("X midp", row, x17+0.5*width17); setResult("Y midp", row, y17+0.5*height17); } // end of well17 } if(wells>17){ if(Xfish>=x18 && Xfish<=x18+width18 && Yfish>=y18 && Yfish<=y18+height18){ // well 18 setResult("Well", row, 18); setResult("X midp", row, x18+0.5*width18); setResult("Y midp", row, y18+0.5*height18); } // end of well18 } if(wells>18){ if(Xfish>=x19 && Xfish<=x19+width19 && Yfish>=y19 && Yfish<=y19+height19){ // well 19 setResult("Well", row, 19); setResult("X midp", row, x19+0.5*width19); setResult("Y midp", row, y19+0.5*height19); } // end of well19 } if(wells>19){ if(Xfish>=x20 && Xfish<=x20+width20 && Yfish>=y20 && Yfish<=y20+height20){ // well 20 setResult("Well", row, 20); setResult("X midp", row, x20+0.5*width20); setResult("Y midp", row, y20+0.5*height20); } // end of well20 } if(wells>20){ if(Xfish>=x21 && Xfish<=x21+width21 && Yfish>=y21 && Yfish<=y21+height21){ // well 21 setResult("Well", row, 21); setResult("X midp", row, x21+0.5*width21); setResult("Y midp", row, y21+0.5*height21); } // end of well21 } if(wells>21){ if(Xfish>=x22 && Xfish<=x22+width22 && Yfish>=y22 && Yfish<=y22+height22){ // well 22 setResult("Well", row, 22); setResult("X midp", row, x22+0.5*width22); setResult("Y midp", row, y22+0.5*height22); } // end of well22 } if(wells>22){ if(Xfish>=x23 && Xfish<=x23+width23 && Yfish>=y23 && Yfish<=y23+height23){ // well 23 setResult("Well", row, 23); setResult("X midp", row, x23+0.5*width23); setResult("Y midp", row, y23+0.5*height23); } // end of well23 } if(wells>23){ if(Xfish>=x24 && Xfish<=x24+width24 && Yfish>=y24 && Yfish<=y24+height24){ // well 24 setResult("Well", row, 24); setResult("X midp", row, x24+0.5*width24); setResult("Y midp", row, y24+0.5*height24); } // end of well24 } // Add Well Tags based on well numbers (Column \'Exp' shows the exp groups) welltag=getResult ("Well", row); //getResult("Column", row) if(welltag >= firstwellexp1 && welltag < firstwellexp2) {setResult("Exp", row, exp1);} if(welltag >= firstwellexp2 && welltag < firstwellexp3) {setResult("Exp", row, exp2);} if(welltag >= firstwellexp3 && welltag < firstwellexp4) {setResult("Exp", row, exp3);} if(welltag >= firstwellexp4 && welltag <= wells) {setResult("Exp", row, exp4);} row=row+1; } // end of add image numbers, well numbers, midpoints, exp groups updateResults(); // Draw lines between larvae in the same well setBatchMode(false); open(dir+title); // opens first image if(lr==1){run("Canvas Size...", "width=midcanvas height=canvasheight position=Top-Left");} if(lr==2){run("Canvas Size...", "width=midcanvas height=canvasheight position=Top-Right");} if(flip==1){run("Flip Vertically");} if(flip==2){run("Flip Horizontally");} if(flip==3){ run("Rotate 90 Degrees Right"); run("Rotate 90 Degrees Right"); } rename("Show measurements on first image"); row=0; image=0.5; // lines = "yes"; // test lines ON // nmd = 1; // test number of measurements while (row0) {image=image+1;} row=row+1; } // end of rows // Draw midpoint of bounding box (yellow) and centroid (red) in first image row=0; image=-0.5; // nmd = 1; // test number of measurements while (row