Lasso
3D lasso tool to select large 3D areas
3D lasso tool to select large 3D areas
This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.
Lasso tool
This repository allows to draw 3D lassos, generate masks from these, and then mask out the image. For instructions on how to use the plugin, please refer to the Usage instructions.
How it works: A polygon is drawn and a mask is generated via:
Mask via rotation
Steps:
- Rotate and project polygon to 2D and create a pixel mask
- Create a 3D mask by stacking the pixel mask along z
- Rotate 3D mask s.t. it is aligned with the original polygon
This performed more efficiently than the other methods:
Mask via projection
Steps:
- Project all points onto the hyperplane defined by the polygon
- Rotate all points and the polygon s.t. they are in a horizontal plane and remove z component
- Create a binary pixel mask of the polygon
- Check which point projections are within the polygon mask
- reshape mask to original tomogram size
Mask via mesh voxelization
Steps:
- Move polygon along its normal in both directions until end of tomogram shape --> front & back polygons
- Define a surface by combining front & back polygons into a triangular mesh
- Voxelize the surface, giving the outline of the cone
- Fill holes to receive a filled cone
Mask via attaching slices
Steps:
- Rotate and project polygon to 2D and generate a pixel mask (2D)
- Get indices of pixel mask and rotate them back to 3D space
- Do that for many pixel mask, varying the z-component --> will be moved into tomogram along the polygon normal
- Binary closing to get rid of holes from integer conversion
Installation
pip install .
Contributing
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
License
Distributed under the terms of the BSD-3 license, "lasso-3d" is free and open source software
Issues
If you encounter any problems, please file an issue along with a detailed description.
Version:
- 0.0.1
Last updated:
- 2025-01-09
First released:
- 2025-01-09
License:
- Copyright (c) 2024, Lorenz Lam...
Operating system:
- Information not submitted
Requirements:
- magicgui
- membrain-seg
- napari-mrcfile-reader
- numpy
- pyqt5
- qtpy
- scipy
- scikit-image
- tox; extra == "testing"
- pytest; extra == "testing"
- pytest-cov; extra == "testing"
- pytest-qt; extra == "testing"
- napari; extra == "testing"
- pyqt5; extra == "testing"