PYME.Analysis.points.objectMeasure module

PYME.Analysis.points.objectMeasure.calcEdgeDists(objects, objMeasures)
PYME.Analysis.points.objectMeasure.getPrincipalAxis(obj_c, numIters=10)

PCA via e.m. (ala wikipedia)

PYME.Analysis.points.objectMeasure.measure(object, min_edge_length, output=array([(0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])], dtype=[('objID', '<i4'), ('xPos', '<f4'), ('yPos', '<f4'), ('NEvents', '<i4'), ('Area', '<f4'), ('Perimeter', '<f4'), ('majorAxisAngle', '<f4'), ('stdMajor', '<f4'), ('stdMinor', '<f4'), ('lengthMajor', '<f4'), ('lengthMinor', '<f4'), ('moments', '<f4', (25,)), ('momentErrors', '<f4', (25,))]))

Calculates a number of measurements for a collection of points (as outlined in dtype above).

Note: All parameters except Area and Perimeter do not require any form of segmentation and are parameter free. Area and Perimeter are calculated using a Delaunay triangulation of the points. To allow accurate measurements of non-convex objects, triangles are cropped from the tessellation if their edge length exceeds a threshold given by min_edge_length. The value of min_edge_length determines a length scale over which concave regions of the object border are smoothed out. For large min_edge_length you get the convex hull of the object points. A reasonable value for min_edge_length is probably in the range 10 <= min_edge_length <= 100, depending on object size, and localisation density.

For objects with a small number of points, the Area and Perimeter values will be highly influenced by localisation stochasticity and unreliable. A rough rule of thumb is that you should have at least 50 localisation events in an object before you can start to trust areas and perimeters. For lower event counts, the only (semi-)reliable metrics for object size are the std. deviations of the point positions (stdMajor and stdMinor) or the radius of gyration (TODO- ADD radius of gyration as a computed parameter).

For roughly circular clusters, an approximate ‘Area’ parameter can be derived from these as follows:

r = (2.35*((stdMajor + stdMinor)/2))/2 #calculate a FWHM based on the average std. dev, and divide by 2 to get a radius A = pi*r^2

For elongated clusters, a rectangular model and the product or the major and minor axis FWHMs might be better.

Parameters
objectshape [N, 2] numpy array

x, y positions of object localisations

min_edge_length: float

edge length in nm at which to cull triangles from the point convex hull when estimating cluster areas

output[optional] pre-allocated output array
Returns
an ndarray with dtype=measureDType containing the object measurements. Note that entries which are impossible to
compute (e.g. areas with nEvents < 3 and aligned measures with nEvents < 2) will be returned as 0.
PYME.Analysis.points.objectMeasure.measureAligned(object, measurements={})
PYME.Analysis.points.objectMeasure.measureObjects(objects, min_edge_length)
PYME.Analysis.points.objectMeasure.measureObjectsByID(filter, min_edge_length, ids, key='objectID')