Reference

m2stitch.stitching

This module provides microscope image stitching with the algorithm by MIST.

class m2stitch.stitching.ElipticEnvelopPredictor(contamination: float, epsilon: float, random_seed: int)
Parameters
  • contamination (float) –

  • epsilon (float) –

  • random_seed (int) –

m2stitch.stitching.stitch_images(images, rows=None, cols=None, position_indices=None, position_initial_guess=None, overlap_diff_threshold=10, pou=3, full_output=False, row_col_transpose=True, ncc_threshold=0.5)

Compute image positions for stitching.

Parameters
  • images (np.ndarray) – the images to stitch.

  • rows (list, optional) – the row indices (tile position in the second last dimension) of the images.

  • cols (list, optional) – the column indices (tile position in the last dimension) of the images

  • position_indices (np.ndarray, optional) – the tile position indices in each dimension. the dimensions corresponds to (image, index) ignored if rows and cols are not None.

  • position_initial_guess (np.ndarray, optional) – the initial guess for the positions of the images, in the unit of pixels.

  • overlap_diff_threshold (10) – the allowed difference from the initial guess, in percentage of the image size. ignored if position_initial_guess is None

  • pou (Float, default 3) – the “percent overlap uncertainty” parameter

  • full_output (bool, default False) – if True, returns the full comptutation result in the pd.DataFrame

  • row_col_transpose (bool, default True) – if True, row and col indices are switched. only for compatibility and the default value will be False in the future.

  • ncc_threshold (Float, default 0.5) – the threshold of the normalized cross correlation used to select the initial stitched pairs.

Returns

  • grid (pd.DataFrame) – the result dataframe with the rows “x_pos” and “y_pos” whose values are the absolute positions.

  • prop_dict (dict) – the dict of estimated parameters. (to be documented)

Return type

Tuple[DataFrame, dict]