
# napari-orientationpy
Analyze orientations in 2D, 3D, and RGB images in Napari. This plugin is based on the [Orientationpy](https://gitlab.com/epfl-center-for-imaging/orientationpy/) project.
<p align="center">
<img src="assets/ori_color-1.gif" height="400">
</p>
## Installation
You can install `napari-orientationpy` via [pip]:
pip install napari-orientationpy
## Usage
To get started, open an image in the Napari viewer and start `napari-orientationpy` from the `Plugins` menu:
```
Plugins > Napari Orientationpy > Orientation measurement
```
1. **Select the structural scale parameter `sigma`**. This value control represents the scale at which the image gradients are computed. Try different values of `sigma` to understand what works best for your images. A reasonable guess would be the order in size, in pixels, of the structures that you are interested in. For example, if you are imaging fibers that appear to be about 4 pixels wide, try to set a value of *sigma=4*.
<p align="center">
<img src="assets/sigmas.png" height="230">
</p>
2. **If you are analyzing a 3D image, select `fiber` or `membrane` mode**. In `fiber` mode, the orientation normals follow fibrous structures. In `membrane` mode, the orientations are normal to the surface of membranous structures.
3. **Decide which outputs you'd like to visualize.**
- The `color-coded orientation` is a pixel-wise representation of 3D orientations as colors (similar colors = similar orientations).
- The `orientation vectors` get rendered in a `Vectors` layer in Napari. They are sampled on a regular grid defined by the `Spacing (X)`, `Spacing (Y)` and `Spacing (Z)` values (for 2D images, the `Z` value is ignored). The length of the vectors can be rescaled based on the `energy` value of the orientation computation.
- You can also output the local `orientation gradient` (misorientation).
4. **Compute orientation**. This button will trigger the orientation computation **only when necessary** (i.e. when the value of `sigma`, the `mode` or the `image` have changed). If you only adjust the `orientation vectors` parameters, clicking the compute button will update the results very fast.
5. **Save orientation (CSV)**. This will save the orientation measurements as a CSV table with columns `X`, `Y`, `Z`, `theta`, `phi`, `energy`, and `coherency` for all the pixels in the image.
### Plotting the 3D orientation distribution
If you have computed **orientation vectors** for a 3D image, you can plot their spatial distribution as a `stereographic projection` along the `X`, `Y` or `Z` direction directly in Napari. Select the widget from:
```
Plugins > Napari Orientationpy > Orientation distribution (3D)
```
<p align="center">
<img src="assets/fibers_dist.png" height="400">
</p>
## Sample images
We provide a few sample images to test our plugin. Open them from:
```
File > Open Sample > Napari Orientationpy
```
## Contributing
Contributions are very welcome. Please get in touch if you'd like to be involved in improving or extending the package.
## License
Distributed under the terms of the [BSD-3] license,
"napari-orientationpy" is free and open source software
## Issues
If you encounter any problems, please file an issue along with a detailed description.
----------------------------------
[napari]: https://github.com/napari/napari
[BSD-3]: http://opensource.org/licenses/BSD-3-Clause
[pip]: https://pypi.org/project/pip/
Raw data
{
"_id": null,
"home_page": "https://github.com/EPFL-Center-for-Imaging/napari-orientationpy.git",
"name": "napari-orientationpy",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Mallory Wittwer",
"author_email": "mallory.wittwer@epfl.ch",
"download_url": "https://files.pythonhosted.org/packages/03/36/0dad956e6592d07ae80a066398999563c34b135df469ea47b73019347eda/napari-orientationpy-0.0.7.tar.gz",
"platform": null,
"description": "\n# napari-orientationpy\n\nAnalyze orientations in 2D, 3D, and RGB images in Napari. This plugin is based on the [Orientationpy](https://gitlab.com/epfl-center-for-imaging/orientationpy/) project.\n\n<p align=\"center\">\n <img src=\"assets/ori_color-1.gif\" height=\"400\">\n</p>\n\n## Installation\n\nYou can install `napari-orientationpy` via [pip]:\n\n pip install napari-orientationpy\n\n## Usage\nTo get started, open an image in the Napari viewer and start `napari-orientationpy` from the `Plugins` menu:\n\n```\nPlugins > Napari Orientationpy > Orientation measurement\n```\n\n1. **Select the structural scale parameter `sigma`**. This value control represents the scale at which the image gradients are computed. Try different values of `sigma` to understand what works best for your images. A reasonable guess would be the order in size, in pixels, of the structures that you are interested in. For example, if you are imaging fibers that appear to be about 4 pixels wide, try to set a value of *sigma=4*.\n\n<p align=\"center\">\n <img src=\"assets/sigmas.png\" height=\"230\">\n</p>\n\n2. **If you are analyzing a 3D image, select `fiber` or `membrane` mode**. In `fiber` mode, the orientation normals follow fibrous structures. In `membrane` mode, the orientations are normal to the surface of membranous structures.\n\n3. **Decide which outputs you'd like to visualize.**\n - The `color-coded orientation` is a pixel-wise representation of 3D orientations as colors (similar colors = similar orientations).\n - The `orientation vectors` get rendered in a `Vectors` layer in Napari. They are sampled on a regular grid defined by the `Spacing (X)`, `Spacing (Y)` and `Spacing (Z)` values (for 2D images, the `Z` value is ignored). The length of the vectors can be rescaled based on the `energy` value of the orientation computation.\n - You can also output the local `orientation gradient` (misorientation).\n\n4. **Compute orientation**. This button will trigger the orientation computation **only when necessary** (i.e. when the value of `sigma`, the `mode` or the `image` have changed). If you only adjust the `orientation vectors` parameters, clicking the compute button will update the results very fast.\n5. **Save orientation (CSV)**. This will save the orientation measurements as a CSV table with columns `X`, `Y`, `Z`, `theta`, `phi`, `energy`, and `coherency` for all the pixels in the image. \n\n### Plotting the 3D orientation distribution\n\nIf you have computed **orientation vectors** for a 3D image, you can plot their spatial distribution as a `stereographic projection` along the `X`, `Y` or `Z` direction directly in Napari. Select the widget from:\n\n```\nPlugins > Napari Orientationpy > Orientation distribution (3D)\n```\n<p align=\"center\">\n <img src=\"assets/fibers_dist.png\" height=\"400\">\n</p>\n\n## Sample images\n\nWe provide a few sample images to test our plugin. Open them from:\n\n```\nFile > Open Sample > Napari Orientationpy\n```\n\n## Contributing\n\nContributions are very welcome. Please get in touch if you'd like to be involved in improving or extending the package.\n\n## License\n\nDistributed under the terms of the [BSD-3] license,\n\"napari-orientationpy\" is free and open source software\n\n## Issues\n\nIf you encounter any problems, please file an issue along with a detailed description.\n\n----------------------------------\n\n[napari]: https://github.com/napari/napari\n[BSD-3]: http://opensource.org/licenses/BSD-3-Clause\n[pip]: https://pypi.org/project/pip/\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Napari plugin for the Orientationpy project.",
"version": "0.0.7",
"project_urls": {
"Homepage": "https://github.com/EPFL-Center-for-Imaging/napari-orientationpy.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d63a73600c62bc186218c58a4f11e9844b524fa476c0c79aa050034ce118a80f",
"md5": "948c7f2b6b2e8bb9a9c23c8c5e97d743",
"sha256": "64446d77b6128ee7c03154402b1e82c4e52922c99e313d3358f5a62e50e6d478"
},
"downloads": -1,
"filename": "napari_orientationpy-0.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "948c7f2b6b2e8bb9a9c23c8c5e97d743",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 12514,
"upload_time": "2024-01-17T08:24:47",
"upload_time_iso_8601": "2024-01-17T08:24:47.088193Z",
"url": "https://files.pythonhosted.org/packages/d6/3a/73600c62bc186218c58a4f11e9844b524fa476c0c79aa050034ce118a80f/napari_orientationpy-0.0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "03360dad956e6592d07ae80a066398999563c34b135df469ea47b73019347eda",
"md5": "0d1a21dde6e6bba45ebf045a64bc88fa",
"sha256": "424a9dc2947bd0254851c9970c661dee86d812b0c29c3d8058d2e5ab75422ca6"
},
"downloads": -1,
"filename": "napari-orientationpy-0.0.7.tar.gz",
"has_sig": false,
"md5_digest": "0d1a21dde6e6bba45ebf045a64bc88fa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 12436,
"upload_time": "2024-01-17T08:24:49",
"upload_time_iso_8601": "2024-01-17T08:24:49.439703Z",
"url": "https://files.pythonhosted.org/packages/03/36/0dad956e6592d07ae80a066398999563c34b135df469ea47b73019347eda/napari-orientationpy-0.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-17 08:24:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "EPFL-Center-for-Imaging",
"github_project": "napari-orientationpy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "napari-orientationpy"
}