/* * VSI Tiler macro * v1.18.06a * Developed by M Foley, Sydney Microscopy & Microanalysis, University of Sydney * Does not yet handle Z stacks all that well - need to think of a solution... * * */ macro "VSI_Tiler..." { dir = getDirectory("Where are your VSI files?"); bool_saveAndClose = 1; // Autosave TIFF stack doCommand("Monitor Memory..."); print("\\Clear"); information("Processing started for "+dir); fn_processFiles(dir); information("Processing complete"); selectWindow("Memory"); run("Close"); /*****************************/ function fn_processFiles(dir){ list = getFileList(dir); for (i=0; i tileSize) currentTileWidth = tileSize; for (y = 0; y < height; y += tileSize) { currentTileHeight = height - y; if (currentTileHeight > tileSize) currentTileHeight = tileSize; selectWindow(image); makeRectangle(x, y, currentTileWidth, currentTileHeight); run("Duplicate...", "title=Tile duplicate"); getDimensions(w1,h1,null,null,null); if(w1 < tileSize || h1 < tileSize) {run("Canvas Size...", "width="+tileSize+" height="+tileSize+" position=Top-Left zero");} // Handling duplicates smaller than tile size if (stack ==0) { rename("Tiled "+image); stack +=1; } else {run("Concatenate...", " title=[Tiled "+image+"] open image1=[Tiled "+image+"] image2=Tile image3=[-- None --]");} setMetadata("Label", "(x=" + x + ",y=" + y + ")"); } // y loop close } // x loop close } // fn_processTiles close brace /*****************************/ function minimum(a,b){ result = a; if (ba) result = b; return result; } function roundTo(value, magnitude){ result = round(value/pow(10, magnitude))*(pow(10, magnitude)); return result; } function padZero(a, left){ while(lengthOf(""+a)