Skip to content
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

API for all supervoxel sizes within a body #262

Closed
stuarteberg opened this issue Jun 6, 2018 · 2 comments
Closed

API for all supervoxel sizes within a body #262

stuarteberg opened this issue Jun 6, 2018 · 2 comments
Assignees

Comments

@stuarteberg
Copy link
Member

It would be nice if I could query for all of a body's supervoxels and their sizes simultaneously. The API could be something like this:

GET http://{server}/api/node/{uuid}/{labelmap_instance}/supervoxel-sizes/{body_id}

...which would return something like this:

{
    "supervoxels": [1,2,3,4,...],
    "sizes": [100,200,300,400,...]
}

Right now, fetching the size of all supervoxels in the body requires two API calls:

In [343]: svs = requests.get('http://emdata3:8900/api/node/8e72/segmentation/supervoxels/5813024978').json()

In [344]: sizes = requests.get('http://emdata3:8900/api/node/8e72/segmentation/sizes?supervoxels=true', json=svs).json()

The first call is quite fast (63 ms), but the second is very slow (1 minute). I assume that's because the LabelIndex data structure is completely traversed for every supervoxel in the list. But if you know that the supervoxels all belong to the same body, the LabelIndex can be traversed only once.

@DocSavage
Copy link
Member

Per conversation with Stuart, I will provide GET /index/{body_id} endpoint as fetch version of the POST on that same endpoint. It will return a protobuf serialization of the label index that includes supervoxels in the body as well as the voxel distribution across blocks. This should be a very fast GET since it will return a label index with minimal processing.

@stuarteberg
Copy link
Member Author

For particularly large bodies, this feature would indeed be useful. In particular, it would simplify things for NeuTu/neu3, and would fix the problem seen in janelia-flyem/NeuTu#375.

In fact, as a related point: If someone runs GET .../sizes?supervoxels=true, it would be great if DVID could check to see which bodies those supervoxels belong to, and only read each relevant labelindex one time, rather than reading each labelindex N times repeatedly for N supervoxels which happen to share the same body.

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

No branches or pull requests

2 participants