Skip to content

Commit

Permalink
Skeleton dev3 (#267)
Browse files Browse the repository at this point in the history
* Compressed SWC format option.

* lint/ruff corrections

* Bulk skeleton generation.

* New skeleton cache query endpoint

* Ruff corrections

* Trivial change

* Removed debugging code. Labeled protected functions.

* Ruff correctdions.

* Ruff corrections.

* Ruff changes that make the code definitively HARDER to read. Is this really what we want?

* Converted print statements to logging calls.

* Server version checking for new API endpoints.

* Ruff conformity.

* Added SkeletonClient.skeletons_exist().

* Ruff changes.

* Skeleton Client documentation

* update test docs to note confusing local server issue

* generate_bulk_skeletons_async() now reports an upper bound estimate of the skeletonization time.

* Documentation

* Cleanup

* Versions endpoint

* Update changelog

* SkeletonClient now only accepts 'dict' and 'swc' format requests.

* ruff cleanup

* ruff cleanup

* ruff cleanup

* Various handling of the new 'flatdict' skeleton format.

* ruff compliance

* Change default skeleton version to 3 (the current latest version)

* ruff cleanup

* Add packaging as a requirement

* Bump version: 6.5.0 → 6.5.1

* version dependent networkx (#266)

* Bump version: 6.5.1 → 6.5.2

* SkeletonClient changes, mainly simplification of output formats (#265)

* Compressed SWC format option.

* lint/ruff corrections

* Bulk skeleton generation.

* New skeleton cache query endpoint

* Ruff corrections

* Trivial change

* Removed debugging code. Labeled protected functions.

* Ruff correctdions.

* Ruff corrections.

* Ruff changes that make the code definitively HARDER to read. Is this really what we want?

* Converted print statements to logging calls.

* Server version checking for new API endpoints.

* Ruff conformity.

* Added SkeletonClient.skeletons_exist().

* Ruff changes.

* Skeleton Client documentation

* update test docs to note confusing local server issue

* generate_bulk_skeletons_async() now reports an upper bound estimate of the skeletonization time.

* Documentation

* Cleanup

* Versions endpoint

* Update changelog

* SkeletonClient now only accepts 'dict' and 'swc' format requests.

* ruff cleanup

* ruff cleanup

* ruff cleanup

* Various handling of the new 'flatdict' skeleton format.

* ruff compliance

---------

Co-authored-by: Casey Schneider-Mizell <[email protected]>

* Bump version: 6.5.2 → 7.0.0

* added documentation of 7.0 changes to skeleton service

* SkeletonClient changes, mainly simplification of output formats (#265)

* Compressed SWC format option.

* lint/ruff corrections

* Bulk skeleton generation.

* New skeleton cache query endpoint

* Ruff corrections

* Trivial change

* Removed debugging code. Labeled protected functions.

* Ruff correctdions.

* Ruff corrections.

* Ruff changes that make the code definitively HARDER to read. Is this really what we want?

* Converted print statements to logging calls.

* Server version checking for new API endpoints.

* Ruff conformity.

* Added SkeletonClient.skeletons_exist().

* Ruff changes.

* Skeleton Client documentation

* update test docs to note confusing local server issue

* generate_bulk_skeletons_async() now reports an upper bound estimate of the skeletonization time.

* Documentation

* Cleanup

* Versions endpoint

* Update changelog

* SkeletonClient now only accepts 'dict' and 'swc' format requests.

* ruff cleanup

* ruff cleanup

* ruff cleanup

* Various handling of the new 'flatdict' skeleton format.

* ruff compliance

---------

Co-authored-by: Casey Schneider-Mizell <[email protected]>

* SkeletonClient changes, mainly simplification of output formats (#265)

* Compressed SWC format option.

* lint/ruff corrections

* Bulk skeleton generation.

* New skeleton cache query endpoint

* Ruff corrections

* Trivial change

* Removed debugging code. Labeled protected functions.

* Ruff correctdions.

* Ruff corrections.

* Ruff changes that make the code definitively HARDER to read. Is this really what we want?

* Converted print statements to logging calls.

* Server version checking for new API endpoints.

* Ruff conformity.

* Added SkeletonClient.skeletons_exist().

* Ruff changes.

* Skeleton Client documentation

* update test docs to note confusing local server issue

* generate_bulk_skeletons_async() now reports an upper bound estimate of the skeletonization time.

* Documentation

* Cleanup

* Versions endpoint

* Update changelog

* SkeletonClient now only accepts 'dict' and 'swc' format requests.

* ruff cleanup

* ruff cleanup

* ruff cleanup

* Various handling of the new 'flatdict' skeleton format.

* ruff compliance

---------

Co-authored-by: Casey Schneider-Mizell <[email protected]>

* Change default skeleton version to 3 (the current latest version)

* ruff cleanup

* Old code somehow got reinstated.

---------

Co-authored-by: Casey Schneider-Mizell <[email protected]>
Co-authored-by: Ben Pedigo <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Forrest Collman <[email protected]>
  • Loading branch information
5 people authored Nov 21, 2024
1 parent babb459 commit 6acbddf
Showing 1 changed file with 31 additions and 20 deletions.
51 changes: 31 additions & 20 deletions caveclient/skeletonservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def get_skeleton(
self,
root_id: int,
datastack_name: Optional[str] = None,
skeleton_version: Optional[int] = None,
skeleton_version: Optional[int] = 3,
output_format: Literal[
"dict",
"swc",
Expand All @@ -447,7 +447,6 @@ def get_skeleton(
The skeleton version to generate and retrieve. Options are documented in SkeletonService. Use 0 for Neuroglancer-compatibility. Use -1 for latest.
output_format : string
The format to retrieve. Options are:
- 'dict': A dictionary
- 'swc': A pandas DataFrame
Expand All @@ -460,15 +459,10 @@ def get_skeleton(
if not self.fc.l2cache.has_cache():
raise NoL2CacheException("SkeletonClient requires an L2Cache.")

if output_format not in ["dict", "swc"]:
raise ValueError(f"Unknown output format: {output_format}")

if verbose_level >= 1:
logging.info(f"SkeletonService version: {self._server_version}")

if self._server_version < Version("0.6.0"):
logging.warning(
"SkeletonService version is less than 0.6.0. Please upgrade to the latest version."
valid_output_formats = ["dict", "swc"]
if output_format not in valid_output_formats:
raise ValueError(
f"Unknown output format: {output_format}. Valid options: {valid_output_formats}"
)

# The output formats were changed in server v0.6.0 and must be handled differently by the client
Expand All @@ -480,11 +474,18 @@ def get_skeleton(
elif output_format == "swc":
endpoint_format = "swccompressed"

if skeleton_version is 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 verbose_level >= 1:
logging.info(f"SkeletonService version: {self._server_version}")
if self._server_version < Version("0.6.0"):
logging.warning(
"The optional nature of the 'skeleton_version' parameter will be deprecated in the future. Please specify a skeleton version."
)
skeleton_version = -1

# -1, to specify the latest version, was only added in server v0.6.1
if self._server_version < Version("0.6.1") and skeleton_version == -1:
Expand Down Expand Up @@ -545,7 +546,7 @@ def get_bulk_skeletons(
self,
root_ids: List,
datastack_name: Optional[str] = None,
skeleton_version: Optional[int] = None,
skeleton_version: Optional[int] = 3,
output_format: Literal[
"dict",
"swc",
Expand All @@ -568,16 +569,26 @@ def get_bulk_skeletons(
if not self.fc.l2cache.has_cache():
raise NoL2CacheException("SkeletonClient requires an L2Cache.")

valid_output_formats = ["dict", "swc"]
if output_format not in valid_output_formats:
raise ValueError(
f"Unknown output format: {output_format}. Valid options: {valid_output_formats}"
)

# The output formats were changed in server v0.6.0 and must be handled differently by the client
if output_format == "dict":
endpoint_format = "flatdict"
if self._server_version < Version("0.6.0"):
endpoint_format = "jsoncompressed"
else:
endpoint_format = "flatdict"
elif output_format == "swc":
endpoint_format = "swc"
endpoint_format = "swccompressed"

if skeleton_version is None:
logging.warning(
"The optional nature of the 'skeleton_version' parameter will be deprecated in the future. Please specify a skeleton version."
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}"
)
skeleton_version = -1

url = self._build_bulk_endpoint(
root_ids,
Expand Down

0 comments on commit 6acbddf

Please sign in to comment.