Skip to content

Setting up seamless stitching

Rob Campbell edited this page Oct 7, 2019 · 3 revisions

Hardware requirements

The GIST algorithm will run best on a machine with many cores if it is to complete in a reasonable time. Although the algorithm is multi-threaded, it doesn’t seem to speed up a great deal as more threads are added. On an 8 core i7, the best way to get speed is run each image on perhaps 2 to 4 cores and run about 12 images simultaneously. You will end up running about 100 threads this way, which seems crazy but it works. Unfortunately, the implementation of the algorithm does have a tendency to hang from time to time. applyGIST2section_BATCH attempts to catch these occurrences, kill processes associated with a stalled section and restart them. The function works on Linux only (maybe on the Mac too if you can compile the DMG binaries for it). As of this writing, this approach works well but isn’t perfect. Please check, therefore, whether all sections have been produced before conducting further analyses. You can re-run applyGIST2section_BATCH with the overwrite flag disabled in order to generate any images that were missed the first time.

Setting up

To run the seamless stitcher, StitchIt requires external binaries (written in C++). To follow these instructions you will need to be familiar with compiling applications from the Linux command line and other related administrative tasks. The source code, instructions, and reference are at: https://github.com/mkazhdan/DMG. The website provides Windows executables and source code for compiling on Linux. You will need Boost installed on your system. We've got this to work with both version 1.55 and on Ubuntu 16.04 by installing version 1.58 via the package manager. Once installed, the binaries can be called directly from the system command line (put it in your system path). To run the analysis you need access to the assembled sections where the tiles have been placed without any blending at tile edges. The algorithm also needs access to a mask file that indicates where the tile edges are. The seamless stitcher currently only works with full size images (the stitchedImages_100 directory). In this directory are the stitched images and also a sub-directory called details that contains a CSV file for each stitched image. These CSV files log where the tiles are placed. The format is: top left pixel x position, width of tile in x, top left pixel y position, width of tile in y. The function applyGIST2section uses this CSV file to construct a mask image. It applies this mask to the assembled section, produces the result, and returns the corrected image. The process is automated over a whole experiment with the applyGIST2section_BATCH. Since the seam removal process requires only a TIFF image and a CSV file, it is possible write a wrapper in any programming language of your choice.