Skip to main content

3D lasso tool to select large 3D areas

Project description

lasso-3d

License BSD-3 PyPI Python Version tests codecov napari hub

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.

lasso_gif

How it works: A polygon is drawn and a mask is generated via:

Mask via rotation

Steps:

  1. Rotate and project polygon to 2D and create a pixel mask
  2. Create a 3D mask by stacking the pixel mask along z
  3. Rotate 3D mask s.t. it is aligned with the original polygon

This performed more efficiently than the other methods:

Mask via projection

Steps:

  1. Project all points onto the hyperplane defined by the polygon
  2. Rotate all points and the polygon s.t. they are in a horizontal plane and remove z component
  3. Create a binary pixel mask of the polygon
  4. Check which point projections are within the polygon mask
  5. reshape mask to original tomogram size

Mask via mesh voxelization

Steps:

  1. Move polygon along its normal in both directions until end of tomogram shape --> front & back polygons
  2. Define a surface by combining front & back polygons into a triangular mesh
  3. Voxelize the surface, giving the outline of the cone
  4. Fill holes to receive a filled cone

Mask via attaching slices

Steps:

  1. Rotate and project polygon to 2D and generate a pixel mask (2D)
  2. Get indices of pixel mask and rotate them back to 3D space
  3. Do that for many pixel mask, varying the z-component --> will be moved into tomogram along the polygon normal
  4. 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lasso_3d-0.0.1.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lasso_3d-0.0.1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file lasso_3d-0.0.1.tar.gz.

File metadata

  • Download URL: lasso_3d-0.0.1.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for lasso_3d-0.0.1.tar.gz
Algorithm Hash digest
SHA256 76a2e73334d6cd4850aa00234726fcb6a1aba493e1ea970d2a419a601890ca4f
MD5 390310b64278a9fa02938dd4ea561501
BLAKE2b-256 3b465dd7e6316e34a917dfd4d772b721f232dab48ed2bc551a460f2448e97e53

See more details on using hashes here.

File details

Details for the file lasso_3d-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: lasso_3d-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for lasso_3d-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7d90badb29d5b3244a60b7183f539fd778b45c1b9df5b192fe7ba2c59934635a
MD5 062a4bd47192677b5f5529002021cb54
BLAKE2b-256 5aab0a331ac9412bcaa4671e1328ef2384d486356c0ed30dfc950e344b370439

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page