-
Notifications
You must be signed in to change notification settings - Fork 14
add get_agglomerate_graph to annotation #1361
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
base: master
Are you sure you want to change the base?
Conversation
☂️ Python Coverage
Overall Coverage
New Files
Modified Files
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet stuff!
return file_path | ||
|
||
def get_agglomerate_graph(self, agglomerate_id: int) -> AgglomerateGraph: | ||
"""Get the agglomerate graph for the specified agglomerate id. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe note that this works only if the annotation is a proofreading annotation (aka has an editable mapping). Maybe also note that it works only for single-volume-layer annotations
AgglomerateGraph: The agglomerate graph for the specified agglomerate id. | ||
Raises: | ||
ValueError: If the agglomerate id is not valid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the tracingstore_client may also raise exceptions if the server response is not 200 or the response has an unexpected format
protobuf_binary_response = self._get(route) | ||
protobuf_binary = protobuf_binary_response.content | ||
agglomerate_graph = AgglomerateGraph.from_proto(protobuf_binary) | ||
return agglomerate_graph |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the proto parsing be extracted to a helper method in the abstract_api_client? similar to _get_json, with agglomerate_graph_pb2.AgglomerateGraph as a type parameter?
AgglomerateGraph.fromProto could then not take the raw bytes but instead the already parsed proto?
@@ -0,0 +1,71 @@ | |||
// refresh with `protoc --python_out . webknossos/proofreading/agglomerate_graph.proto --pyi_out .` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file will not be refreshed, though, is it? I think it is the source? Maybe the comment could be more explanatory.
Also, this file is copied from the webknossos repository, right? That should probably also be noted so that they don’t diverge.
@@ -0,0 +1,155 @@ | |||
from collections.abc import Iterable as _Iterable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could the generated files be in a folder named “generated” or similar, to mark this for other developers?
Description:
Todos:
Make sure to delete unnecessary points or to check all before merging: