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

[question] How to delete all the label indices and label map? #11

Closed
xiuliren opened this issue May 18, 2022 · 8 comments
Closed

[question] How to delete all the label indices and label map? #11

xiuliren opened this issue May 18, 2022 · 8 comments

Comments

@xiuliren
Copy link

I ingested some label indices that are not correct. Creating a new repo and reingest the supervoxels will take a long time. Is that possible to delete all the label indices and label map?

@xiuliren
Copy link
Author

I found a related function here, but it only delete some bodies rather than all of them.

def delete_labelindices(server, uuid, instance, bodies, *, session=None):

@xiuliren
Copy link
Author

xiuliren commented May 18, 2022

according to the comments, I can post an empty label index to delete all of them?

label_index = dvid.LabelIndex()
label_indices = dvid.LabelIndices()
label_indices.indices.extend([label_index])
dvid.post_labelindices(server, uuid, "labels", label_indices)

I just tested this code, this do not work, and I got errors like this:

  File "/mnt/home/jwu/anaconda3/envs/wasp/lib/python3.7/site-packages/requests/models.p[0/801]
e 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://dvid_server:8000/api/node/941057b7c3fe4318815e6e9f1f6140a4/labels/indices?u=jwu&app=neuclea
se

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "delete_label_indices.py", line 12, in <module>
    dvid.post_labelindices(server, target_uuid, "labels", label_indices)
  File "/mnt/home/jwu/anaconda3/envs/wasp/lib/python3.7/site-packages/neuclease/dvid/_dvid.py"
, line 142, in wrapper
    raise new_ex from ex
requests.exceptions.HTTPError: Error accessing POST http://dvid_server:800
0/api/node/941057b7c3fe4318815e6e9f1f6140a4/labels/indices?u=jwu&app=neuclease
400 Client Error: Bad Request for url: dvid_server:8000/api/node/94
1057b7c3fe4318815e6e9f1f6140a4/labels/indices?u=jwu&app=neuclease
index 0 had label 0, which is a reserved label (/api/node/941057b7c3fe4318815e6e9f1f6140a4/lab
els/indices).

@stuarteberg
Copy link
Member

according to the comments, I can post an empty label index to delete all of them?

No, you can only delete indices for an explicitly provided list of bodies, as is done in delete_labelindices().

As far as I can tell, the REST API doesn't offer a way to delete all label indices for the whole instance.

You might want to open a new issue on the dvid repository to request that feature.

@xiuliren
Copy link
Author

I just found a related issue in dvid repo:
janelia-flyem/dvid#341

@xiuliren
Copy link
Author

@stuarteberg I am trying to use the delete_labelindices, but just found that this is added recently and is not in the conda environment. Could you please help to update the conda environment?

@xiuliren
Copy link
Author

I manually added this function to my local nuclease code and works for now. This is pretty hacky though.

@stuarteberg
Copy link
Member

This ought to work:

conda install -c flyem-forge 'neuclease>=0.4.post429'

@xiuliren
Copy link
Author

thank you!

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

No branches or pull requests

2 participants