reductionFactor = 2; title = getTitle; id = getImageID; w = getWidth; h = getHeight; d = nSlices; setBatchMode(true); run("Select All"); run("Duplicate...", "title=temp duplicate"); id2 = getImageID; run("Canvas Size...", "width="+(w+1)+" height="+h+" position=Top-Left zero"); a = getColumnsAndRows(d); run("Make Montage...", "columns="+a[0]+" rows="+a[1]+" scale=1 first=1 last="+d+" border=0"); rename("XY_"+title); selectImage(id2); close; selectImage(id); run("Reslice [/]...", "start=Top rotate avoid"); run("Reduce Size...", "reduction="+reductionFactor); w = getWidth; h = getHeight; d = nSlices; //run("Canvas Size...", "width="+(w+1)+" height="+h+" position=Top-Left zero"); id2 = getImageID; a = getColumnsAndRows(d); run("Make Montage...", "columns="+a[0]+" rows="+a[1]+" scale=1 first=1 last="+d+" border=0"); rename("XZ_"+title); selectImage(id2); close; selectImage(id); run("Reslice [/]...", "start=Left rotate avoid"); run("Reduce Size...", "reduction="+reductionFactor); w = getWidth; h = getHeight; d = nSlices; //run("Canvas Size...", "width="+(w+1)+" height="+h+" position=Top-Left zero"); id2 = getImageID; a = getColumnsAndRows(d); run("Make Montage...", "columns="+a[0]+" rows="+a[1]+" scale=1 first=1 last="+d+" border=0"); rename("YZ_"+title); selectImage(id2); close; selectImage(id); setBatchMode("exit and display"); exit; function getColumnsAndRows(size) { rows = floor(sqrt(size)); columns = rows; while (rows*columns