Skip to content

Closest point inside object #663

@bdpedigo

Description

@bdpedigo

Hi @william-silversmith - I've been running into a use case pretty consistently that I wonder if you've thought about or have a solution for.

I often generate or receive point annotations, either points inside an object or annotations on the surface (mesh) of that object. In order to create a bound point annotation in CAVE, I need to find a voxel coordinate roughly in the same position as my initial point, and I need that voxel coordinate to 100% be in the object I care about.

Because I am often dealing with floating points in relation to the mesh, I'm finding there is often sufficient wiggle room that if I round my point to the nearest voxel coordinate, I might end up just outside of the object I care about. I think this might also come from the mesh being somewhat downsampled?

In any case, my solution so far has been:

  • Cast each point to voxel coordinates
  • Look up each point using scattered_points
  • Ensure that point is part of my root ID
  • For any points that are not part of root, expand my search radius by +1 voxels in all directions, recurse

You can see that logic in code here:
https://github.com/bdpedigo/cave-mapper/blob/main/src/cave_mapper/mapping.py

It is clunky, but it works OK. The downside is that just doing these lookups can be slow, slow enough that they might be a limiting factor in my pipeline.

So - I wonder if you have a better idea for how to go from (points roughly in object, root ID) -> points in object that haven't moved too much

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions