Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions src/tapenade/notebooks/deformation_analysis_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Load your data. If you do not have a mask, we recommend checking the `preprocessing` notebook to create one. If you don't have labels, you can use the `segmentation` notebook to create nuclei labels using StarDist3D."
"i. Load the example data"
]
},
{
Expand All @@ -87,6 +87,29 @@
"scale = 1/pixelsize"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"ii. Or load your data. If you do not have a mask, we recommend checking the `preprocessing` notebook to create one. If you don't have labels, you can use the `segmentation` notebook to create nuclei labels using StarDist3D."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"path_to_data = ...\n",
"\n",
"data = tifffile.imread(path_to_data / '...')\n",
"mask = tifffile.imread(path_to_data / '...')\n",
"labels = tifffile.imread(path_to_data / '...')\n",
"\n",
"pixelsize = np.array([...]) # pixelsize in um/pixel\n",
"scale = 1/pixelsize"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -144,7 +167,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Specify a scale of analysis `sigma`, which correspond to the standard deviation of the Gaussian kernel used to average the tensors.\n",
"i. Specify a scale of analysis `sigma`, which correspond to the standard deviation of the Gaussian kernel used to average the tensors.\n",
"\n",
"Smooth the sparse tensors signals to obtain the average tensors, defined at each centroid:"
]
Expand Down Expand Up @@ -176,7 +199,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The function `masked_gaussian_smooth_sparse` allows you to obtain a smoothed results defined at new sparse positions, e.g on a regular grid. \n",
"ii. The function `masked_gaussian_smooth_sparse` allows you to obtain a smoothed result defined at new sparse positions, e.g on a regular grid. \n",
"\n",
"Here we illustrate how to compute the averaged tensors on a regular grid of step 20 pixels:"
]
Expand Down Expand Up @@ -217,7 +240,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We recompute new average volumes at the grid positions too:"
"iii. We recompute new average volumes at the grid positions too:"
]
},
{
Expand Down Expand Up @@ -250,7 +273,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"To quantify deformation and alignment, we extract the objects' principal length from the inertia tensors, and the main eigenvalue of the true strain tensors by diagonalizing the tensors.\n",
"i. To quantify deformation and alignment, we extract the objects' principal length from the inertia tensors, and the main eigenvalue of the true strain tensors by diagonalizing the tensors.\n",
"\n",
"Note that we extract the principal lengths only as a pedagogical example, as we have discussed at the beginning of the notebook that the principal lengths are not suited for quantifying collective alignment."
]
Expand All @@ -276,7 +299,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Vectors are formatted in an array `V` of shape `(n_objects, 2, dim_vector)`, where `V[i,0]` corresponds to the position at which the vector is defined, and `V[i,1]` corresponds to the vector itself.\n",
"ii. Vectors are formatted in an array `V` of shape `(n_objects, 2, dim_vector)`, where `V[i,0]` corresponds to the position at which the vector is defined, and `V[i,1]` corresponds to the vector itself.\n",
"\n",
"The angles returned are the angles between the main eigenvector and the X axis."
]
Expand Down
Loading
Loading