If a mask is passed then only the region within the mask is shuffled.
If shuffle_partial then partially masked blocks will be shuffled otherwise
only fully masked blocks are. The inplace mode is much faster but cannot shuffle
array edges.
Parameters:
x (ndarray) – array
block (tuple[int, ...]) – block shape, same dims as x
mask (ndarray | None) – mask, same shape as x, optional
First x is enlarged by pixelsize then list of offsets are applied
across axis 2 of x. If the first offset is not (0, 0) then it is prepended.
Given offsets of [(0, 0), (1, 1)] and pixelsize of (2, 2) each layer
will be streched by 2 and every 2nd layer will be shifted by 1 pixel.
Parameters:
offsets (list[tuple[int, int]]) – pixel offsets in (x, y)
Costes, S. V.; Daelemans, D.; Cho, E. H.; Dobbin, Z.; Pavlakis, G.
& Lockett, S. Automatic and Quantitative Measurement of Protein-Protein
Colocalization in Live Cells Biophysical Journal, Elsevier BV,
2004, 86, 3993-4003
pewlib.process.colocal.costes_threshold(x, y, target_r=0.0)
Calculates Costes thresholds.
Pearson’s R is calculated for values of x and y that are above an increasing
threshold. Once the calculated R value is above target_r the thresholds are
returned. The threshold for y equals ‘tx’ * ‘a’ + ‘b’.
Parameters:
x (ndarray) – array
y (ndarray) – array, same shape as x
target_r (float) – value of R at which stop incrementing
Costes, S. V.; Daelemans, D.; Cho, E. H.; Dobbin, Z.; Pavlakis, G.
& Lockett, S. Automatic and Quantitative Measurement of Protein-Protein
Colocalization in Live Cells Biophysical Journal, Elsevier BV,
2004, 86, 3993-4003
The intenisty correlation quotient calculates the number of pixels where both
x and y are above or below their means. A value of 0 indicates no correlation,
below 0 segregation and above 0 colocalisation.
Parameters:
x (ndarray) – array
y (ndarray) – array, same shape as x
Return type:
float
Returns:
value between -0.5 and 0.5
References
Li, Q. A Syntaxin 1, G o, and N-Type Calcium Channel Complex at
a Presynaptic Nerve Terminal: Analysis by Quantitative Immunocolocalization
Journal of Neuroscience, Society for Neuroscience, 2004, 24, 4070-4081
pewlib.process.colocal.manders(x, y, tx=None, ty=None)
Manders’ correlation coefficients.
Parameters:
x (ndarray) – array
y (ndarray) – array, same shape as x
tx (float | None) – threshold for x, defaults to x.min()
ty (float | None) – threshold for y, defaults to y.min()
Return type:
tuple[float, float]
Returns:
M1, factional overlap of x to y
M2, factional overlap of y to x
References
MANDERS, E. M. M.; VERBEEK, F. J. & J. A., ATEN
Measurement of co-localization of objects in dual-colour confocal images
Journal of Microscopy, Wiley, 1993, 169, 375-382
A value of 0 indicates no correlation, below 0 segregation and above 0
colocalisation.
Parameters:
x (ndarray) – array
y (ndarray) – array, same shape as x
Return type:
float
Returns:
value between -1 and 1
pewlib.process.colocal.pearsonr_probablity(x, y, block=3, mask=None, shuffle_partial=False, n=500)
Evalulates Probability of Pearson’s coefficient.
Calculates Pearson’s R of x and y then shuffles y n times, retesting
Pearson’s R. The probability is defined as the ratio of R’s produced by the
shuffling that are lower than the original R. Args block, mask and
shuffle_partial are passed to ‘shuffle_blocks’. Implemented as per
Costes [1].
Conv- and deconvolution have many applications in image processing such as
adding or removing blur. This module contains functions for performing 1-dimensional
convolutions as well as functions for creating various distributions.
Filtering can be used to remove artifacts, such as spikes, from images.
Care must be taken when using filtering to ensure that legitmate data is not
also altered.
Each value of x is compared to the mean of its block, the values arround it.
If it is threshold times the standard deviation with the central value then
it is considered an outlier. Outliers are set to the local mean without the
central value.
Parameters:
x (ndarray) – array
block (int | tuple[int, ...]) – size of window, int or same dims as x
threshold (float) – number of stddevs away from mean to consider outlier
Each value of x is compared to the median of its block, the values arround it.
If it is threshold times the stdev from the median then it is considered an
outlier. Outliers are set to the local median.
Parameters:
x (ndarray) – array
block (int | tuple[int, ...]) – size of window, int or same dims as x
threshold (float) – number of SDs (via MAD) away from median to consider outlier