paprica.converter
Submodule containing classes and functions relative to converting tiles to APR.
The general workflow is first to parse tiles using a parser object and then convert using the tileConverter class. This class is essentially a wrapper to pyapr which allows to facilitate batch conversions and batch reconstructions.
By using this code you agree to the terms of the software license agreement.
© Copyright 2020 Wyss Center for Bio and Neuro Engineering – All rights reserved
- class paprica.converter.tileConverter(tiles: paprica.parser.baseParser)[source]
Bases:
object
Class to convert tiles to APR or to tiff.
- __init__(tiles: paprica.parser.baseParser)[source]
Constructor for the tileConverter class.
- Parameters
tiles (baseParser) – parser object referencing tiles to be converted.
- batch_convert_to_apr(Ip_th=108, rel_error=0.2, gradient_smoothing=2, dx=1, dy=1, dz=1, path=None, lazy_loading=True, tree_mode='mean', progress_bar=True)[source]
Convert all parsed tiles to APR using auto-parameters.
- Parameters
Ip_th (int) – Intensity threshold
rel_error (float in [0, 1[) – relative error bound
gradient_smoothing ((float)) – B-Spline smoothing parameter (typically between 0 (no smoothing) and 10 (LOTS of smoothing)
dx (float) – PSF size in x, used to compute the gradient
dy (float) – PSF size in y, used to compute the gradient
dz (float) – PSF size in z, used to compute the gradient
path (str) – path to save the converted APR data (defaut is creating a folder named APR in the raw data directory.
lazy_loading (bool) – if lazy_loading is true then the converter save mean tree particle which are necessary for lazy loading of the APR. It will require about 1/7 more storage.
tree_mode (str ('mean' or 'max')) – controls how downsampled particles are computed. Either the mean or the max is taken.
- Return type
None
- batch_reconstruct_pixel(mode='constant', progress_bar=True)[source]
Reconstruct all APR tiles to pixel data.
- Parameters
mode (string) – reconstruction mode, can be ‘constant’, ‘smooth’ or ‘level’
- Return type
None
- deactivate_compression()[source]
Deactivate B3D compression when saving particles.
- Return type
None
- set_compression(quantization_factor=1, bg=108)[source]
Activate B3D compression for saving tiles.
- Parameters
quantization_factor (int) – quantization factor: the higher, the more compressed (refer to B3D paper for more detail).
bg (int) – background value: any value below this threshold will be set to the background value. This helps save up space by having the same value for the background (refer to B3D paper for more details).
- Return type
None