//parallel version without any progress reporting //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/" //the main workhorse loop workers = parGetSize(); for (i = parGetRank(); i < 30; i += workers) { segmentHuhData(i); } // ========= no change in the functionality in the rest of the macro ========= function segmentHuhData(i) { print("worker #"+parGetRank()+" is working on part: "+i); load(i); setAutoThreshold("Default dark"); setOption("BlackBackground", false); run("Convert to Mask"); run("Invert LUT"); run("Erode"); run("Erode"); run("Erode"); run("Erode"); run("Erode"); save(i); close(); } 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; }