PYME.Analysis.points.cluster_morphology module¶
- PYME.Analysis.points.cluster_morphology.get_labels_from_image(label_image, points, minimum_localizations=1)¶
Function to extract labels from a segmented image (2D or 3D) at given locations.
TODO - Move this somewhere more sensible and drop minimum_localizations in favour of post-filtering.
- Parameters
- label_image: PYME.IO.image.ImageStack instance
an image containing object labels
- points: tabular-like (PYME.IO.tabular, np.recarray, pandas DataFrame) containing ‘x’, ‘y’ & ‘z’ columns
locations at which to extract labels
- Returns
- ids: Label number from image, mapped to each localization within that label
- numPerObject: Number of localizations within the label that a given localization belongs to
- PYME.Analysis.points.cluster_morphology.measure_3d(x, y, z, output=None)¶
Calculates various metrics for a single cluster, whose 3D coordinates are input. ‘output’, an optional input argument, allows one to use a single structured array to contain measures for multiple clusters. See PYME.recipes.localisations.MeasureClusters3D
- Parameters
- xndarray
x-positions, typically in nanometers
- yndarray
y-positions, typically in nanometers
- zndarray
z-positions, typically in nanometers
- outputdict-like
If present, output will have measurements written into it, otherwise a structured array will be created and returned
- Returns
- outputdict-like, structured ndarray
dict-like object, typically a structured ndarray containing the following measurements: count : int
Number of localizations (points) in the cluster
- xfloat
x center of mass
- yfloat
y center of mass
- zfloat
z center of mass
- gyrationRadiusfloat
root mean square displacement to center of cluster, a measure of compaction or spatial extent see also supplemental text of DOI: 10.1038/nature16496
- median_abs_deviationfloat
median absolute deviation, i.e. median of the radius from the median (x, y, z) position of the cluster
- axis0ndarray, shape (3,)
principle axis which accounts for the largest variance of the cluster, i.e. corresponds to the largest eigenvalue
- axis1ndarray, shape (3,)
next principle axis
- axis2ndarray, shape (3,)
principle axis corresponding to the smallest eigenvalue
- sigma0float
standard deviation along axis0
- sigma1float
standard deviation along axis1
- sigma2float
standard deviation along axis2
- anisotropyfloat
metric of anisotropy based on the spread along principle axes. Standard deviations of alpha * [1, 0, 0], where alpha is a scalar, will result in an ‘anisotropy’ value of 1, i.e. maximally anisotropic. Completely isotropic clusters will have equal standard deviations, i.e. alpha * [1, 1, 1], which corresponds to an ‘anisotropy’ value of 0. Intermediate cases result in values between 0 and 1.
- thetafloat
Azimuthal angle, in radians, along which the principle axis (axis0) points
- phifloat
Zenith angle, in radians, along which the principle axis (axis0) points