Visualization
Visualization Module
Functions:
|
|
|
Simple function for comparing oringal image and ground truth image |
|
Computes PCA given input data |
|
Computes t-distributed stochastic neighbor embedding. |
|
|
|
|
|
Creates an outline of regions based on the input labels mask. |
- cell_analysis_tools.visualization.compare_images(title1, im1, title2, im2, suptitle=None, figsize=(10, 5), save_path=None) None[source]
- Parameters:
im1 (np.ndarray) – image 1.
title1 (str) – title for image 1.
im2 (np.ndarray) – image 2.
title2 (str) – title for image 2.
figsize (TYPE, optional) – size of figure. The default is (10, 5).
- Return type:
None.
- cell_analysis_tools.visualization.compare_orig_mask_gt_pred(im: ndarray, mask_gt: ndarray, mask_pred: ndarray, title: str = '') None[source]
Simple function for comparing oringal image and ground truth image
- Parameters:
im (np.ndarray) – original image.
mask_gt (np.ndarray) – ground truth image.
mask_pred (np.ndarray) – predicted mask.
title (str, optional) – title of the plot, usually the origina filename. The default is “”.
- Returns:
function only just plots data.
- Return type:
None
- cell_analysis_tools.visualization.compute_pca(data_values: ndarray, n_components: int = 2, **kwargs) DataFrame[source]
Computes PCA given input data
- Parameters:
data_values (np.ndarray) – array of values to input into the reducer. Rows should be roi values, columns are features
n_components (int, optional) – number of components for the PCA. The default is 2.
- Returns:
df_pca (pd.DataFrame) – Dataframe containing the components of the PCA.
pca (Object) – PCA reducer object.
- cell_analysis_tools.visualization.compute_tsne(data_values: ndarray, random_state: int = 0, **kwargs) ndarray[source]
Computes t-distributed stochastic neighbor embedding.
- Parameters:
data_values (np.ndarray) – array of values to input into the reducer. Rows should be roi values, columns are features.
random_state (int, optional) – allows consistent initialization of reducer. The default is 0.
- Returns:
df_tsne (pd.DataFrame) – Dataframe containing the embeddings of tsne.
tsne (Object) – tsne reducer object.
- cell_analysis_tools.visualization.compute_umap(data_values: ndarray, **kwargs) DataFrame[source]
- Parameters:
data_values (np.ndarray) – array of values to input into the reducer. Rows should be roi values, columns are features
random_state (int, optional) – allows consistent initialization of reducer. The default is 0.
**kwargs (dict) – additional parameters can be passed in here for the reducer.
- Returns:
df_umap (pd.DataFrame) – DataFrame containing umap embeddings.
reducer (Object) – umap reducer object.
.. note:: – See the umap-learn documentation for default and additional parameters https://umap-learn.readthedocs.io/en/latest/api.html
- cell_analysis_tools.visualization.image_show(image)[source]
- Parameters:
image (ndarray) – image to show.
- Return type:
None.
- cell_analysis_tools.visualization.mask_to_outlines(mask, im=None, binary_mask=False, debug=False)[source]
Creates an outline of regions based on the input labels mask.
- Parameters:
mask (np.ndarray) – Labels mask to convert to outlines.
im (np.ndarray, optional) – DESCRIPTION. The default is None.
binary_mask (bool, optional) – Determine if returned array should be boolean. The default is False.
debug (TYPE, optional) – Displays intermediate images/masks for debugging. The default is False.
- Returns:
mask_outline – Array containing outlines of input labeled mask.
- Return type:
np.ndarray