//parallel version with progress reporting, one progress bar per one image //the path is valid for my space on the cluster INFOLDER = "/storage/brno2/home/xulman/EXAMPLE/Fluo-C2DL-Huh7/01/" OUTFOLDER = "/storage/brno2/home/xulman/EXAMPLE/Fluo-C2DL-Huh7/01_Fiji/" //create all progres bars beforehand workers = parGetSize(); for (i = parGetRank(); i < 30; i += workers) { parAddTask("Img: "+i); } parReportTasks(); parReportText("starting the main loop"); //the main workhorse loop for (i = parGetRank(); i < 30; i += workers) { segmentHuhData(i); } //uncomment the debug if you're curious // print("this work has happened on:") // exec("sh","-c","hostname") // ========= no change in the functionality in the rest of the macro ========= function segmentHuhData(i) { print("worker #"+parGetRank()+" is working on part: "+i); load(i); pbId = floor(i/workers); parReportProgress(pbId, 20); setAutoThreshold("Default dark"); setOption("BlackBackground", false); run("Convert to Mask"); run("Invert LUT"); run("Erode"); run("Erode"); run("Erode"); run("Erode"); run("Erode"); parReportProgress(pbId, 80); save(i); close(); parReportProgress(pbId, 100); } function load(i) { open(INFOLDER+"t"+padding(i,3)+".tif"); } function save(i) { saveAs("Tiff", OUTFOLDER+"seg"+padding(i,3)+".tif"); } function padding(i, width) { asStr = "000000000000000"+i; l = lengthOf(asStr); asStr = substring(asStr,l-width,l); return asStr; }