The AccessLayer¶
You can import
from ./
or with bfly
installed.
from bfly import AccessLayer
Or, in scripts in some directories:
# if './bfly/' in sys.path
from CoreLayer import AccessLayer
# if './bfly/CoreLayer/' in sys.path
import AccessLayer
You can from AccessLayer import
All QueryLayer.
# if './bfly/CoreLayer' in sys.path
from AccessLayer import QueryLayer, ImageLayer, UtilityLayer
AccessLayer¶
You can import AccessLayer
from bfly
and CoreLayer
.
AccessLayer classes¶
-
class
AccessLayer.
NDStore
(application, request, **kwargs)[source]¶ Responds to
bfly.Webserver._webapp
/nd endpoint-
inherits
¶
Methods
-
get_info
(_keywords)[source]¶ Loads
InfoQuery
forINPUT.METHODS.META
Returns: made with info from get_config
Return type: InfoQuery
-
get_slice
(_keywords)[source]¶ Make
DataQuery
for an image at request pathParameters: _keywords (dict) – All URL parameters Returns: Created with the sub_data()
for the full requestReturn type: DataQuery
-
get_vol
(_keywords)[source]¶ Make
DataQuery
for an image at request pathParameters: _keywords (dict) – All URL parameters Returns: Created with the sub_data()
for the full requestReturn type: DataQuery
-
parse
(request)[source]¶ Extract details from any of the methods Overrides
Database.parse()
Parameters: request (str) – The full request Returns: contains standard details for each request Return type: QueryLayer.Query
-
sub_data
(_keywords, bounds, resolution, img_fmt='tif')[source]¶ Make
DataQuery
for any subregion or requestParameters: - _keywords (dict) – All URL parameters
- bounds (numpy.ndarray) – The 6x1 array of z,y,x,depth,width,height values for the bounds requested for a data query
- resolution (int) – the number of halvings along the X and Y axes
Returns: Return type: DataQuery
-
-
class
AccessLayer.
API
(application, request, **kwargs)[source]¶ Responds to
bfly.Webserver._webapp
/api endpoint-
inherits
¶
Methods
-
get_data
(_method)[source]¶ Make
DataQuery
for an image at request pathParameters: _method (str) – The name of the method requesting image information Returns: Created with the sub_data()
for the full requestReturn type: DataQuery
-
get_value
(g)[source]¶ get the name of a group
Parameters: g (dict) – The group from BFLY_CONFIG
Returns: the name of g Return type: str
-
parse
(request)[source]¶ Extract details from any of the methods Overrides
Database.parse()
Calls
_meta_info()
,_feature_info()
,_get_group()
, or_get_data()
to return anInfoQuery
orDataQuery
as a response to the givenmethod
Parameters: request (str) – The single method requested in the URL Returns: contains standard details for each request Return type: QueryLayer.Query
-
sub_data
(_method, bounds)[source]¶ Make
DataQuery
for any subregion or requestParameters: - _method (str) – The name of the method requesting image information
- bounds (numpy.ndarray) – The 6x1 array of z,y,x,depth,width,height values for the bounds requested for a data query
Returns: The
OUTPUT.INFO
.Path.NAME
keyword has the path to data in the requested group from_get_group_dict()
Return type: DataQuery
-
-
class
AccessLayer.
Precomputed
(application, request, **kwargs)[source]¶ Responds to
bfly.Webserver._webapp
/nd endpoint-
inherits
¶
Methods
-
get_info
(_keywords)[source]¶ Loads
InfoQuery
forINPUT.METHODS.META
Returns: made with info from get_config
Return type: InfoQuery
-
get_vol
(_keywords)[source]¶ Make
DataQuery
for an image at request pathParameters: _keywords (dict) – All URL parameters Returns: Created with the sub_data()
for the full requestReturn type: DataQuery
-
parse
(request)[source]¶ Extract details from any of the methods Overrides
Database.parse()
Parameters: request (str) – The full request Returns: contains standard details for each request Return type: QueryLayer.Query
-
sub_data
(_keywords, bounds, resolution, img_fmt='tif')[source]¶ Make
DataQuery
for any subregion or requestParameters: - _keywords (dict) – All URL parameters
- bounds (numpy.ndarray) – The 6x1 array of z,y,x,depth,width,height values for the bounds requested for a data query
- resolution (int) – the number of halvings along the X and Y axes
Returns: Return type: DataQuery
-
-
class
AccessLayer.
StaticHandler
(application, request, **kwargs)[source]¶ Returns static files to
bfly.Webserver._webapp
Parameters: _root (__name__) – A module in the directory containing the static path -
_basic_mime
¶ str – The default mime type for static requests
-
_root
¶ __name__ – taken from the
_root
argument
-
:h:`Methods`
-
get
(*args, **kwargs)[source]¶ Asynchronously call
handle()
with_ex
Parameters: path (str) – the static path requested in the URL
-
Request Handler base class¶
-
class
AccessLayer.
RequestHandler
(application, request, **kwargs)[source]¶ Responds to requests from
bfly.Webserver._webapp
-
INPUT
¶ INPUT
– Static input keywords for all inAccessLayer
-
RUNTIME
¶ RUNTIME
– Static runtime keywords for all inAccessLayer
-
OUTPUT
¶ OUTPUT
– Static output keywords for all inAccessLayer
-
BFLY_CONFIG
¶ dict – All data from rh-config
-
_ex
¶ concurrent.futures.ThreadPoolExecutor
– Allows handling of parallel requests
-
_core
¶ CoreLayer.Core
– Converts a request into a response
-
_db
¶ DatabaseLayer.Database
– Loads data forINPUT
.METHODS.FEATURE
-
:h:`Methods`
-
get_query_argument
(name, default=<object object>, strip=True)[source]¶ Returns the value of the argument with the given name from the request query string.
If default is not provided, the argument is considered to be required, and we raise a MissingArgumentError if it is missing.
If the argument appears in the url more than once, we return the last value.
The returned value is always unicode.
New in version 3.2.
-
get
(*args, **kwargs)[source]¶ Asynchronously uses
_ex
to callhandle()
The query is returned from
parse()
and passed asynchronously tohandle()
.Parameters: args (list) – args[0] (str) method requested in the URL
-
handle
(_query)[source]¶ Sends response of
_core
to_query
Calls
Core.get_data()
orCore.get_info()
based on the type of the query fromQuery.is_data()
Parameters: _query ( Query
) – The details formatted byparse()
-
handle_static
(filepath)[source]¶ Serves a path in the ./bfly/static directory
Parameters: path (str) – the actual path to a file on the server
-
initialize
(_core, _db, _config, _root='')[source]¶ Bind Core, database, and configuration
Parameters: - _core (
CoreLayer.Core
) – set to_core
- _db (
CoreLayer.Database
) – set to_db
- _config (dict) – set to
BFLY_CONFIG
- _core (
-
parse
(request)[source]¶ Extract details from any of the methods
Must be overridden by derived classes
Parameters: request (str) – The single method requested in the URL Returns: contains standard details for each request Return type: QueryLayer.Query
-