pyluna-pathology.luna.pathology.spatial package¶
Submodules¶
pyluna-pathology.luna.pathology.spatial.stats module¶
- luna.pathology.spatial.stats.Kfunction(p1XY, p2XY, radius, ls=False, count=True, intensity=[], distance=False, distance_scale=10.0)[source]¶
- Computes the Counting, Intensity, and experimental
Intensity-Distance K functions
- Parameters
p1XY (np.ndarray) – An Nx2 array representing the (X,Y) coordinates of cells with phenotype 1
p2XY (np.ndarray) – Same as p1XY but for phenotype 2 cells
radius (float, list[float]) – The radius (or list of radii) to consider
ls (bool) – If True, returns an |radius|x|p1XY| 2D array representing the K function for each phenotype 1 cell for each radius. If False, returns the mean for each radius
count (bool) – By default, this function only computes the Counting K function. Can be disabled with count=False.
intensity – An array of length |p2XY| representing the intensity of each phenotype 2 cell. When passed in, this method will also compute the Intensity K function
pyluna-pathology.luna.pathology.spatial.transforms module¶
Higher-level transformation functions
- luna.pathology.spatial.transforms.generate_k_function_statistics(cell_paths, method_data, main_index=None)[source]¶
Compute K-function spatial statistics on given cell-data
- Parameters
cell_paths (str or list[str]) – paths to a single or multiple FOV regions
method_data (dict) –
Configuration: “index”: (str, optional) Column containting the patient/desired ID, if available (overrides main_index) “phenotype1” : {
”name” : (str) Column name to query ‘value’ : (str) Phenotype string to match (e.g. CD68)
}, “phenotype2” : {
”name” : (str) Column name to query ‘value’ : (str) Phenotype string to match (e.g. panCK)
}, “count” : (bool) Flag to compute counting stats. “radius” : (float) Radius cutoff “intensity” : (str, optional) Column containing intensity information “distance” : (bool) Flag to compute intensity-distance stats.
- Returns
spatial statistics aggregated over FOVs
- Return type
pd.DataFrame