// Cellcounter3D is a macro for ImageJ. It counts the red and // green dots on the R or G images put in a folder (nothing else // should be there!). //First the .LSM stack files should be split into single channels "Red" and "Green". //all the images from one channel should be in one folder //This can be done using for instance the macro "LSM_batch_withcolors.txt". // It prints a summary of the results,i.e. cell number per image in // the Log window and saves it to an output file as CSV file when its done, which then can be read in any spread-sheet like program. // Change the minimum/maximum cell size by changing the // values after "smallest" and "largest" (pixel) in both the // RED and GREEN section. // Copyright (C) 2008 Ben Gantenbein/Laszlo Kupcsik version = getVersion(); MonthNames = newArray("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); DayNames = newArray("Sun", "Mon","Tue","Wed","Thu","Fri","Sat"); getDateAndTime(year, month, dayOfWeek, dayOfMonth, hour, minute, second, msec); TimeString ="Date: "+DayNames[dayOfWeek]+" "; if (dayOfMonth<10) {TimeString = TimeString+"0";} TimeString = TimeString+dayOfMonth+"-"+MonthNames[month]+"-"+year+"\nTime: "; if (hour<10) {TimeString = TimeString+"0";} TimeString = TimeString+hour+":"; if (minute<10) {TimeString = TimeString+"0";} TimeString = TimeString+minute+":"; if (second<10) {TimeString = TimeString+"0";} TimeString = TimeString+second; dir1 = getDirectory("Choose Source Directory "); list = getFileList(dir1); print("This is imageJ version: "+version+". The images were read from "+dir1+". Counting of cells using a constant threshold. "+TimeString); for (i=0; iType>8-bit command // SPECIFIY AT WHICH LEVEL YOU WOULD LIKE TO THRESHOLD THE CHANNEL (IMG/TISSUE SPECIFIC) setThreshold(100, 255); run("Threshold", "thresholded remaining black"); run("Nucleus Counter", "smallest=15 largest=300 threshold=Current smooth=None watershed"); print(status+" %: "+number+" out of "+list.length+", lower cut-off threshold applied: 100, "+imgname+" (green), "+nResults); selectImage("green"); close(); selectImage(imgname); close(); selectImage("Result of Analysis"); // SPECIFY WHERE YOU WANT TO HAVE STORED THE BINARY IMGS saveAs("Tiff", "ENTER PATH HERE"); close(); } selectWindow("Log"); // SPECIFIY WHERE YOU WANT TO HAVE STORED THE OUTPUT LOG FILE saveAs("Text", "ENTER PATH HERE"); print("Output written onto output file");