Package: pystripe
pystripeAn image processing package for removing streaks from SPIM imagesPystripe implements two different destriping algorithms. The first uses
wavelets to deconvolve along the striping direction. The second uses a
combination of background estimation from a linear patch in the striping
direction and a square background patch. It is adapted
fromhttps://github.com/ChristophKirst/ClearMap2Kirst, et al. "Mapping the Fine-Scale Organization and Plasticity of the Brain Vasculature."
Cell 180.4 (2020): 780-795.https://doi.org/10.1016/j.cell.2020.01.028Renier et al. "Mapping of brain activity by automated volume analysis of immediate early genes."
Cell 165.7 (2016): 1789-1802.https://doi.org/10.1016/j.cell.2016.05.007importpystripe# filter a single imagefimg=pystripe.filter_streaks(img,sigma=[128,256],level=7,wavelet='db2')# batch process images in a directory (and subdirectories)pystripe.batch_filter(input_path,output_path,workers=8,sigma=[128,256],# foreground, backgroundlevel=7,wavelet='db2')A typical result looks like this:Installation>pipinstallpystripeCommand-line interface (CLI)The following application is available from the command-line
after installing:pystripe: batch streak elimination using wavelet and FFT filteringThis application filters horizontal streaks in input images using FFT filtering
of wavelet coefficients. When provided a single image path, it will filter the
provided image. When provided a directory, it will traverse the input directory
and filter all.rawor.tif*images. The resulting images will be saved
as (compressed) tiffs in a new folder next to the input directory with_destripedappended.Arguments forpystripeCLI:--input, -i: (str) path to a single image or a directory with images to filter--output, -o: (str, optional) path to a single image or a directory to write to.
Parent directories will be created as needed. Note that setting the output to the input
will overwrite the original image(s). Default is either to write the result frommy/img/input.tiftomy/img/input_destriped.tifor results frommy/folder/tomy/folder_destriped/.--sigma1, -s1: (float) bandwidth of the stripe filter for the foreground--sigma2, -s2: (float, optional) bandwidth of the stripe filter for the background.
Default is 0, indicating no background destriping.
Ifsigma1 == sigma2 != 0, then the image will not be decomposed into foreground and background images.--level, -l: (int, optional) number of wavelet decomposition levels. Default is the maximum
possible given the image shape--wavelet, -w: (str, optional) name of the mother wavelet. Default is'db2'.
SeePyWaveletsfor more options.--crossover, -x(float, optional) intensity range to transition between foreground and background bands.
Default is 10.--workers, -n: (int, optional) number of cpu workers to use in batch processing. Default is cpu_count()--chunks: (int, optional) number of images each worker processes at a time. Default is 1--compression, -c: (int, optional) compression level (0-9) for writing tiffs. Default is 1--lightsheet: (switch) if present, use the method of Kirst, et. al.
If absent, use wavelets--artifact-length: (int, optional) the length of the lightsheet line that
is used to estimate the background in the presence of lightsheet streaks--background-window-size: (int, optional) the size in x and y of the
background window to use as an alternate background estimation--percentile: (float, optional) the percentile at which to measure
background--lightsheet-vs-background: (float, optional) the weighting factor
to use when comparing the lightsheet and background estimates. Higher
favors the background method.Batch scriptThescripts/directory contains a Windows batch script for runningpystripewithin the
current working directory. In order to use the script as is, pystripe must be installed within a conda environment
named "pystripe" (see Installation). Also, the script itselfcannotbe namedpystripe.batbecause Windows will assume the script is calling itself rather than thepystripe.exeon thePATH. Feel free to adjust the parameters or add any of the additional arguments mentioned above.AuthorsPystripe is maintained by members of theKwanghun Chung Labat MIT.