syconn.backend package¶
syconn.backend.base module¶
- class syconn.backend.base.BTBase(identifier, cache_decomp=False, read_only=True, disable_locking=False)[source]¶
Bases:
syconn.backend.base.StorageBase
- class syconn.backend.base.FSBase(inp_p, cache_decomp=False, read_only=True, max_delay=100, timeout=1000, disable_locking=True, max_nb_attempts=100)[source]¶
Bases:
syconn.backend.base.StorageBase
Customized dictionary to store compressed numpy arrays, but with a intuitive user interface, i.e. compression will happen in background. kwarg ‘cache_decomp’ can be enabled to cache decompressed arrays additionally (save decompressing time when accessing items frequently).
- pull(source=None)[source]¶
Fetches data from source.
- Parameters
source (
Optional
[str
]) – Source location
- push(dest=None)[source]¶
Pushes data to destination.
- Parameters
dest (
Optional
[str
]) – storage destination
syconn.backend.storage module¶
- class syconn.backend.storage.AttributeDict(inp_p, **kwargs)[source]¶
Bases:
syconn.backend.base.FSBase
General purpose dictionary class inherited from
syconn.backend.base.StorageClass
.
- class syconn.backend.storage.BinarySearchStore(fname, id_array=None, attr_arrays=None, overwrite=False, n_shards=None, rdcc_nbytes=5242880)[source]¶
Bases:
object
- get_attributes(obj_ids, attr_key)[source]¶
Query attributes of given obj_ids. Note that this will not raise an Exception if a ID does not exist in the store, as the lookup uses binary search.
- Parameters
obj_ids (
ndarray
) – Object IDs to query.attr_key (
str
) – Value type obtained from the store.
- Return type
ndarray
- Returns
Value array.
- property id_array: numpy.ndarray¶
Returns: Flat ID array.
- Return type
ndarray
- property n_shards: int¶
Number of shards/chunks the ID and attribute arrays are split into. Returns:
- Return type
int
- class syconn.backend.storage.CompressedStorage(inp, **kwargs)[source]¶
Bases:
syconn.backend.base.FSBase
Customized dictionary to store compressed numpy arrays, but with a intuitive user interface, i.e. compression will happen in background. kwarg ‘cache_decomp’ can be enabled to cache decompressed arrays additionally (save decompressing time when accessing items frequently).
- class syconn.backend.storage.MeshStorage(inp, load_colarr=False, compress=False, **kwargs)[source]¶
Bases:
syconn.backend.base.FSBase
Customized dictionary to store compressed numpy arrays, but with a intuitive user interface, i.e. compression will happen in background. kwarg ‘cache_decomp’ can be enabled to cache decompressed arrays additionally (save decompressing time).
- class syconn.backend.storage.SkeletonStorage(inp, **kwargs)[source]¶
Bases:
syconn.backend.base.FSBase
Stores skeleton dictionaries (keys: “nodes”, “diameters”, “edges”) as compressed numpy arrays.
- syconn.backend.storage.VoxelStorage(inp, **kwargs)[source]¶
Alias for
VoxelStorageDyn
.- Parameters
inp –
**kwargs –
Returns:
- class syconn.backend.storage.VoxelStorageClass(inp, **kwargs)[source]¶
Bases:
syconn.backend.storage.VoxelStorageL
Customized dictionary to store compressed numpy arrays, but with a intuitive user interface, i.e. compression will happen in background. kwarg ‘cache_decomp’ can be enabled to cache decompressed arrays additionally (save decompressing time).
No locking provided in this class!
- class syconn.backend.storage.VoxelStorageDyn(inp, voxel_mode=True, voxeldata_path=None, **kwargs)[source]¶
Bases:
syconn.backend.storage.CompressedStorage
Similar to VoxelStorageL but does not store the voxels explicitly, but the information necessary to query the voxels of an object.
If
voxel_mode = True
getter method will operate on underlying data set to retrieve voxels of an object. __setitem__ throws RuntimeError. __getitem__ will return a list of 3D binary cubes with ones at the object’s locations (key: object ID). Note: The item ID has to match the object ID in the segmentation.Otherwise (
voxel_mode = False
) __getitem__ and __setitem__ allow manipulation of the object’s bounding boxes. In this case voxeldata_path has to be given or already be existent in loaded dictionary. Expects the source path of a KnossoDataset (see knossos_utils), like:kd = KnossoDataset() kd.initialize_from_knossos_path(SOURCE_PATH)
or
kd = kd_factory(SOURCE_PATH)
- __setitem__ requires the object ID as key and an 3 dimensional array with
all bounding boxes defining the object (N, 2, 3). Those BBs are then used to query the object voxels. The bounding box is expected to be two 3D coordinates which define the lower and the upper limits.
- get_boundingdata(item)[source]¶
Get the object bounding boxes. :type item:
int
:param item: Object ID.- Return type
List
[ndarray
]- Returns
List of bounding boxes (in voxels; xyz).
- get_voxel_cache(key)[source]¶
Voxels corresponding to item key must have been added to store via
set_voxel_cache()
. This implementation operates independent ofget_voxeldata()
.- Parameters
key (
int
) – Segment ID.- Returns
Voxel coordinates.
- get_voxel_data_cubed(item)[source]¶
Get the object binary mask as dense 3D array (xyz).
- Parameters
item (
int
) – Object ID.- Return type
Tuple
[ndarray
,ndarray
]- Returns
3D mask, cube offset in voxels (xyz).
- class syconn.backend.storage.VoxelStorageL(inp, **kwargs)[source]¶
Bases:
syconn.backend.base.FSBase
Customized dictionary to store compressed numpy arrays, but with a intuitive user interface, i.e. compression will happen in background. kwarg ‘cache_decomp’ can be enabled to cache decompressed arrays additionally (save decompressing time).
- class syconn.backend.storage.VoxelStorageLazyLoading(path, overwrite=False)[source]¶
Bases:
object
Similar to VoxelStorage but uses lazy loading via numpy npz files.
Notes