var Diameter="-"; var AnnoPath=getDirectory("home"); var title="blank"; macro "close cell count [c]" { //DEPENDENCIES: GET_BASENAME, DEFINE_PATH, CLOSE_ALL_WINDOWS //mdoc: finalizes cell count by writing the individual counts as well as the overall sum into a comma separated spreadsheet (*.cc.tsv). this spreadsheet is automatically stored in a folder "cellcount" in the annotation folder. if this folder does not exist, it will be created. sum=0; for (i=0; i0; h--) { cs=getSliceNumber(); if (cs == 1){ ps = cs; } else { ps=cs-1; } h2=height-height/h; w2=width-width/h; h3=round(h2); w3=round(w2); setSlice(ps); if (bitDepth() == 24) { setForegroundColor(255,128,0); } else { // setForegroundColor(0,0,0); setForegroundColor(255,255,255); fillOval(x+width/2-w2/2, y+height/2-h2/2, w2, h2); setForegroundColor(200,200,200); } drawOval(x+width/2-w2/2, y+height/2-h2/2, w2, h2); // here is the drawing act } setSlice(ms); for (h=k+1; h>0; h--) { cs=getSliceNumber(); if (cs == nSlices){ ps = cs; } else { ps=cs+1; } h2=height-height/h; w2=width-width/h; h3=round(h2); w3=round(w2); setSlice(ps); if (bitDepth() == 24) { setForegroundColor(0, 0, 255); } else { // setForegroundColor(0,0,0); setForegroundColor(255,255,255); fillOval(x+width/2-w2/2, y+height/2-h2/2, w2, h2); setForegroundColor(100,100,100); } drawOval(x+width/2-w2/2, y+height/2-h2/2, w2, h2); // here is the drawing act } roiManager("Delete"); } setBatchMode(false); setKeyDown("none"); selectWindow(title); if (si) { print("saving image to "+AnnoPath+"cellcount/"+basename+".cc.tif"); saveAs("Tiff", AnnoPath+"cellcount/"+basename+".cc.tif"); rename("title"); } } //============== //fdoc: defines the size of the mark of the cell counter. function CONFIGURE_MARKS() { //DEPENDENCIES: non functionID="CONFIGURE_MARKS"; setTool(1); getSelectionBounds(x, y, width, height); if (x+y == 0) { exit("Size of cells is not defined. \nHit OK here and then \ndraw ellipse around a sample cell\n or select one from the ROI manager."); } else { w=width; h=height; Diameter=(w+h)/2; } setTool(12); } //============== //fdoc: GET_BASENAME generates the basename from the input it gets passed and writes it to memory, breaks down a standardized file name into its components and writes each of them into the IJ-memory-file. Because this is rather slow GET_FAST_BAESNAME was developed which omits the memory step. function GET_BASENAME(input) { //DEPENDENCIES: DEFINE_PATH, LIST_LOADER, DIRECT_LOADER, STRIP_BASENAME, READ_MEMORY functionID="GET_BASENAME"; if(input == "emptyString") { pat=getTitle(); } else { pat=input; } // basename=exec("sh", "-c", "echo "+pat+"|cut -d \".\" -f 1"); tmp=split(pat, "."); basename=tmp[0]; basename=split(basename, "\n"); basename=basename[0]; return basename; }