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

SkeletonService docs update. SkeletonService default versions clean-u… #268

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions caveclient/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,8 @@
"bulk_skeleton_info": skeleton_v1 + "/{datastack_name}/bulk/skeleton/info",
"skeleton_info_versioned": skeleton_v1
+ "/{datastack_name}/precomputed/skeleton/{skvn}/info",
"get_cache_contents_via_ridprefixes": skeleton_v1
+ "/{datastack_name}/precomputed/skeleton/query_cache/{root_id_prefixes}/{limit}",
"get_cache_contents_via_skvn_ridprefixes": skeleton_v1
+ "/{datastack_name}/precomputed/skeleton/query_cache/{skeleton_version}/{root_id_prefixes}/{limit}",
"skeletons_exist_via_rids": skeleton_v1
+ "/{datastack_name}/precomputed/skeleton/exists/{root_ids}",
"skeletons_exist_via_skvn_rids": skeleton_v1
+ "/{datastack_name}/precomputed/skeleton/exists/{skeleton_version}/{root_ids}",
"get_skeleton_via_rid": skeleton_v1
Expand Down
42 changes: 22 additions & 20 deletions caveclient/skeletonservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def _build_bulk_async_endpoint(
def get_cache_contents(
self,
datastack_name: Optional[str] = None,
skeleton_version: Optional[int] = 0,
skeleton_version: Optional[int] = 3,
root_id_prefixes: Union[int, str, List] = 0,
limit: Optional[int] = 0,
log_warning: bool = True,
Expand All @@ -328,6 +328,12 @@ def get_cache_contents(
datastack_name = self._datastack_name
assert datastack_name is not None

valid_skeleton_versions = [-1, 0, 1, 2, 3]
if skeleton_version not in valid_skeleton_versions:
raise ValueError(
f"Unknown skeleton version: {skeleton_version}. Valid options: {valid_skeleton_versions}"
)

if isinstance(root_id_prefixes, int):
root_id_prefixes = str(root_id_prefixes)
elif isinstance(root_id_prefixes, List):
Expand All @@ -338,15 +344,10 @@ def get_cache_contents(
endpoint_mapping["root_id_prefixes"] = root_id_prefixes
endpoint_mapping["limit"] = limit

if not skeleton_version:
url = self._endpoints["get_cache_contents_via_ridprefixes"].format_map(
endpoint_mapping
)
else:
endpoint_mapping["skeleton_version"] = skeleton_version
url = self._endpoints["get_cache_contents_via_skvn_ridprefixes"].format_map(
endpoint_mapping
)
endpoint_mapping["skeleton_version"] = skeleton_version
url = self._endpoints["get_cache_contents_via_skvn_ridprefixes"].format_map(
endpoint_mapping
)

response = self.session.get(url)
self.raise_for_status(response, log_warning=log_warning)
Expand All @@ -357,7 +358,7 @@ def get_cache_contents(
def skeletons_exist(
self,
datastack_name: Optional[str] = None,
skeleton_version: Optional[int] = 0,
skeleton_version: Optional[int] = 3,
root_ids: Union[int, str, List] = 0,
log_warning: bool = True,
):
Expand All @@ -368,6 +369,12 @@ def skeletons_exist(
datastack_name = self._datastack_name
assert datastack_name is not None

valid_skeleton_versions = [-1, 0, 1, 2, 3]
if skeleton_version not in valid_skeleton_versions:
raise ValueError(
f"Unknown skeleton version: {skeleton_version}. Valid options: {valid_skeleton_versions}"
)

if isinstance(root_ids, int):
root_ids = str(root_ids)
elif isinstance(root_ids, List):
Expand All @@ -377,15 +384,10 @@ def skeletons_exist(
endpoint_mapping["datastack_name"] = datastack_name
endpoint_mapping["root_ids"] = root_ids

if not skeleton_version:
url = self._endpoints["skeletons_exist_via_rids"].format_map(
endpoint_mapping
)
else:
endpoint_mapping["skeleton_version"] = skeleton_version
url = self._endpoints["skeletons_exist_via_skvn_rids"].format_map(
endpoint_mapping
)
endpoint_mapping["skeleton_version"] = skeleton_version
url = self._endpoints["skeletons_exist_via_skvn_rids"].format_map(
endpoint_mapping
)

response = self.session.get(url)
self.raise_for_status(response, log_warning=log_warning)
Expand Down
13 changes: 3 additions & 10 deletions docs/tutorials/skeletonization.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,8 @@ sk = client.skeleton.get_skeleton(

where the availale output_formats (described below) are:

* none (default if unspecified)
* h5
* swc
* swccompressed
* json
* jsoncompressed
* arrays
* arrayscompressed
* precomputed
* ```'dict'``` (default if unspecified)
* ```'swc'``` (a Pandas Dataframe)

If the skeleton doesn't exist in the server cache, it may take 20-60 seconds to generate the skeleton before it is returned. This function will block during that time. Any subsequent retrieval of the same skeleton should go very quickly however.

Expand Down Expand Up @@ -82,7 +75,7 @@ get_cache_contents(
)
```

You can also add addiional parameters as needed:
You can also add additional parameters as needed:

```python
get_cache_contents(
Expand Down
Loading