Submodule containing classes and functions relative to batch processing.

This submodule introduce the notion of multichannel acquisition which can be either the folder structure resulting from a given microscope acquisition or a converted acquisition (usually living in the original acquisition folder).

The default (converted) folder is saved in the first acquisition folder with the following structure:


0_1.apr … n_m.apr


0_1.apr … n_m.apr

… chx/0_0.apr

0_1.apr … n_m.apr

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.batcher.multiChannelAcquisition(path)[source]

Bases: object


Class to store a multichannel acquisition.

3 cases can occur:
  • Only APR data is available (e.g. raw data was deleted) then tiles_list is None and conversion can’t be done anymore.

  • APR data is not available (e.g. conversion was never done) then tiles_apr is None until conversion is done and stitching and reconstructions are not possible.

  • Both APR and raw data are available.


path (str) – path to folder containing the acquisition.

_get_Ip_th(tiles, method)[source]

Function to compute the intensity threshold value (Ip_th) automatically.

  • tiles (paprica.parser.tileParser) – tileParser object to compute Ip_th for.

  • method (str) –

    method to compute Ip_th automatically: - ‘black_corner’: compute Ip_th as the mean of the first tile in the top left corner (50 x 50 pixels). This

    methods works if there is no signal in the top left part of the acquisition (which is usually the case).

Return type

The intensity threshold computed using the given method.


Get the acquisition type (type of microscope used to acquire the data). If acquisition type is APR it means that the raw data is not available.


tiles.type – microscope used to acquire the data

Return type



Function to get the list of tiles (one tileParser object for each channel) for raw, APR or both.


  • tiles_list (list) – list containing the tileLoader objects for each channel for the raw data

  • tiles_list (list) – list containing the tileLoader objects for each channel for the APR data

convert_all_channels(Ip_method='black_corner', Ip=None, force_convert=False, rel_error=0.2, gradient_smoothing=2, dx=1, dy=1, dz=1, lazy_loading=True, tree_mode='mean')[source]

Function to convert all the channel to APR. The intensity threshold Ip_th is automatically determined using the provided method or passed as a list.

  • Ip_method (str) – Method to compute Ip_th automatically

  • Ip (list) – List of Ip_th to be used for the conversion

  • 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

  • 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



Reconstruct all channels in 3D at a lower resolution. Reconstructions are saved in the same folder as the APR data.


downsample (int) – downsample factor to use for the reconstruction.

Return type



Stitch the acquisition using the given channel.


channel (int) – Channel to compute the stitching on.

Return type