griottes package¶
graphmaker¶
Tools for graph generation
graph_generation_func¶
- griottes.graphmaker.graph_generation_func.generate_geometric_graph(user_entry, descriptors: list = [], distance: float = 60, image_is_2D=False, min_area=0, analyze_fluo_channels=False, radius=30, mask_channel=None)¶
Creates a geometric graph.
This function creates a geometric graph from an image or a dataframe object.
- Parameters
user_entry (pandas.DataFrame or numpy.ndarray) – contains the information on the cells.
descriptors (list, optional) – contains the cell information included in the network nodes.
distance (float, optional) – the maximum distance between two nodes.
image_is_2D (bool, optional) – if True, the image is analyzed as a 2D image. The default is False.
min_area (int, optional) – the minimum area of a cell. The default is 0.
analyze_fluo_channels (bool, optional) – if True, the fluorescence channels are analyzed. The default is False.
radius (int, optional) – Radius of the sphere within the which the fluorescence is analyzed. Irrelevant for the ‘basic’ method. The default is 30.
mask_channel (int, optional) – The channel containing the cell masks The default is None.
- Returns
The graph representation of the input.
- Return type
nx.Graph
- griottes.graphmaker.graph_generation_func.generate_contact_graph(user_entry, mask_channel=None, min_area=0, analyze_fluo_channels=True, image_is_2D=True, fluo_channel_analysis_method='basic', descriptors=[], radius=30)¶
Creates a contact graph.
This function creates a contact graph from an image. The contact graph is a graph where each node represents a region and each edge represents a contact between two adjascent regions.
- Parameters
user_entry (numpy.ndarray) – contains the information on the cells.
descriptors (list, optional) – contains the cell information included in the network nodes.
image_is_2D (bool, optional) – if True, the image is analyzed as a 2D image. The default is False.
min_area (int, optional) – the minimum area of a cell. The default is 0.
analyze_fluo_channels (bool, optional) – if True, the fluorescence channels are analyzed. The default is True.
radius (int, optional) – Radius of the sphere within the which the fluorescence is analyzed. Irrelevant for the ‘basic’ method. The default is 30.
mask_channel (int, optional) – The channel containing the cell masks The default is None.
- Returns
The graph representation of the input.
- Return type
nx.Graph
- griottes.graphmaker.graph_generation_func.generate_delaunay_graph(user_entry, descriptors: list = [], image_is_2D=False, min_area=0, analyze_fluo_channels=False, fluo_channel_analysis_method='basic', radius=30, distance=30, mask_channel=None)¶
Creates a Delaunay graph.
This function creates a Delaunay graph from an image or a dataframe object.
- Parameters
user_entry (pandas.DataFrame or numpy.ndarray) – contains the information on the cells.
descriptors (list, optional) – contains the cell information included in the network nodes.
distance (float, optional) – the maximum distance between two nodes.
fluo_channel_analysis_method (str, optional) – the method used to analyze the fluorescence channels. ‘basic’ measures the fluorescence properties within the cell mask, ‘local_sphere’ within a sphere of radius ‘radius’ and ‘local_voronoi’ within the Voronoi tesselation of the cell.
radius (float, optional) – radius of the sphere within the which the fluorescence is analyzed. Irrelevant for the ‘basic’ fluorescence analysis method.
image_is_2D (bool, optional) – if True, the image is analyzed as a 2D image. The default is False.
min_area (int, optional) – the minimum area of a cell. The default is 0.
analyze_fluo_channels (bool, optional) – if True, the fluorescence channels are analyzed. The default is False.
mask_channel (int, optional) – The channel containing the cell masks The default is None.
- Returns
The graph representation of the input.
- Return type
nx.Graph
- griottes.graphmaker.graph_generation_func.trim_graph_voronoi(G, distance, image_is_2D)¶
Remove slinks above the distance length. Serves to remove unrealistic edges from the graph.
- Parameters
G (nx.Graph) – The graph representation of the input image/table.
distance (float) – The maximum distance between two nodes.
image_is_2D (bool) – If True, the image is 2D.
- Returns
The graph representation of the input.
- Return type
nx.Graph
- griottes.graphmaker.graph_generation_func.get_region_contacts_2D(mask_image)¶
From the masked image create a dataframe containing the information on all the links between region.
- griottes.graphmaker.graph_generation_func.get_region_contacts_3D(mask_image)¶
From the masked image create a dataframe containing the information on all the links between region.
make_spheroids¶
- griottes.graphmaker.make_spheroids.single_spheroid_process(spheroid_frame: pandas.core.frame.DataFrame, descriptors: list = [])¶
spheroid_frame has the label of each cell as index.
graph_plot¶
- griottes.graphplotter.graph_plot.network_plot_2D(G, background_image=None, figsize: tuple = (8, 8), alpha_line=0.6, scatterpoint_size=20, legend=False, edge_color='k', line_factor=1, legend_fontsize=18, include_weights=False)¶
- griottes.graphplotter.graph_plot.network_plot_3D(G, figsize: tuple = (8, 8), alpha_line=0.6, scatterpoint_size=20, legend=False, legend_fontsize=12, theta=0, psi=0, xlim=None, ylim=None, zlim=None)¶
- griottes.graphplotter.graph_plot.Voronoi_3D(G, angle)¶
analyse¶
cell_property_extraction¶
- griottes.analyse.cell_property_extraction.get_nuclei_properties(image, mask_channel)¶
Get properties of nuclei in image.
- Parameters
image (numpy.ndarray) – Image with nuclei masks.
mask_channel (int) – Channel of the mask.
- Return type
pandas.DataFrame
- griottes.analyse.cell_property_extraction.in_hull(p, hull)¶
Test if points in p are in hull
p should be a NxK coordinates of N points in K dimensions hull is either a scipy.spatial.Delaunay object or the MxK array of the coordinates of M points in `K`dimensions for which Delaunay triangulation will be computed
- griottes.analyse.cell_property_extraction.voronoi_fluo_property_analysis(properties, image, mask_channel, radius, labeled_voronoi_tesselation, percentile)¶
Calculate the voronoi mask, then use the mask to estimate the intensities inside the mask.
- griottes.analyse.cell_property_extraction.get_cell_properties(image, mask_channel=0, analyze_fluo_channels=False, fluo_channel_analysis_method='basic', cell_geometry_properties=False, labeled_voronoi_tesselation=False, radius=5, min_area=50, percentile=95, ndim=3)¶
Calculate the cell properties for a given image.
- Parameters
image (numpy array) – The image to be analyzed.
mask_channel (int) – The channel to be used as a mask.
analyze_fluo_channels (bool) – If True, the fluorescence channels will be analyzed.
fluo_channel_analysis_method (str) – The method to be used to analyze the fluorescence channels. Either basic, local_voronoi, or local_sphere.
cell_geometry_properties (bool) – If True, the cell geometry properties will be calculated.
labeled_voronoi_tesselation (bool) – If True, the voronoi tesselation will be generated and returned as an array.
radius (int) – Maximum radius within which the cell properties are measured.
min_area (int) – Minimum area of a cell to be considered.
percentile (int) – Percentile of the intensity distribution to be used for the percentile intensity calculation.
- Return type
pandas.DataFrame
voronoi_cell_property_analysis¶
- griottes.analyse.voronoi_cell_property_analysis.in_hull(p, hull)¶
Test if points in p are in hull
p should be a NxK coordinates of N points in K dimensions hull is either a scipy.spatial.Delaunay object or the MxK array of the coordinates of M points in `K`dimensions for which Delaunay triangulation will be computed