Skip to content

Getting Started

Jordan Matelsky edited this page Apr 11, 2016 · 4 revisions

Here are some tips on how to get started using pyrastitcher.

Setup

from pyrastitcher import Pyrastitcher

pst = Pyrastitcher(verbose=False, terastitcher_path="~/terastitcher")

By default, pyrastitcher will look for the terastitcher executable as a standalone terastitcher on the OS's PATH. If this is not the case, you must specify it explicitly. Pyrastitcher is not verbose, by default.

Importing

This example uses the demo data from the TeraStitcher documentation.

import_xml = pst.import_folders('./mouse.cerebellum.300511.sub3/tomo300511_subv3',
                                refs=('y', '-x', 'z'),
                                voxel_size=(0.8, 0.8, 1))

Aligning

Here's where pyrastitcher differs from just a naïve wrapper: It remembers your last command, and if the next function you run requires an XML input, it will automatically "remember" the last output, and use that as input. That is, this is a valid next step:

align_xml = pst.align()

And so is this, which is more explicit, but functions exactly the same:

align_xml = pst.align(xml=import_xml)

Note: The alignment step is very CPU-intensive and will probably pin your CPUs and RAM for a while.

...and the rest...

pst.project()
pst.threshold(0.7)
pst.place()

Merge!

Note that this last step is generally pretty time-consuming as well, so you should plan to get your coffee... now.

pst.merge(volout='.') # output to the current directory

Note that neither Python nor TeraStitcher have permission to make nested directories, so the folder that you specify in volout must already exist.

Clone this wiki locally