quantification package

quantification_tools

towbintools.quantification.quantification_tools.compute_background_fluorescence(image: ndarray, foreground_mask: ndarray, aggregation: str = 'mean') float[source]

Estimate the background value of an image.

Parameters:
  • image (np.ndarray) – The image as a NumPy array.

  • foreground_mask (np.ndarray) – The binary mask of the foreground as a NumPy array.

  • aggregation (str) – The aggregation method to use to estimate the background value. Can be either ‘mean’, ‘median’, or ‘min’.

Returns:

The estimated background value of the image.

Return type:

float

towbintools.quantification.quantification_tools.compute_fluorescence_in_mask(image: ndarray, mask: ndarray, aggregations: list[str] = ['sum'], background_aggregation: str | None = None) dict[str, float][source]

Quantify fluorescence of an image in a mask.

Parameters:
  • image (np.ndarray) – The image as a NumPy array.

  • mask (np.ndarray) – The binary mask as a NumPy array.

  • aggregations (list) – The list of aggregation methods to use to quantify the fluorescence. Can be one or more of ‘sum’, ‘mean’, ‘median’, ‘max’, ‘min’, or ‘std’.

Returns:

A dictionary with the aggregation methods as keys and the corresponding fluorescence values as values.

Return type:

dict