Skip to content
Lee Kamentsky edited this page Apr 3, 2018 · 3 revisions

Lab notes for TSV usage

This page documents the Chung lab's use of TSV and Terastitcher. It's specific to our internal setup, so much of it isn't generally applicable. If anything here is incorrect or doesn't work, email Lee.

Preparing files for Terastitcher.

Files should be in Z-stacks in nested directories. The top-level directory is the X stage position of the file and the second-level directory is the X and Y stage position, separated by an underbar. The Z-stack for that acquisition is then named using the Z stage position, padded to 6 digits on the left with zeros, e.g.:


Color_0
  Color_0/072940
    Color_0/072940/072940_033370
      064730.tiff
      064760.tiff
      064760.tiff
         ...
      145310.tiff

If you need your files renumbered with leading zeros, you can use tsv-renumber to do it.

> activate terastitcher
> tsv-renumber --help
usage: tsv-renumber [-h] [--n-digits N_DIGITS] path-to-hierarchy-root

positional arguments:
  path-to-hierarchy-root
                        The root directory of the stack tree

optional arguments:
  -h, --help            show this help message and exit
  --n-digits N_DIGITS   The number of digits in the final file name.
> tsv-renumber x:\...\Color_0

Running Terastitcher

On IM1, open a terminal window by typing "cmd" into the bar labeled "Type here to search" and hit Enter. Change to the root directory of your stack (in the case above, "Color_0"). Type:


Color_0> activate terastitcher
(terastitcher) Color_0> c:\Terastitcher-portable\terastitcher -1 --volin="%CD%" --ref1=H --ref2=V --ref3=D --vxl1=1.6 --vxl2=1.6 --vxl3=1 --projout=xml_import.xml --sparse_data
(terastitcher) Color_0> set N_PROCESSORS=15
(terastitcher) Color_0> python c:\Users\User\Documents\Lee\mpstitcher.py -2 --projin="%CD%\xml_import.xml" --projout="%CD%\xml_displacement.xml"
(terastitcher) Color_0> c:\Terastitcher-portable\terastitcher -3 --projin="%CD%\xml_displacement.xml" --projout="%CD%\xml_displproj.xml"
(terastitcher) Color_0> mkdir ..\Color_0_stitched
(terastitcher) Color_0> tsv-convert-2D-tif --xml-path xml_displproj.xml --output-pattern "..\Color_0_stitched\img_{z:04d}.tiff" --cpus 15 

Notes:

  • --vxl1 and --vxl2 are the x and y voxel sizes in microns. --vxl3 is the z size.
  • The N_PROCESSORS environment variable determines the number of CPUs to use during the displacement calculation phase. There are 44 CPUs on IM1, but the displacement phase is I/O limited and there's no gain to using more CPUs after a certain point.
  • mkdir ..\Color_0_stitched creates the target directory for the images. You can change this to whatever suits you as long as you similarly change the --output-pattern argument to tsv-convert-2D-tif
  • For help with tsv-convert-2d-tif, see the README.md file.

Clone this wiki locally