paprica.loader

Submodule containing classes and functions relative to data loading.

Usually, tileLoader objects are instantiated directly by iterating over the parser. Alternatively, they can be instantiated directly by the constructor by calling tile = paprica.loader.tileLoader().

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.loader.tileLoader(path, row, col, ftype, neighbors, neighbors_tot, neighbors_path, frame_size, folder_root, channel)[source]

Bases: object

Class to load each tile, neighboring tiles, segmentation and neighboring segmentation.

__init__(path, row, col, ftype, neighbors, neighbors_tot, neighbors_path, frame_size, folder_root, channel)[source]

Constructor of tileLoader object.

Parameters
  • path (string) – path to the tile (APR and tiff3D) or the folder containing the frames (tiff2D)

  • row (int) – vertical position of the tile (for multi-tile acquisition)

  • col (int) – horizontal position of the tile (for multi-tile acquisition)

  • ftype (str) – tile file type (‘apr’, ‘tiff3D’, ‘colm’, ‘clearscope’)

  • neighbors (list) –

    neighbors list containing the neighbors position [row, col] of only the EAST and SOUTH neighbors to avoid the redundancy computation when stitching. For example, below the tile [0, 1] is represented by an ‘o’ while other tile are represented by an ‘x’:

    x --- o --- x --- x
    |     |     |     |
    x --- x --- x --- x
    |     |     |     |
    x --- x --- x --- x
    |     |     |     |
    x --- x --- x --- x
    

    in this case neighbors = [[0, 2], [1, 1]]

  • neighbors_tot (list) –

    neighbors list containing all the neighbors position [row, col]. For example, below the tile [0, 1] is represented by an ‘o’ while other tile are represented by an ‘x’:

    x --- o --- x --- x
    |     |     |     |
    x --- x --- x --- x
    |     |     |     |
    x --- x --- x --- x
    |     |     |     |
    x --- x --- x --- x
    

    in this case neighbors_tot = [[0, 0], [0, 2], [1, 1]]

  • neighbors_path (list) – path of the neighbors whose coordinates are stored in neighbors

  • frame_size (int) – camera frame size (only square sensors are supported for now).

  • folder_root (str) – root folder where everything should be saved.

  • channel (int) – fluorescence channel for multi-channel acquisition. This is used to load the right data in the case of COLM acquisition where all the channel are saved in the same folder as tiff2D.

_erase_from_disk()[source]

Delete tile from disk, use with caution!

Return type

None

_load_clearscope(path)[source]

Load a sequence of images in a folder and return it as a 3D array.

Parameters

path (string) – path to folder where the data should be loaded.

Returns

v – numpy array containing the data.

Return type

array_like

_load_colm(path)[source]

Load a sequence of images in a folder and return it as a 3D array.

Parameters

path (string) – path to folder where the data should be loaded.

Returns

v – numpy array containing the data.

Return type

array_like

_load_data(path)[source]

Load data at given path.

Parameters

path (string) – path to the data to be loaded.

Returns

u – numpy array containing the data.

Return type

array_like

_load_raw(path)[source]

Load raw data at given path.

Parameters

path (string) – path to the data to be loaded.

Returns

u – numpy array containing the data.

Return type

array_like

lazy_load_segmentation(level_delta=0)[source]

Load the parts_cc lazily at the given resolution.

Parameters

level_delta (int) – parameter controlling the resolution at which the APR will be read lazily

Return type

None

lazy_load_tile(level_delta=0)[source]

Load the tile lazily at the given resolution.

Parameters

level_delta (int) – parameter controlling the resolution at which the APR will be read lazily

Return type

None

load_neighbors()[source]

Load the current tile neighbors if not already loaded.

Return type

None

load_neighbors_segmentation(load_tree=False)[source]

Load the current tile neighbors connected component (cc) if not already loaded.

Return type

None

load_segmentation(load_tree=False)[source]

Load the current tile connected component (cc) if not already loaded.

Return type

None

load_tile()[source]

Load the current tile if not already loaded.

Return type

None

plot_particles_size_distribution()[source]

Plot the particle size distribution of the tile.

Return type

None

view_tile(**kwargs)[source]

Display tile using napari.

Return type

None

paprica.loader.tile_from_apr(apr, parts)[source]

Function to generate a tile object from an APR object.

Parameters
  • apr (pyapr.APR) – APR to generate a tile from

  • parts (pyapr.ParticleData) – ParticleData to generate a tile from

Returns

tiletile containing the given APR

Return type

tileLoader

paprica.loader.tile_from_path(path)[source]

Function to generate a tile object from the path of an APR object.

Parameters

path (string) – path to the stored APR object

Returns

tiletile containing the given APR

Return type

tileLoader