Skip to content

feat: Add new polyline annotation type #769

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

Open
wants to merge 122 commits into
base: master
Choose a base branch
from

Conversation

seankmartin
Copy link
Contributor

A polyline is a single annotation that contains one or more lines. They can be added from the UI or from the precomputed format

UI placement

Polylines can be added in the UI via:

  1. Creating a local annotation layer
  2. Selecting the polyline tool
  3. Clicking to place the points as normal with other tools
  4. To indicate completion of the polyline, place two points at the same location, or hit enter
  5. Note, during placing a polyline you can delete a vertex via backspace

After placing a polyline, deleting vertices is currently not supported. You can move a single vertex via alt clicking on that vertex, or the whole polyline by clicking on any line in the polyline.

Precomputed format

Polylines are stored slightly differently to other precomputed format annotations. They require an additional piece of information, which is the number of vertices in the polyline. As such, the storage format for a single polyline is:

NUM_POINTS_UINT32, POINT1_FLOAT32, POINT2_FLOAT32, ..., POINTK_FLOAT32, PROPERTIES

Technical note - handling a variable length annotation

Because all previous annotations were both:

  1. Of fixed size given the rank
  2. In the same storage format in the precomputed file and buffer for rendering (outside of possibly shuffling properties to the end of the buffer with lots of properties)

There were a few changes needed for variable length annotations. The strategy chosen in the PR right now is generally that each instance for rendering is a fixed size, but not the annotation itself. So a polyline would have a variable number of instances depending on the length of the polyline, but each of those instances is a fixed size for the buffer.
This leads to a bit of data duplication in the buffer, as the properties for a polyline are per polyline, not per vertex or per line -- but those properties are copied per line instance of the polyline.

As such, changes across the annotation handling are setup for polylines specifically. Perhaps if another variable length annotation type is added in the future, this polyline handling could be made a little more generic and a variable length annotation handling could be added. In some places, this has already been setup in a generic way, but didn't want to risk an overdesign for a possible future addition

@seankmartin seankmartin marked this pull request as ready for review April 29, 2025 15:11
@fcollman
Copy link
Contributor

fcollman commented May 5, 2025

I'm having trouble ending polylines with double clicking on a spot in max projection volume rendering in 3d, can other people reproduce this problem?

@seankmartin
Copy link
Contributor Author

I ran into this trouble in large datasets in 3D in general, enter should end the polyline for this reason and backspace can be used to delete a point if an incorrect point is created because of this

@fcollman
Copy link
Contributor

fcollman commented May 5, 2025

This has incidentally highlighted to me how the chunk loading order is not optimized to be to surrounding the cursor for volume rendering, when laying down points in 3d using max projection this is pretty critical for speed, particularly when zooming and and out and triggering new MIP reloading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants