annotationframeworkclient package¶
Submodules¶
annotationengine module¶
auth module¶
-
class
annotationframeworkclient.auth.
AuthClient
(token_file='~/.cloudvolume/secrets/chunkedgraph-secret.json', token_key='token', token=None, server_address='https://global.daf-apis.com')[source]¶ Bases:
object
Client to find and use auth tokens to access the dynamic annotation framework services.
Parameters: - token_file (str, optional) – Path to a JSON key:value file holding your auth token. By default, “~/.cloudvolume/secrets/chunkedgraph-secret.json”
- token_key (str, optional) – Key for the token in the token_file. By default, “token”
- token (str or None, optional) – Direct entry of the token as a string. If provided, overrides the files. If None, attempts to use the file paths.
- server_address (str, optional,) – URL to the auth server. By default, uses a default server address.
-
get_new_token
(open=False)[source]¶ Currently, returns instructions for getting a new token based on the current settings and saving it to the local environment. New OAuth tokens are currently not able to be retrieved programmatically.
Parameters: open (bool, optional) – If True, opens a web browser to the web page where you can generate a new token.
-
get_token
(token_key=None)[source]¶ Load a token with a given key the specified token file
Parameters: token_key (str or None, optional) – key in the token file JSON, by default None. If None, uses ‘token’.
-
request_header
¶ Formatted request header with the specified token
-
save_token
(token=None, token_key='token', overwrite=False, token_file=None, switch_token=True)[source]¶ Conveniently save a token in the correct format.
After getting a new token by following the instructions in authclient.get_new_token(), you can save it with a fully default configuration by running:
token = ‘my_shiny_new_token’
authclient.save_token(token=token)
Now on next load, authclient=AuthClient() will make an authclient instance using this token. If you would like to specify more information about the json file where the token will be stored, see the parameters below.
Parameters: - token (str, optional) – New token to save, by default None
- token_key (str, optional) – Key for the token in the token_file json, by default “token”
- overwrite (bool, optional) – Allow an existing token to be changed, by default False
- token_file (str, optional) – Path to the token file, by default None. If None, uses the default file location specified above.
- switch_token (bool, optional) – If True, switch the auth client over into using the new token, by default True
-
token
¶ Secret token used to authenticate yourself to the Dynamic Annotation Framework services.
chunkedgraph module¶
emannotationschemas module¶
-
annotationframeworkclient.emannotationschemas.
SchemaClient
(server_address=None, auth_client=None, api_version='latest')[source]¶
-
class
annotationframeworkclient.emannotationschemas.
SchemaClientLegacy
(server_address, auth_header, api_version, endpoints, server_name)[source]¶ Bases:
annotationframeworkclient.base.ClientBase
frameworkclient module¶
imagery module¶
infoservice module¶
-
annotationframeworkclient.infoservice.
InfoServiceClient
(server_address=None, dataset_name=None, auth_client=None, api_version='latest')[source]¶
-
class
annotationframeworkclient.infoservice.
InfoServiceClientLegacy
(server_address, auth_header, api_version, endpoints, server_name, dataset_name)[source]¶ Bases:
annotationframeworkclient.base.ClientBaseWithDataset
-
annotation_endpoint
(dataset_name=None, use_stored=True)[source]¶ AnnotationEngine endpoint for a dataset.
Parameters: - dataset_name (str or None, optional) – Name of the dataset to look up. If None, uses the value specified by the client. Default is None.
- use_stored (bool, optional) – If True, uses the cached value if available. If False, re-queries the InfoService. Default is True.
Returns: Location of the AnnotationEngine
Return type: str
-
flat_segmentation_source
(dataset_name=None, use_stored=True, format_for='raw')[source]¶ Cloud path to the flat segmentation for the dataset
Parameters: - dataset_name (str or None, optional) – Name of the dataset to look up. If None, uses the value specified by the client. Default is None.
- use_stored (bool, optional) – If True, uses the cached value if available. If False, re-queries the InfoService. Default is True.
- format_for ('raw', 'cloudvolume', or 'neuroglancer', optional) – Formats the path for different uses. If ‘raw’ (default), the path in the InfoService is passed along. If ‘cloudvolume’, a “precomputed://gs://” type path is converted to a full https URL. If ‘neuroglancer’, a full https URL is converted to a “precomputed://gs://” type path.
Returns: Formatted cloud path to the flat segmentation
Return type: str
-
get_dataset_info
(dataset_name=None, use_stored=True)[source]¶ Gets the info record for a dataset
Parameters: - dataset_name (str, optional) – Dataset to look up. If None, uses the one specified by the client. By default None
- use_stored (bool, optional) – If True and the information has already been queried for that dataset, then uses the cached version. If False, re-queries the infromation. By default True
Returns: The complete info record for the dataset
Return type: dict or None
-
get_datasets
()[source]¶ Query which datasets are available at the info service
Returns: List of dataset names Return type: list
-
graphene_source
(dataset_name=None, use_stored=True, format_for='raw')[source]¶ Cloud path to the chunkgraph-backed Graphene segmentation for a dataset
Parameters: - dataset_name (str or None, optional) – Name of the dataset to look up. If None, uses the value specified by the client. Default is None.
- use_stored (bool, optional) – If True, uses the cached value if available. If False, re-queries the InfoService. Default is True.
- format_for ('raw', 'cloudvolume', or 'neuroglancer', optional) – Formats the path for different uses. If ‘raw’ (default), the path in the InfoService is passed along. If ‘cloudvolume’, a “graphene://https://” type path is used If ‘neuroglancer’, a “graphene://https://” type path is used, as needed by Neuroglancer.
Returns: Formatted cloud path to the Graphene segmentation
Return type: str
-
image_source
(dataset_name=None, use_stored=True, format_for='raw')[source]¶ Cloud path to the imagery for the dataset
Parameters: - dataset_name (str or None, optional) – Name of the dataset to look up. If None, uses the value specified by the client. Default is None.
- use_stored (bool, optional) – If True, uses the cached value if available. If False, re-queries the InfoService. Default is True.
- format_for ('raw', 'cloudvolume', or 'neuroglancer', optional) – Formats the path for different uses. If ‘raw’ (default), the path in the InfoService is passed along. If ‘cloudvolume’, a “precomputed://gs://” type path is converted to a full https URL. If ‘neuroglancer’, a full https URL is converted to a “precomputed://gs://” type path.
Returns: Formatted cloud path to the flat segmentation
Return type: str
-
supervoxel_source
(dataset_name=None, use_stored=True, format_for='raw')[source]¶ Cloud path to the supervoxel segmentation for a dataset
Parameters: - dataset_name (str or None, optional) – Name of the dataset to look up. If None, uses the value specified by the client. Default is None.
- use_stored (bool, optional) – If True, uses the cached value if available. If False, re-queries the InfoService. Default is True.
- format_for ('raw', 'cloudvolume', or 'neuroglancer', optional) – Formats the path for different uses. If ‘raw’ (default), the path in the InfoService is passed along. If ‘cloudvolume’, a “precomputed://gs://” type path is converted to a full https URL. If ‘neuroglancer’, a full https URL is converted to a “precomputed://gs://” type path.
Returns: Formatted cloud path to the supervoxel segmentation
Return type: str
-
synapse_segmentation_source
(dataset_name=None, use_stored=True, format_for='raw')[source]¶ Cloud path to the synapse segmentation for a dataset
Parameters: - dataset_name (str or None, optional) – Name of the dataset to look up. If None, uses the value specified by the client. Default is None.
- use_stored (bool, optional) – If True, uses the cached value if available. If False, re-queries the InfoService. Default is True.
- format_for ('raw', 'cloudvolume', or 'neuroglancer', optional) – Formats the path for different uses. If ‘raw’ (default), the path in the InfoService is passed along. If ‘cloudvolume’, a “precomputed://gs://” type path is converted to a full https URL. If ‘neuroglancer’, a full https URL is converted to a “precomputed://gs://” type path.
Returns: Formatted cloud path to the synapse segmentation
Return type: str
-
jsonservice module¶
-
annotationframeworkclient.jsonservice.
JSONService
(server_address=None, auth_client=None, api_version='latest')[source]¶ Client factory to interface with the JSON state service.
Parameters: - server_address (str, optional) – URL to the JSON state server. If None, set to the default global server address. By default None.
- auth_client (An Auth client, optional) – An auth client with a token for the same global server, by default None
- api_version (int or 'latest', optional) – Which endpoint API version to use or ‘latest’. By default, ‘latest’ tries to ask the server for which versions are available, if such functionality exists, or if not it defaults to the latest version for which there is a client. By default ‘latest’
-
class
annotationframeworkclient.jsonservice.
JSONServiceLegacy
(server_address, auth_header, api_version, endpoints, server_name)[source]¶ Bases:
annotationframeworkclient.base.ClientBase
-
build_neuroglancer_url
(state_id, ngl_url)[source]¶ Build a URL for a Neuroglancer deployment that will automatically retrieve specified state.
Parameters: - state_id (int) – State id to retrieve
- ngl_url (str) – Base url of a neuroglancer deployment. For example, ‘https://neuromancer-seung-import.appspot.com’.
Returns: The full URL requested
Return type: str
-
-
class
annotationframeworkclient.jsonservice.
JSONServiceV1
(server_address, auth_header, api_version, endpoints, server_name)[source]¶ Bases:
annotationframeworkclient.base.ClientBase
-
build_neuroglancer_url
(state_id, ngl_url)[source]¶ Build a URL for a Neuroglancer deployment that will automatically retrieve specified state.
Parameters: - state_id (int) – State id to retrieve
- ngl_url (str) – Base url of a neuroglancer deployment. For example, ‘https://neuromancer-seung-import.appspot.com’.
Returns: The full URL requested
Return type: str
-