Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't return rescaled image #333

Merged
merged 6 commits into from
Oct 11, 2023
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
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Fixes #issue_number

## Additional Context

<!-- Include any additional information about the PR here. -->
<!-- Include any additional information about the PR here. -->
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ __pycache__/
/data

# STRESS outputs
*.pdf
*.pdf
*.vtp
*.mat
results_*/
Expand Down Expand Up @@ -94,6 +94,5 @@ venv/
# written by setuptools_scm
**/_version.py

# Dask
# Dask
dask-worker-space/

16 changes: 8 additions & 8 deletions .napari/DESCRIPTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ the functionality of your plugin. Its content will be rendered on your plugin's
napari hub page.

The sections below are given as a guide for the flow of information only, and
are in no way prescriptive. You should feel free to merge, remove, add and
rename sections at will to make this document work best for your plugin.
are in no way prescriptive. You should feel free to merge, remove, add and
rename sections at will to make this document work best for your plugin.

# Description

This should be a detailed description of the context of your plugin and its
This should be a detailed description of the context of your plugin and its
intended purpose.

If you have videos or screenshots of your plugin in action, you should include them
here as well, to make them front and center for new users.
here as well, to make them front and center for new users.

You should use absolute links to these assets, so that we can easily display them
You should use absolute links to these assets, so that we can easily display them
on the hub. The easiest way to include a video is to use a GIF, for example hosted
on imgur. You can then reference this GIF as an image.

Expand Down Expand Up @@ -59,7 +59,7 @@ anywhere, feel free to also include this information here.
This section should go through step-by-step examples of how your plugin should be used.
Where your plugin provides multiple dock widgets or functions, you should split these
out into separate subsections for easy browsing. Include screenshots and videos
wherever possible to elucidate your descriptions.
wherever possible to elucidate your descriptions.

Ideally, this section should start with minimal examples for those who just want a
quick overview of the plugin's functionality, but you should definitely link out to
Expand All @@ -72,8 +72,8 @@ for the majority of plugins. They will include instructions to pip install, and
to install via napari itself.

Most plugins can be installed out-of-the-box by just specifying the package requirements
over in `setup.cfg`. However, if your plugin has any more complex dependencies, or
requires any additional preparation before (or after) installation, you should add
over in `setup.cfg`. However, if your plugin has any more complex dependencies, or
requires any additional preparation before (or after) installation, you should add
this information here.

# Getting Help
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

# napari-stress

This plugin provides tools for the analysis of surfaces in Napari, such as utilities to determine and refine the surface-representation of objects using a ray-casting approach and calculate the curvature of surfaces.
It re-implements code in Napari that was written for [Gross et al. (2021): STRESS, an automated geometrical characterization of deformable particles for in vivo measurements of cell and tissue mechanical stresses](https://www.biorxiv.org/content/10.1101/2021.03.26.437148v1)
This plugin provides tools for the analysis of surfaces in Napari, such as utilities to determine and refine the surface-representation of objects using a ray-casting approach and calculate the curvature of surfaces.
It re-implements code in Napari that was written for [Gross et al. (2021): STRESS, an automated geometrical characterization of deformable particles for in vivo measurements of cell and tissue mechanical stresses](https://www.biorxiv.org/content/10.1101/2021.03.26.437148v1)
and has been made open source in [this repository](https://github.com/campaslab/STRESS).

![](https://github.com/campaslab/napari-stress/raw/main/docs/imgs/function_gifs/spherical_harmonics.gif)
Expand All @@ -23,7 +23,7 @@ For documentation on how to use napari-stress both interactively from the napari

## Installation

Create a new conda environment with the following command.
Create a new conda environment with the following command.
If you have never used conda before, please [read this guide first](https://campaslab.github.io/blog/johannes_mueller/anaconda_getting_started/).

```
Expand Down
4 changes: 0 additions & 4 deletions deploy.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,3 @@ python setup.py sdist bdist_wheel
python -m pip install --user --upgrade twine

python -m twine upload --repository pypi dist/*




2 changes: 1 addition & 1 deletion docs/01_code_usage/01_toolboxes/Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(topic:01_code_usage:toolboxes)=

# Toolboxes
# Toolboxes
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
"_ = stress_backend.lbdv_info(Max_SPH_Deg=measurement_parameters['max_degree'],\n",
" Num_Quad_Pts=measurement_parameters['n_quadrature_points'])\n",
"\n",
"results_stress_analysis = measurements.comprehensive_analysis(results_reconstruction[3][0], **measurement_parameters,\n",
"results_stress_analysis = measurements.comprehensive_analysis(results_reconstruction[2][0], **measurement_parameters,\n",
" verbose=verbose, use_dask=parallelize)"
]
},
Expand Down
2 changes: 1 addition & 1 deletion docs/01_code_usage/02_example_workflows/Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Other example workflows

The functions in napari-stress can be used to do a set of typical tasks and workflows, some of which shall be summarized in this section.
The functions in napari-stress can be used to do a set of typical tasks and workflows, some of which shall be summarized in this section.
2 changes: 1 addition & 1 deletion docs/01_code_usage/code_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# From code

This section demonstrates how to use the package from a script.
This section demonstrates how to use the package from a script.
2 changes: 1 addition & 1 deletion docs/02_interactive_usage/01_toolboxes/Readme.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
(topic:interactive_usage:toolboxes)=
# Toolboxes
# Toolboxes
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ The settings require the following input:

* `Input pointcloud`: Layer of a reconstructed droplet. Can be 3D or 4D.
* `Degree`: Degree of the spherical harmonics expansion fitted to the pointcloud. The higher the degree, the better the fit. For mor details, see [glossary](spherical_harmonics:mathematical_basics:degree).
* `Number of quadrature points`: Number of points on which curvature will be evaluated.
* `Number of quadrature points`: Number of points on which curvature will be evaluated.

*Note 1*: High values (>1000) can lead to signiicant computational expense on first time run.

*Note 2*: Using high-order spherical harmonics requires a specific minimal number of quadrature points. The number of quadrature points can be higher than this number, but not lower.

* `Interfacial surface tension [mN/m]`: Surface tension in mN/m of the evaluated droplet.


Expand Down
2 changes: 1 addition & 1 deletion docs/02_interactive_usage/02_example_workflows/Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Other example workflows

Test 123
Test 123
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If you want to retrieve a pointcloud on the surface of the fitted ellipsoid, you
![](imgs/demo_fit_ellipsoid6.png)

**Vedo**
This section describes the implementation taken from the [vedo repository](https://vedo.embl.es/). It uses a [pca-algorithm](https://en.wikipedia.org/wiki/Principal_component_analysis) to calculate the minor/major axes. Use it via `Tools > Points > Points > Fit ellipsoid to pointcloud (vedo, n-STRESS)`. As an additional parameter, it requires you to set which percentage of the input points should be contained by the surface of the fitted ellipse, which is controlled by the `inside fraction` parameter.
This section describes the implementation taken from the [vedo repository](https://vedo.embl.es/). It uses a [pca-algorithm](https://en.wikipedia.org/wiki/Principal_component_analysis) to calculate the minor/major axes. Use it via `Tools > Points > Points > Fit ellipsoid to pointcloud (vedo, n-STRESS)`. As an additional parameter, it requires you to set which percentage of the input points should be contained by the surface of the fitted ellipse, which is controlled by the `inside fraction` parameter.

![](imgs/demo_fit_ellipsoid1.png)

Expand Down Expand Up @@ -56,4 +56,4 @@ You can calculate how well the ellipsoid approximates the pointcloud by calculat

![](imgs/demo_fit_ellipsoid8.png)

Measureing the lengths of these vectors will soon be possible.
Measureing the lengths of these vectors will soon be possible.
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ The results are then stored in the `layer.features`. In case the curvature value

![](imgs/demo_measure_curvature3.png)

Type to retrieve specifically the curvature values.
Type to retrieve specifically the curvature values.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,3 @@ Such surfaces typically consist of a large ammount of vertices. This behaviour c
![](../../imgs/viewer_screenshots/reconstruct_surface4.png)

If you are interested in doing this from code, check out this [example notebook](glossary:surface_reconstruction:code)=




Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ In order to use it, check out the documentation on the [napari-matplotlib page](

To display measurements, select a layer of interest and the dropdown in the newly created Histogram widget will show all possible features for you to highlight.

![](./imgs/demo_visualize_featureHistogram2.png)
![](./imgs/demo_visualize_featureHistogram2.png)
2 changes: 1 addition & 1 deletion docs/02_interactive_usage/interactive_usage.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(topic:interactive_usage)=
# Interactive usage

This section demonstrates how to use napari-stress interactively from the napari viewer.
This section demonstrates how to use napari-stress interactively from the napari viewer.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In this notebook you will learn about [spherical harmonics](https://en.wikipedia

## Polar coordinates

Generally speaking, spherical harmonics provide a mathematical framework to tackle problems that are best described in polar coordinates. When we use polar coordinates, we describe the location of a point in space in terms of
Generally speaking, spherical harmonics provide a mathematical framework to tackle problems that are best described in polar coordinates. When we use polar coordinates, we describe the location of a point in space in terms of

* latitude $\theta$
* longitude $\phi$
Expand Down Expand Up @@ -42,7 +42,7 @@ $f(\theta, \phi) = \sum_{l=0}^{\inf} \sum_{m=-l}^{l} f_l^m Y_l^m(\theta, \phi)$

where $f_l^m$ are the coefficients that determine how much each degree and order of the spherical harmonics functions $Y_l^m(\theta, \phi)$ contribute to the sum. In other words, you can use this superposition to approximate the value of any function that depends on latitude and longitude as inputs. It is important to understand that this definition is assuming spheres of radius $r=1$ - the result of $f(\theta, \phi)$ can represent any property on the surface of this sphere. The Wikipedia page features a nice [visualization](https://en.wikipedia.org/wiki/Spherical_harmonics#/media/File:Rotating_spherical_harmonics.gif) for the contributions of spherical harmonics of specific degree and order on the surface of a sphere.

Using this framework has several desirable characteristics:
Using this framework has several desirable characteristics:

- Any real function on the surface of a sphere can be approximated with a spherical harmonics expansion
- An obtained spherical harmonics expansion can be described entirely by the coefficients $f_l^m$
Expand Down Expand Up @@ -101,4 +101,4 @@ where the coefficients $f_x$, $f_y$, $f_z$ refer to the spherical harmonics coef

### iii ) Calculate other coordinates as a function of latitude and longitude

In principle, the previously described coordinate parametrizations can be expanded to any set of coordinate parametrization. Other coordinate formulations that can be used for this sort of coordinate parametrization are [cylindrical coordinates ](https://en.wikipedia.org/wiki/Cylindrical_coordinate_system) or [ellipsoidal coordinates](https://en.wikipedia.org/wiki/Ellipsoidal_coordinates).
In principle, the previously described coordinate parametrizations can be expanded to any set of coordinate parametrization. Other coordinate formulations that can be used for this sort of coordinate parametrization are [cylindrical coordinates ](https://en.wikipedia.org/wiki/Cylindrical_coordinate_system) or [ellipsoidal coordinates](https://en.wikipedia.org/wiki/Ellipsoidal_coordinates).
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ An interesting parameter that can be obtained from a spherical harmonics expansi

* The surface integrated curvature $H_{0, surf~int}$: This is the ratio of the area of the obtained expansion and the surface of a unit sphere $H_{0, surf~int} = \frac{A_{manifold}}{A_{Sphere}}$

The [stress paper](https://www.biorxiv.org/content/10.1101/2021.03.26.437148v1.abstract) uses the second definition ($H_{0, surf~int}$) for the description of curvatures oon the surface.
The [stress paper](https://www.biorxiv.org/content/10.1101/2021.03.26.437148v1.abstract) uses the second definition ($H_{0, surf~int}$) for the description of curvatures oon the surface.

(spherical_harmonics:measurements:gauss_bonnet)=
## Gauss-Bonnet test
Expand All @@ -42,4 +42,4 @@ In other words, the Gauss-Bonnet test gives you the possibility to measure wheth

$\Delta_{Gauss-Bonnet, rel} = \frac{\Delta_{Gauss-Bonnet, abs}}{4\pi}$

To differentiate between a "good" and a "bad" surface expansion, the [stress paper](https://www.biorxiv.org/content/10.1101/2021.03.26.437148v1.full) suggests a threshold value of $1\cdot10^{-2}$ for the relative error.
To differentiate between a "good" and a "bad" surface expansion, the [stress paper](https://www.biorxiv.org/content/10.1101/2021.03.26.437148v1.full) suggests a threshold value of $1\cdot10^{-2}$ for the relative error.
2 changes: 1 addition & 1 deletion docs/03_glossary/01_spherical_harmonics/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Topics:
* [Mathematical basics I](glossary:spherical_harmonics:mathematical_basics)
* [Mathematical basics II](glossary:spherical_harmonics:mathematical_basics2)
* [Usage from code](glossary:spherical_harmonics:code)
* [Interactive usage](glossary:spherical_harmonics:interactive)
* [Interactive usage](glossary:spherical_harmonics:interactive)
2 changes: 1 addition & 1 deletion docs/04_FAQ/Acknowledgement_and_citation.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ If you use napari-stress in your research, please cite the following paper:
order Gauss-Markov quadrature formulae invariant under the
octahedron group with inversion'
Computational Mathematics and Mathematical Physics, Vol. 15,
1975, pp. 44-51.
1975, pp. 44-51.
2 changes: 1 addition & 1 deletion docs/04_FAQ/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ ERROR: Could not install packages due to an OSError: [WinError 5] Access is deni
Consider using the `--user` option or check the permissions.
```

If this occurs, close all open Python instances (e.g., anaconda command line prompts, Jupyterlab instances, etc) and try again - this should fix the issue.
If this occurs, close all open Python instances (e.g., anaconda command line prompts, Jupyterlab instances, etc) and try again - this should fix the issue.
2 changes: 1 addition & 1 deletion docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ parts:
- caption: Usage
chapters:
- file: 01_code_usage/code_usage
sections:
sections:
- file: 01_code_usage/01_toolboxes/Readme
sections:
- file: 01_code_usage/01_toolboxes/demo_droplet_reconstruction_toolbox_code
Expand Down
87 changes: 65 additions & 22 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,80 @@
###############################################################################
import os
import sys

sys.path.insert(0, os.path.abspath("../"))

add_module_names = True
author = 'Johannes Soltwedel'
author = "Johannes Soltwedel"
autosummary_generate = True
bibtex_bibfiles = ['references.bib']
comments_config = {'hypothesis': False, 'utterances': False}
copyright = '2022'
exclude_patterns = ['**.ipynb_checkpoints', '.DS_Store', 'Thumbs.db', '_build']
extensions = ['sphinx_togglebutton', 'sphinx_copybutton', 'myst_nb', 'jupyter_book', 'sphinx_thebe', 'sphinx_comments', 'sphinx_external_toc', 'sphinx.ext.intersphinx', 'sphinx_design', 'sphinx_book_theme', 'sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinx.ext.viewcode', 'sphinx.ext.autosummary', 'sphinxcontrib.bibtex', 'sphinx_jupyterbook_latex']
bibtex_bibfiles = ["references.bib"]
comments_config = {"hypothesis": False, "utterances": False}
copyright = "2022"
exclude_patterns = ["**.ipynb_checkpoints", ".DS_Store", "Thumbs.db", "_build"]
extensions = [
"sphinx_togglebutton",
"sphinx_copybutton",
"myst_nb",
"jupyter_book",
"sphinx_thebe",
"sphinx_comments",
"sphinx_external_toc",
"sphinx.ext.intersphinx",
"sphinx_design",
"sphinx_book_theme",
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx.ext.autosummary",
"sphinxcontrib.bibtex",
"sphinx_jupyterbook_latex",
]
external_toc_exclude_missing = False
external_toc_path = '_toc.yml'
html_baseurl = ''
html_favicon = ''
html_logo = 'logo.png'
html_sourcelink_suffix = ''
html_theme = 'sphinx_book_theme'
html_theme_options = {'search_bar_text': 'Search this book...', 'launch_buttons': {'notebook_interface': 'classic', 'binderhub_url': '', 'jupyterhub_url': '', 'thebe': False, 'colab_url': ''}, 'path_to_docs': '', 'repository_url': 'https://github.com/executablebooks/jupyter-book', 'repository_branch': 'master', 'extra_footer': '', 'home_page_in_toc': True, 'announcement': '', 'analytics': {'google_analytics_id': ''}, 'use_repository_button': False, 'use_edit_page_button': False, 'use_issues_button': False}
html_title = 'Napari-stress documentation'
latex_engine = 'pdflatex'
myst_enable_extensions = ['colon_fence', 'dollarmath', 'linkify', 'substitution', 'tasklist']
myst_url_schemes = ['mailto', 'http', 'https']
external_toc_path = "_toc.yml"
html_baseurl = ""
html_favicon = ""
html_logo = "logo.png"
html_sourcelink_suffix = ""
html_theme = "sphinx_book_theme"
html_theme_options = {
"search_bar_text": "Search this book...",
"launch_buttons": {
"notebook_interface": "classic",
"binderhub_url": "",
"jupyterhub_url": "",
"thebe": False,
"colab_url": "",
},
"path_to_docs": "",
"repository_url": "https://github.com/executablebooks/jupyter-book",
"repository_branch": "master",
"extra_footer": "",
"home_page_in_toc": True,
"announcement": "",
"analytics": {"google_analytics_id": ""},
"use_repository_button": False,
"use_edit_page_button": False,
"use_issues_button": False,
}
html_title = "Napari-stress documentation"
latex_engine = "pdflatex"
myst_enable_extensions = [
"colon_fence",
"dollarmath",
"linkify",
"substitution",
"tasklist",
]
myst_url_schemes = ["mailto", "http", "https"]
nb_execution_allow_errors = False
nb_execution_cache_path = ''
nb_execution_cache_path = ""
nb_execution_excludepatterns = []
nb_execution_in_temp = False
nb_execution_mode = 'off'
nb_execution_mode = "off"
nb_execution_timeout = 30
nb_output_stderr = 'show'
nb_output_stderr = "show"
numfig = True
pygments_style = 'sphinx'
suppress_warnings = ['myst.domains']
pygments_style = "sphinx"
suppress_warnings = ["myst.domains"]
use_jupyterbook_latex = True
use_multitoc_numbering = True
4 changes: 2 additions & 2 deletions docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ If you use napari-stress in your research, please check the [acknowledgements an

## Issues

If you encounter any issues during installation, please
If you encounter any issues during installation, please

* browse the [FAQ section](FAQ:installation) for known issues
* file an [issue on github](https://github.com/BiAPoL/napari-stress/issues)
* check out the [image.sc forum](https://forum.image.sc/) for help (Please tag @EL_Pollo_Diablo to notify the developers)
* check out the [image.sc forum](https://forum.image.sc/) for help (Please tag @EL_Pollo_Diablo to notify the developers)
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"


4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages

setup(
packages=find_packages()
)
setup(packages=find_packages())
Loading
Loading