cima.segments package
Submodules
cima.segments.segment_convex module
- class cima.segments.segment_convex.TransformConvex
Bases:
objectA class to generates alpha_shape and convex hull from a Segment instance.
- SR_ConvexHull(segment: Segment) tuple[ConvexHull, ndarray, float]
Returns a Map instance based on a Convex Hull rapresentation of a segment.
- Parameters:
segment (Segment instance) – array of Localisation objects
- SR_ConvexHull_array(segment: Segment) ndarray
Return a matrix for the hull. flood fill hull
- Parameters:
segment (Segment instance) – array of Localisation objects
- Returns:
fill_map – A binary array where points inside the convex hull are marked as 1 and points outside are marked as 0.
- Return type:
np.ndarray
- alpha_shape_3D(segment: Segment, alpha) tuple[ndarray, ndarray, ndarray]
Compute the alpha shape (concave hull) of a set of 3D points.
- Parameters:
segment (Segment instance) – array of Localisation objects
alpha (float) – alpha value.
Note (Alpha shape and concave hull are generalizations of convex hull. An Alpha shape with alpha set to 0 is the convex hull.)
- Return type:
Outer surface vertex indices, edge indices, and triangle indices
cima.segments.segment_features module
- cima.segments.segment_features.GetEccentricity(segment: Segment, verbose: bool = False) float | tuple[float, float, float, float]
Calculate the Eccentricity of a given segment based on its 3D coordinates.
- Parameters:
segment (Segment) – An object representing the segment for which the Eccentricity is to be calculated.
verbose (bool, optional) – If True, returns additional principal axis information. Defaults to False.
- Returns:
float – The Eccentricity.
or tuple[float, float, float, float] – If verbose is True, returns a tuple containing: - float: The Eccentricity. - float: The maximum eigenvalue. - float: The intermediate eigenvalue. - float: The minimum eigenvalue. - ndarray: The principal axis corresponding to the minimum eigenvalue. - ndarray: The principal axis corresponding to the intermediate eigenvalue. - ndarray: The principal axis corresponding to the maximum eigenvalue.
- cima.segments.segment_features.GetEllipticity(segment: Segment, verbose: bool = False) float | tuple[float, float, float, float, ndarray, ndarray, ndarray]
Calculate the ellipticity of a given segment based on its 3D coordinates.
- Parameters:
segment (An object representing the segment for which the ellipticity is to be calculated.)
verbose (bool, optional) – If True, returns additional principal axis information. Defaults to False.
- Returns:
float – The ellipticity.
or tuple[float, float, float, float, np.ndarray, np.ndarray, np.ndarray] – If verbose is True, returns a tuple containing: - float: The ellipticity. - float: The maximum eigenvalue. - float: The intermediate eigenvalue. - float: The minimum eigenvalue. - ndarray: The principal axis corresponding to the minimum eigenvalue. - ndarray: The principal axis corresponding to the intermediate eigenvalue. - ndarray: The principal axis corresponding to the maximum eigenvalue.
- cima.segments.segment_features.getMVEE(P: ndarray, tolerance: float = 0.1, max_iterations: int = 100)
Computes the Minimum Volume Enclosing Ellipsoid (MVEE) for a set of points.
This function calculates the smallest ellipsoid, by volume, that can enclose a given set of points in a d-dimensional space. The iterative algorithm adjusts weights assigned to each point until convergence is achieved within the specified tolerance.
- Parameters:
P (np.ndarray) – An (N, d)-shaped numpy array with each row representing a coordinate in d-dimensional space.
tolerance (float, optional) – Convergence tolerance for the iterative algorithm. Defaults to 0.1.
max_iterations (int, optional) – Maximum number of iterations for the algorithm. Defaults to 100.
- Returns:
c (np.ndarray) – A (d,)-shaped array representing the center of the ellipsoid.
V (np.ndarray) – A (d, d)-shaped array where each column represents the eigenvector of the ellipsoid’s principal axis directions.
rs (np.ndarray) – A (d,)-shaped array containing the lengths of the ellipsoid’s radii along the principal axes, sorted in descending order.
Both V and rs are sorted in order of decreasing radius length.
References
Moshtagh, N. (2005). Minimum volume enclosing ellipsoid. Convex optimization, 111(January), 1-9.
https://stackoverflow.com/questions/1768197/bounding-ellipse/1768440#1768440
- cima.segments.segment_features.getMVEEEccentricity(segment: Segment) float
Returns eccentricity (smallest radius over intermediate = flatness) of the MVEE of segment Based on T. Zingg classification (Beitrag Zur Schotteranalyse ETH Zurich, Switzerland (1935) Ph.D. thesis) Angelidakis, V., Nadimi, S., & Utili, S. (2022). Elongation, flatness and compactness indices to characterise particle form. Powder Technology, 396, 689-695.
- Parameters:
segment (Segment) – An object representing the segment for which the MVEE eccentricity is to be calculated.
- Returns:
The eccentricity of the MVEE of the segment, calculated as the ratio of the smallest radius to the intermediate radius.
- Return type:
float
- cima.segments.segment_features.getMVEEEllipticity(segment: Segment) float
Returns ellipticity (intermidiate radius over largest = elongation) of the MVEE of segment Based on T. Zingg classification (Beitrag Zur Schotteranalyse ETH Zurich, Switzerland (1935) Ph.D. thesis) Angelidakis, V., Nadimi, S., & Utili, S. (2022). Elongation, flatness and compactness indices to characterise particle form. Powder Technology, 396, 689-695.
- Parameters:
segment (Segment) – An object representing the segment for which the MVEE ellipticity is to be calculated.
- Returns:
The ellipticity of the MVEE of the segment, calculated as the ratio of the intermediate radius to the largest radius.
- Return type:
float
- cima.segments.segment_features.get_rgyration(segment: Segment) float
Calculate the radius of gyration for a given segment.
- Parameters:
segment (Segment) – An object representing the segment for which the radius of gyration is to be calculated.
- Returns:
The radius of gyration of the segment.
- Return type:
float
cima.segments.segment_gaussian module
- class cima.segments.segment_gaussian.TransformBlurrer
Bases:
objectA class to generate a density map from a Segment instance. Note that: segment classes represent coordinates as x,y,z. Map class instead represents them as z,y,x.
- static SRMap(struct: Segment, apix: float, resolution: float | None = None) Map
Returns an Map instance sized and centred based on the segment.
- static SR_gaussian_blur(segment: Segment, resolution: float, sigma_coeff: float = 1.0, mode: str = 'unit', normalise: bool = True, filename: str = 'None', verbose: bool = False, apix: float | None = None) Map
Returns a Map instance based on a Gaussian blurring of a segment. The convolution is done in reciprocal space.
- Parameters:
segment (Segment) – The segment to be blurred.
resolution (float) – The resolution of the blur.
sigma_coeff (float, optional) – The coefficient for the Gaussian blur, by default 1.
mode (str, optional) – The mode for the blur, by default “unit”. - unit: each localisation as an arbitrary size of 1 as in Nir et al., PloS Gen 2018
normalise (bool, optional) – Whether to normalise the map, by default True.
filename (str, optional) – The filename for the output map, by default “None”.
verbose (bool, optional) – Whether to display intermediate results, by default False.
apix (float, optional) – The pixel size in Angstroms, by default None.
- Returns:
The generated map.
- Return type:
- static areCoordsInMapBox(densMap: Map, map_relative_coords: ndarray) ndarray
Returns a boolean array specifying whether the input map_relative_coords are inside the densMap boundaries.
- Parameters:
densMap (Map) – The map to which the coordinates will be relative.
map_relative_coords (np.ndarray) – The coordinates to be checked, in z,y,x order.
- Returns:
A boolean array specifying whether map_relative_coords are inside densMap boundaries.
- Return type:
np.ndarray
- static getCoordsRelativeToMap(densMap: Map, coords: ndarray) ndarray
Returns coords converted to the densMap space. It scales and integerizes them appropriately. Moreover it rotates the axes, so that the final representation is z,y,x.
- Parameters:
densMap (Map) – The map to which the coordinates will be relative.
coords (np.ndarray) – The coordinates to be converted, in x,y,z order.
- Returns:
The converted coordinates, in z,y,x order.
- Return type:
np.ndarray
- static getCoordsRelativeToMapWithOriginalAxesOrder(densMap: Map, coords: ndarray) ndarray
Returns coords converted to the densMap space, but keeping the order of axes as x,y,z. It scales and integerizes them appropriately. Same as getCoordsRelativeToMap but without rotating axes.
- Parameters:
densMap (Map) – The map to which the coordinates will be relative.
coords (np.ndarray) – The coordinates to be converted, in x,y,z order.
- Returns:
The converted coordinates, in x,y,z order.
- Return type:
np.ndarray
- static getMapWithAttributeOverlayed(densMap, segment: Segment, attribute) Map
Returns a new Map instance with the attribute of the segment localizations overlayed on the input densMap.
- Parameters:
densMap (Map) – The map to overlay,
segment (Segment) – The segment of which the localizations are used to overlay,
attribute (str, number or callable) –
If str must be one of the predefined, each of which will define a behaviour. If number it will be directly used as overlay value.
If callable will be called on each row to produce the overlay value.
- Returns:
A new densMap equal to the input one but with the overlay.
- Return type:
cima.segments.segment_info_h5 module
- class cima.segments.segment_info_h5.SegmentH5(atomList: DataFrame | list | ndarray, metadata: dict = {}, pxcamera: float = 65.0)
Bases:
SegmentXYZA class representing an object Segment
- copy() SegmentH5
Create a copy of the SegmentH5 object. Ideally to use when you want to modify the segment, but keep the original one for reference.
- Returns:
Copy of Segment instance.
- Return type:
- copyWithNewContent(content: DataFrame | list | ndarray) SegmentH5
Create a copy of the SegmentH5 object with new content (DataFrame), but the same attributes as self.
- Parameters:
content (pd.DataFrame or list or np.ndarray) – New content to use in the copy of the SegmentH5 object. Should be a Data
- Returns:
A new object of this class, which has the provided content (DataFrame) but the attributes of self.
- Return type:
- static representSingleLocalization(loc: Series) str
Function to represent a single localization as a string, for example for printing the first and last localization of a segment.
- Parameters:
loc (pd.Series) – Series representing a localization
- Returns:
String representation of the localization
- Return type:
str
cima.segments.segment_info_xyz module
- class cima.segments.segment_info_xyz.SegmentXYZ(atomList: DataFrame | list | ndarray, metadata: dict = {})
Bases:
objectA class representing an object Segment
- Getcoord() ndarray
Get a numpy array of the x, y and z coordinates of the localizations in the segment.
- Returns:
Array of coordinates with shape (n_localizations, 3)
- Return type:
np.ndarray
- TimesIDs() ndarray
Get a list of unique timepoints in the segment object.
- Returns:
The unique timepoints identifiers in the segment object.
- Return type:
np.ndarray
- calculate_centre_of_mass() Vector
Calculate the centre of mass of the segment based on the x, y and z coordinates of the localizations.
- Returns:
Center of mass of Segment as a Vector instance.
- Return type:
- calculate_centroid() Vector
Return centre of mass of structure as a Vector instance.
- Returns:
Centre of mass of the structure as a Vector instance.
- Return type:
- copy() SegmentXYZ
Create a copy of the SegmentXYZ object. Ideally to use when you want to modify the segment, but keep the original one for reference.
- Returns:
Copy of Segment instance.
- Return type:
- copyWithNewContent(content: DataFrame | list | ndarray) SegmentXYZ
Create a copy of the SegmentXYZ object with new content (DataFrame), but the same attributes as self.
- Parameters:
content (pd.DataFrame or list or np.ndarray) – New content to use in the copy of the SegmentXYZ object. Should be a Data
- Returns:
A new object of this class, which has the provided content (DataFrame) but the attributes of self.
- Return type:
- getClusters(cluster_ids: list = []) SegmentXYZ | None
Get specific clusters from the segment.
- Parameters:
cluster_ids (list) – List of cluster IDs to retrieve.
- Returns:
A new segment object containing only the specified clusters, or None if no clusters are found.
- Return type:
SegmentXYZ or None
- getInRange(sel_range: ndarray) SegmentXYZ | None
Get a portion of the segment based on a range of indices.
- Parameters:
sel_range (np.ndarray) – Array of indices to select from the segment.
- Returns:
A new SegmentXYZ object containing only the localizations at the specified indices, or None if no localizations are selected.
- Return type:
SegmentXYZ or None
- getPortion(selection_array: ndarray) SegmentXYZ
Get a portion of the segment based on a boolean selection array.
- Parameters:
selection_array (np.ndarray) – Boolean array of the same length as the number of localizations in the segment, where True indicates that the corresponding localization should be included in the returned portion.
- Returns:
A new SegmentXYZ object containing only the selected localizations, or None if no localizations are selected.
- Return type:
SegmentXYZ or None
- Raises:
AssertionError – If the selection array is not of boolean type or if its length does not match the number of localizations in the segment.
ValueError – If no localizations are selected (i.e., if the sum of the selection array is zero).
- get_Cluster_segment(clusterID: int) SegmentXYZ | None
Get a specific cluster segment based on a cluster ID.
- Parameters:
clusterID (int) – Cluster ID to select from the segment.
- Returns:
A specific cluster segment in the segment object. If no segment with the specified cluster ID is found, None is returned.
- Return type:
SegmentXYZ or None
- get_Time_segment(timepoint: int) SegmentXYZ | None
Get a specific time segment based on a timepoint.
- Parameters:
timepoint (int) – Timepoint to select from the segment.
- Returns:
A new SegmentXYZ object containing only the localizations at the specified timepoint, or None if no localizations are found.
- Return type:
SegmentXYZ or None
- get_extreme_values() tuple[float, float, float, float, float, float]
Gets the minimum and maximum of x, y and z co-ordinates of the segment.
- Returns:
A 6-tuple containing the minimum and maximum of x, y and z co-ordinates of the segment. Given in order (min_x, max_x, min_y, max_y, min_z, max_z).
- Return type:
tuple of float
- get_multiple_Time_segment(timepoints: list[int] = []) SegmentXYZ | None
Get multiple time segments based on a list of timepoints.
- Parameters:
timepoints (list[int]) – List of timepoints to select from the segment.
- Returns:
A new SegmentXYZ object containing only the localizations at the specified timepoints, or None if no localizations are selected.
- Return type:
SegmentXYZ or None
- get_vector_list() ndarray
- Returns:
Array containing 3D Vector instances of positions of all atoms.
- Return type:
np.ndarray
- no_of_Cluster() int
Number of unique clusters in the segment object.
- Returns:
The number of unique clusters in the segment object.
- Return type:
int
- no_of_Times() int
Get the number of unique timepoints in the segment object.
- Returns:
The number of unique timepoints in the segment object.
- Return type:
int
- removeNoise() SegmentXYZ
Filters out noise by removing unclustered atoms from the segment. Note: The segment need to have a ‘clusterID’ column.
This method removes atoms in atomList that have a clusterID of -1, which typically represents noise or unclustered points. Only atoms with a valid clusterID are retained in the new segment.
- Returns:
A new segment object containing only the atoms with a clusterID not equal to -1. If no such atoms are found, an empty segment is returned.
- Return type:
- renumberTimeFromInt(start=1) SegmentXYZ | None
Returns a copy of this SegmentXYZ which has the timepoints renumbered in order from the specified start.
- Parameters:
start (int, optional) – The starting integer for renumbering the timepoints, by default 1. The timepoints will be renumbered in order of their current values, with the smallest current timepoint being assigned the value of start, the next smallest being assigned start + 1, and so on.
- Returns:
A new SegmentXYZ object with the renumbered timepoints, or None if the segment is empty
- Return type:
SegmentXYZ or None
- renumber_Time(newTime: int | ndarray) SegmentXYZ | None
Returns a copy of this SegmentXYZ which has newTime as timepoint value for all localizations. If newTime is numpy array of same length as the number of localizations, they will be assigned the timepoints specified in it respectively.
- Parameters:
newTime (int or np.ndarray) – New timepoint value(s) to assign to the localizations in the segment. If an integer is provided, all localizations will be assigned this timepoint. If a numpy array is provided it should be of the same length as the number of localizations in the segment, and each localization will be assigned the corresponding timepoint from the array.
- Returns:
A new SegmentXYZ object with the updated timepoints, or None if the segment is empty
- Return type:
SegmentXYZ or None
- static representSingleLocalization(loc: Series) str
Function to represent a single localization as a string, for example for printing the first and last localization of a segment.
- Parameters:
loc (pd.Series) – Series representing a localization
- Returns:
String representation of the localization
- Return type:
str
- set_cluster_ids(cluster_ids: ndarray | int)
Set the cluster IDs for the localizations in the segment.
- Parameters:
cluster_ids (np.ndarray or int) – np.array of ints and of length=len(self.atomList) or single number
- splitByValue(values: Series, verbose: bool = False) dict
Split a segment by arbitrary values. Useful for example to split by region of interest or homolog.
- Parameters:
values (pd.Series) – Series of values to split the segment by.
- Returns:
A dictionary with the given values (uniqued) as keys and the corresponding subsegments as values.
- Return type:
dict
- split_into_Clusters(return_list: bool = False, verbose: bool = False) dict | list
Splits the image into separate segments.
- Parameters:
return_list (bool, optional) – Whether to return a list of segments instead of a dictionary, by default False.
verbose (bool, optional) – Whether to print progress information during the splitting process, by default False.
- Returns:
A dictionary with cluster IDs as keys and Segment instances as values, or a list of Segment instances if return_list is True.
- Return type:
dict or list
- split_into_time() dict
Splits a walk into separate segments.
- Parameters:
return_list (bool, optional) – Whether to return a list of segments instead of a dictionary, by default False.
- Returns:
A dictionary with timepoints as keys and Segment instances as values, or a list of Segment instances if return_list is True.
- Return type:
dict or list
cima.segments.segment_info module
- class cima.segments.segment_info.Segment(atomList: DataFrame | list | ndarray, metadata: dict = {})
Bases:
SegmentXYZA class representing an object Segment
- ChromosomesIDs() ndarray
Get the unique chromosome IDs present in the segment.
- Returns:
An array containing the unique chromosome IDs in the segment object
- Return type:
np.ndarray
- GetMaxAccuracy() float
Return max accuracy.
- Returns:
The maximum accuracy value in the segment.
- Return type:
float
- GetMaxPrecision() list
Max precison in X,Y,Z.
- Returns:
A list containing the maximum precision values for the x, y, and z coordinates in the segment.
- Return type:
list
- GetMeanAccuracy() float
Return mean accuracy.
- Returns:
The mean accuracy value in the segment.
- Return type:
float
- GetMeanPrecision() list
Mean precison in X,Y,Z.
- Returns:
A list containing the mean precision values for the x, y, and z coordinates in the segment.
- Return type:
list
- GetMinAccuracy() float
Return min accuracy.
- Returns:
The minimum accuracy value in the segment.
- Return type:
float
- GetMinPrecision() list
Min precison in X,Y,Z.
- Returns:
A list containing the minimum precision values for the x, y, and z coordinates in the segment.
- Return type:
list
- OrderbyExperimenttime()
Orders the segment’s localisation list by experimental time.
This method sorts the entries in atomList by experimental variables such as cycle and z-step, which represent the order of data acquisition. Sorting by these parameters allows for analysis in the sequence they were collected.
- Returns:
A new segment object with atomList sorted by cycle and zstep.
- PSFz_shiftFilter(upperbound_factor: float = 500, lowerbound_factor: float = 0) Segment | None
Filters the segment’s localisation list by the shift in z between the localization and the PSF fit.
- Parameters:
upperbound_factor (float, optional) – The upper bound for the shift in z. Defaults to 500.
lowerbound_factor (float, optional) – The lower bound for the shift in z. Defaults to 0.
- Returns:
A new segment object with atomList filtered to include only entries with shiftz values between the specified upper and lower bounds. If no entries meet the criteria, a warning message is printed, and nothing is returned.
- Return type:
Segment or None
- PhotonCount_Filter(upperbound_factor: float = 500, lowerbound_factor: float = 0)
Filters the segment’s localisation list by the photon count of the PSF fit. :param upperbound_factor: The upper bound for the photon count. Defaults to 500. :type upperbound_factor: float, optional :param lowerbound_factor: The lower bound for the photon count. Defaults to 0. :type lowerbound_factor: float, optional
- Returns:
A new segment object with atomList filtered to include only entries with psfphotoncount values between the specified upper and lower bounds. If no entries meet the criteria, a warning message is printed, and nothing is returned.
- Return type:
Segment or None
- PrecisionFilter(factor: tuple[float, float, float] = (100, 100, 100)) Segment | None
Filters the segment’s localisation list by precision.
This method filters out entries in atomList where the positional precision (for x, y, and z coordinates) exceeds the specified thresholds in factor. Entries that meet the precision criteria are retained, allowing for analysis with higher confidence in positional accuracy.
- Parameters:
factor (tuple, optional) – A tuple of precision thresholds for the x, y, and z coordinates. Defaults to (100, 100, 100).
- Returns:
A new segment object with atomList filtered to include only entries with precision lower than the specified thresholds in x, y, and z. If no entries meet the criteria, a warning message is printed, and nothing is returned.
- Return type:
Segment or None
- copy() Segment
Create a copy of the SegmentXYZ object. Ideally to use when you want to modify the segment, but keep the original one for reference.
- Returns:
Copy of Segment instance.
- Return type:
- copyWithNewContent(content: DataFrame | list | ndarray) Segment
Create a copy of the SegmentXYZ object with new content (DataFrame), but the same attributes as self.
- Parameters:
content (pd.DataFrame or list or np.ndarray) – New content to use in the copy of the SegmentXYZ object. Should be a Data
- Returns:
A new object of this class, which has the provided content (DataFrame) but the attributes of self.
- Return type:
- getFrames(frames: list) Segment | None
Filters the segment’s localizations by the specified frame numbers.
- Parameters:
frames (list) – A list of frame numbers to filter the segment’s localizations.
- Returns:
A new segment object containing only the localizations with frame numbers in the provided list, or None if no localizations match.
- Return type:
Segment or None
- get_Chromosomes_segment(chromosome_id: int) Segment | None
Get a specific chromosome segment from the segment object.
- Parameters:
chromosome_id (int) – The chromosome ID for which to retrieve the segment.
- Returns:
A specific chromosome segment in the segment object
- Return type:
Segment or None
- no_of_Chromosomes() int
Get the number of unique chromosome IDs present in the segment.
- Returns:
The number of unique chromosome IDs in the segment object
- Return type:
int
- static representSingleLocalization(loc: Series) str
Function to represent a single localization as a string, for example for printing the first and last localization of a segment.
- Parameters:
loc (pd.Series) – Series representing a localization
- Returns:
String representation of the localization
- Return type:
str
- set_chromosomes(chromsomes_ids: ndarray | int)
Set the chromosome ID for each localization in the segment.
- Parameters:
chromsomes_ids (np.ndarray of ints or int) – An array of chromosome IDs with length equal to the number of localizations in the segment, or a single chromosome ID to be assigned to all localizations.
- split_into_Chromosomes() list
Split the image into separate segments and returns the list of Segment Instance for each chromosome.
- Returns:
A list of Segment instances, each containing the localizations corresponding to a specific chromosome ID.
- Return type:
list
- split_into_cycle() list
Split a walk into separate segments by cycle.
- Returns:
A list of Segment instances, each containing the localizations corresponding to a specific cycle.
- split_into_frames_chunk(maxframes: int = 250, interval: int = 5) list
Split a walk into separate segments and returns the list of Segment Instance for each chunk of frames.
- Parameters:
maxframes (int, optional) – The maximum number of frames to consider for splitting. Localizations with frame numbers greater than this value will be ignored. The default is 250.
interval (int, optional) – The number of frames in each chunk. The localizations will be grouped into segments based on this interval. For example, if interval is 5, localizations with frame numbers 0-4 will be in the first segment, 5-9 in the second segment, and so on. The default is 5.
- Returns:
A list of Segment instances, each containing the localizations corresponding to a specific chunk of frames.
- Return type:
list
cima.segments.segment_spatial_features module
- cima.segments.segment_spatial_features.GetLocalisationOverlap(structure1: Segment, structure2: Segment, radius: float = 200)
Calculates the overlap between two structures within a specified radius.
This function computes the proportion of pairs of points, one from structure1 and the other from structure2, that lie within a given distance (radius).
- Parameters:
structure1 (Segment) – The first structure, expected to have a Getcoord method that returns its coordinates as an array.
structure2 (Segment) – The second structure, expected to have a Getcoord method that returns its coordinates as an array.
radius (float, optional) – The maximum distance within which pairs of points are considered overlapping. Defaults to 200.
- Returns:
The proportion of point pairs, one from each structure, that lie within the specified radius.
- Return type:
float
- cima.segments.segment_spatial_features.getCOMDistance(s1: Segment, s2: Segment) float
Get the center of mass distance between two segments.
- cima.segments.segment_spatial_features.getMeanDistance(s1: Segment, s2: Segment) float
Get the mean distance between two segments.