//Macro to stictch a DV-collected panel data set. //Chris Gell 11-07-2018 //Version 1 //open a series from a .dv file, save them out so sinple Fiji stitching works. //You need to edit the last line to say what the gid size was (eg. 7x7, 5x2). //currently only supports single channels. setBatchMode(true); open(); //see if any images are open. if (nImages<=1) { // Dialog.create(""); Dialog.addMessage("Too few images open, open at least 2 images."); Dialog.show(); exit; } //where to save everything dir = getDirectory("Choose a Directory for saving"); //create an array with a list of open window names n = nImages; setBatchMode(true); for (i=1; i<=n; i++) { selectImage(i); rename("tile_"+i); title = getTitle; saveAs("tiff", dir+title); } setBatchMode(false); //edit the grid size in this line run("Grid/Collection stitching", "type=[Grid: snake by rows] order=[Right & Down ] grid_size_x=17 grid_size_y=31 tile_overlap=1 first_file_index_i=1 directory="+dir+" file_names=tile_{i}.tif output_textfile_name=TileConfiguration.txt fusion_method=[Linear Blending] regression_threshold=0.30 max/avg_displacement_threshold=2.50 absolute_displacement_threshold=3.50 computation_parameters=[Save memory (but be slower)] image_output=[Fuse and display]");