Setting up syncAndCrunch

A typical data set consists of tens of thousands of TIFFs. The goal of StitchIt is to assemble (stitch) these small tiles into planes, such that each channel of each optical section is stored in a single large TIFF image. Once the data have been stitched, StitchIt offers further tools to correct for artifacts and facilitate subsequent analyses.
Serial 2-photon tomography systems have good resolution but the acquisition session might last anywhere from a few hours, to a few days for galvo-based systems. StitchIt has a tool called syncAndCrunch that pre-processes tiles during acquisition, displays the last completed slice on the web, and automatically stitches the data at the conclusion of acquisition. This is useful since pre-processing of the images is more time consuming than stitching. We have found monitoring the state of the acquisition to be enormously helpful. In the past we have used this to rescue samples that would otherwise have been lost to things like laser instability, too much or too little laser power, incorrect PMT gain, air bubbles on the objective, etc.

Setting up to analyse during acquisition

Data are streamed directly from the acquisition machine to an analysis PC. The syncAndCrunch function running on the analysis machine periodically pulls data off the acquisition PC for pre-processing. Stitching is conducted automatically once acquisition completes. Stitched datasets that pass quality criteria are stored long-term on a large secure server. The analysis machine can only holds a limited number of data sets and are not secure.

Running syncAndCrunch

The following is an example of how to start an analysis session in MATLAB. It is highly recommended to run this from within tmux: the session will be persistent and you can attach to it remotely over the command line without needing virtual desktop.
The above command initiates a cycle that alternates between copying data from the buffer server to the local disk on the analysis machine, processing those data, and displaying a preview of the last completed section to the web. syncAndCrunch searches for a currently running acquisition and works on that.
Should you need to force it to stop (e.g. you finished the acquisition early) then do one of the following:
  • Create a file called ‘FINISHED’ on the analysis machine or acquisition machine in the sample directory. syncAndCrunch will notice it and start stitching.
syncAndCrunch assembles stitched images at the end of acquisition because it uses all available tiles to calculate the grand average images used for illumination correction. Stitched data are stored as one tiff per optical section in a directory called stitchedImages_100. Data from each channel are stored in separate sub-directories. See here for a more detailed walk-through of the process.

Configuring syncAndCrunch

In addition to the command-line arguments, syncAndCrunch (and other StitchIt functions) reads settings from an INI file (e.g. define the webserver to which preview images are kept). You should set up the INI file for your system before attempting to use syncAndCrunch. Make sure you set up a valid landingDir, which is where the data will be sent on your analysis machine.
If syncAndCrunch starts to run but then no images appear on the web and the transfer of data from the acquisition PC to the analysis PC seems to stop, you should check that StitchIt/code/processDuringAcquistion/ is executable by the user running the command.