Data analysis#

After segmentation, windowing and signal extraction, we can finally perform some data analysis. We show here how to create various types of plots using the show_plots submodule.

%load_ext autoreload
%autoreload 2
from morphodynamics.plots import show_plots

In order to be able to display data, we first need to import them. For that we can again use our data loading function and point to an analysis folder:

from morphodynamics.utils import load_alldata
param, res, data = load_alldata('../../../Projects_data/napari-morphodynamics/exp051/', load_results=True)

Geometric properties#

First we plot some geometric information:

import matplotlib.pyplot as plt

fig, ax = plt.subplots(1,3, figsize=(10,3))

show_plots.show_geometry(data=data, res=res, prop='length', fig_ax=(fig, ax[0]))
show_plots.show_geometry(data=data, res=res, prop='area', fig_ax=(fig, ax[1]))
show_plots.show_geometry(data=data, res=res, prop='circularity', fig_ax=(fig, ax[2]));
../_images/a91cae1e56c54de3e25d974ab4724c153581e63a0824aa6c293cee09c927f293.png

We can also display all contours with a time-color coding:

ax_edge = show_plots.show_edge_overview(param, data, res, size=(6,6));
../_images/ad73fe5771b586f38beb23e1f02f73c80c50192f4b7d380c0241857dc662cbab.png

Note that this functions generally return a Matplotlib ax object which can be used to further edit a figure.

ax_edge.set_title('New title')
ax_edge.figure
../_images/e128f1cb36496d88da7ffcd4b969890bf6f5dbd1295d59eaeb37ad0a41bc943f.png

Windows#

We can also display the signal in the windows over time. Here we have to pick which channel to use as well as which layer of windows.

show_plots.show_signals_aux(data, res, signal_index=2, layer_index=0, percentile=1, size=(6,3));
                            
../_images/039f65e8ad45b1550b9bdee8751bfd6ca39bdab6feaf18c1640ff5ffbf6fd606.png

Additionally we can visualize the windows on top of the image itself:

fig, ax = plt.subplots(1,2, figsize=(6,3))
show_plots.show_windows(data, param, frame=0, signal_index=0, size=(5,5), fig_ax=(fig, ax[0]))
show_plots.show_windows(data, param, frame=40, signal_index=0, size=(5,5), fig_ax=(fig, ax[1]));
../_images/f1d2e2d91ff0f91e807efc043dbac7dea4a6d3be2c16d09bcb8fcc88b41e4e93.png

Correlations#

Finally we can display correlations between signal and displacement:

signal_name1='0'
signal_name2='1'
window_layer=0
show_plots.show_correlation_core(res, param, 'displacement', '2',0, 'Pearson', size=(5,3));
../_images/45377d544e0ad32564dfc4db793a24087b6d9a12787c534bd4ee3cf41d1fac8f.png