Note
All functions in this module can be used directly from the pydvid.general namespace, e.g. pydvid.general.get_server_info()
Return the json data provided by the /api/server/info DVID call.
Note
All functions in this module can be used directly from the pydvid.keyvalue namespace, e.g. pydvid.keyvalue.get_value(...)
Create a new keyvalue table in the dvid server.
Request the value for the given key and return the whole thing.
Note
All members of this module can be used directly from the pydvid.voxels namespace, e.g. pydvid.voxels.VoxelsAccessor
Note
Please see the quickstart documentation for examples and important usage notes regarding the voxels API.
Query the voxels metedata for the given node/data_name.
Create a new volume in the dvid server.
Request a subvolume from the server and return the raw HTTPResponse stream it returns.
A dict subclass for the dvid nd-data metadata response. Also provides the following convenience attributes: minindex, shape, dtype, axiskeys
Constructor.
| Parameters: | metadata – Either a string containing the json text for the DVID metadata, or a corresponding dict of metadata (e.g. parsed from the json). If a string is passed, invalid json will result in a ValueError exception. |
|---|
Property. The pixel datatype of the remote DVID volume, as a numpy.dtype object.
Property. The maximum coordinates in the DVID volume coordinate space. This is the stop coordinate of the volume’s bounding box. All data above this coordinate in any dimension is guaranteed to be invalid.
Property. The starting coordinate of the volume’s bounding box. All data below this coordinate in any dimension is guaranteed to be invalid.
Property. A string representing the axis indexing order of the volume, e.g. ‘cxyz’ Always starts with ‘c’ (channel).
Note
By DVID convention, the axiskeys are expressed in fortran order.
Convenience method: dump this metadata to json string (for transmission to DVID).
Create a default VoxelsMetadata object from scratch using the given parameters, which can then be customized as needed.
Example usage:
metadata = VoxelsMetadata.create_default_metadata( (3,100,200,300), numpy.uint8, 'cxyz', 1.5, "micrometers" )
# Customize: Adjust resolution for Z-axis
assert metadata["Axes"][2]["Label"] == "Z"
metadata["Axes"][2]["Resolution"] = 6.0
# Customize: name channels
metadata["Properties"]["Values"][0]["Label"] = "intensity-R"
metadata["Properties"]["Values"][1]["Label"] = "intensity-G"
metadata["Properties"]["Values"][2]["Label"] = "intensity-B"
# Prepare for transmission: encode to json
jsontext = metadata.to_json()
Based on the dtype and number of channels for this volume, determine the datatype name (in DVID terminology). For example, if this volume contains 1-channel uint8 data, the DVID datatype is ‘grayscale8’.
Generate a vigra.AxisTags object corresponding to this VoxelsMetadata. (Requires vigra.)
Create a VolumeInfo object to describe the given h5 dataset object.
| Parameters: | dataset – An hdf5 dataset object that meets the following criteria:
|
|---|
(Requires h5py.)
Http client for retrieving a voxels volume data from a DVID server. An instance of VoxelsAccessor is capable of retrieving data from only one remote data volume. To retrieve data from multiple remote volumes, instantiate multiple DvidClient objects.
TODO:
| Parameters: |
|
|---|
Note
When DVID is overloaded, it may indicate its busy status by returning a 503 (service unavailable) error in response to a get/post request. In that case, the get/post methods below will automatically repeat the failed request until the retry_timeout is reached.
Implement convenient numpy-like slicing syntax for volume access.
Examples:
connection = httplib.HTTPConnection( "localhost:8000" ) v = VoxelsAccessor( connection, uuid=abc123, data_name='my_3d_rgb_volume' ) # The whole thing a = v[:] a = v[...] # Arbitrary slicing a = v[...,10,:] # Note: DVID always returns all channels. # Here, you are permitted to slice into the channel axis, # but be aware that this implementation requests all # channels and returns the ones you asked for. blue = v[2] # Therefore, avoid this, since it results in 2 requests for the same data red = v[0] green = v[1] # Instead, do this: rgb = v[:] red, green, blue = rgb[0], rgb[1], rgb[2] # Similarly, you are permitted to use slices with steps, but be aware that # the entire bounding volume will be requested, and the sliced steps will be # extracted from the dense volume. # Extract the upper-left 10x10 tile of every other z-slice: a = v[:,:10,:10,::2] # The above is equivalent to this: a = v[:,:10,:10,:][...,::2]
Implement convenient numpy-like slicing syntax for overwriting regions of a DVID volume.
Examples:
connection = httplib.HTTPConnection( "localhost:8000" ) v = VoxelsAccessor( connection, uuid=abc123, data_name='my_3d_rgb_volume' ) # Overwrite the third z-slice v[...,2] = a # Forbidden: attempt to stepped slices v[...,0:10:2] = a # Error! # Forbidden: attempt to write only a subset of channels (the first axis) v[1,...] = green_data # Error!
Property. The maximum coordinates in the DVID volume coordinate space. This is the stop coordinate of the volume’s bounding box. All data above this coordinate in any dimension is guaranteed to be invalid.
Property. The starting coordinate of the volume’s bounding box. All data below this coordinate in any dimension is guaranteed to be invalid.
Property. The pixel datatype of the remote DVID volume, as a numpy.dtype object.
Property. A string representing the axis indexing order of the volume, e.g. ‘cxyz’ Always starts with ‘c’ (channel).
Note
By DVID convention, the axiskeys are expressed in fortran order.
Request the subvolume specified by the given start and stop pixel coordinates.
Overwrite subvolume specified by the given start and stop pixel coordinates with new_data.