MicroscopeData

class pysmFISH.stitching_package.MicroscopeData.MicroscopeData(coord_data, y_flip, nr_dim)[source]

Retrieves and stores the tile set and corner coordinates of each tile from raw coordinate input.

y_flip: bool
It is assumed that the microscope coordinates have their origin in right top of the image. During the stitching we use the left, top as the origin. Therefore the x-coordinates will be inverted by the normalization. But not the y-coords. The y_flip variable is designed for the cases where the microscope sequence is inverted in the y-direction. When set to True the y-coordinates will also be inverted before determining the tile set.
x_coords: np.array
Array of x coordinates, will be loaded as raw microscope coordinates in um by init() and converted to pixels and normalized to start at zero by normalize_coords().
y_coords: np.array
Array of y coordinates, will be loaded as raw microscope coordinates in um by init() and converted to pixels and normalized to start at zero by normalize_coords().
z_coords: np.array
Array of z coordinates, will be loaded as raw microscope coordinates in um by init() and converted to pixels and normalized to start at zero by normalize_coords().
tile_nr: np.array
The numbers of the tiles as found in coord_data.
tile_set: np.array
Array with the same shape as the tile set, values indicate the index at which the corresponing tile is found in tiles and tile_nr.
running_av: float
The estimated overlap between two neighbouring tiles in pixels, adapted for the tiles we already know the placement and overlap of.
logger: logger
logger instance
check_tile_set(est_x_tol, nr_pixels, row_tol=None)[source]

Check if the estimated overlap between tiles is close enough to the running average.

est_x_tol: int
The distance between two tiles in the x-direction as estimated before reading all coordinates.
nr_pixels: int
The the width of the tile in pixels.
row_tol: int
The distance between y coordinates above which a tile is considered to belong to a new row, this value is passed directly to make_tile_set. (default = None)
make_tile_set(est_x_tol, nr_pixels, row_tol=None)[source]

Based on the coordinates find a tile set.

Use the coordinates to produce a tile set that has the shape of the grid the tiles should be placed on and for each tile in this grid gives the index for the tile_nr, x_coords and y_coords. Plots the coordinates when plot_avaible == True in inout.

est_x_tol: int
The estimated difference in the x direction between the corners of two neighbouring tiles in pixels
nr_pixels: int
Needed to estimate the distance between two separate tiles
row_tol: int
Row tolerance in pixels: The distance between y coordinates above which a tile is considered to belong to a new row. Default is None, which leads to 0.5 * nr_pixels.
normalize_coords(pixel_size)[source]

Normalize the coordinates and put the origin in upper left corner. Takes list with absolute index, x, y values from microscope and normalizes, converts and inverts them to get the coordinates in pixels with the origin in left upper corner.

NB:In the new microscope setup the origin is in the bottom right corner.

pixel_size: float
The size of one pixel in the microscope image, used to convert the microscope coordinates to pixels.