labels

package
v0.0.0-...-e545f54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2014 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package labels provides various indexing options for labels and label maps. It defines interfaces that can be used by other packages implementing 64-bit labels and label maps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeSizes

func ComputeSizes(labeler Labeler, sizeCh chan *storage.Chunk, db storage.OrderedKeyValueSetter,
	versionID dvid.VersionLocalID, wg *sync.WaitGroup)

Runs asynchronously and assumes that sparse volumes per spatial indices are ordered by mapped label, i.e., we will get all data for body N before body N+1. Exits when receives a nil in channel.

func GetSizeRange

func GetSizeRange(labeler Labeler, uuid dvid.UUID, minSize, maxSize uint64) (string, error)

GetSizeRange returns a JSON list of mapped labels that have volumes within the given range. If maxSize is 0, all mapped labels are returned >= minSize.

func NewForwardMapKey

func NewForwardMapKey(labeler Labeler, vID dvid.VersionLocalID, label []byte, mapping uint64) *datastore.DataKey

NewForwardMapKey returns a datastore.DataKey that encodes a "label + mapping", where the label and mapping are both uint64.

func NewLabelSizesKey

func NewLabelSizesKey(labeler Labeler, vID dvid.VersionLocalID, size, label uint64) *datastore.DataKey

NewLabelSizesKey returns a datastore.DataKey that encodes a "size + mapped label".

func NewLabelSpatialMapKey

func NewLabelSpatialMapKey(labeler Labeler, vID dvid.VersionLocalID, label uint64, block dvid.IndexZYX) *datastore.DataKey

NewLabelSpatialMapKey returns a datastore.DataKey that encodes a "label + spatial index", where the spatial index references a block that contains a voxel with the given label.

func NewLabelSurfaceKey

func NewLabelSurfaceKey(labeler Labeler, vID dvid.VersionLocalID, label uint64) *datastore.DataKey

NewLabelSurfaceKey returns a datastore.DataKey that provides a surface for a given label.

func NewSpatialMapKey

func NewSpatialMapKey(labeler Labeler, vID dvid.VersionLocalID, blockIndex dvid.Index, label []byte,
	mapping uint64) *datastore.DataKey

NewSpatialMapKey returns a datastore.DataKey that encodes a "spatial index + label + mapping".

func StoreKeyLabelSpatialMap

func StoreKeyLabelSpatialMap(labeler Labeler, batcher storage.Batcher, versionID dvid.VersionLocalID, zyxBytes []byte,
	labelRLEs map[uint64]dvid.RLEs)

Store the KeyLabelSpatialMap keys (index = b + s) with slice of runs for value.

func ZeroBytes

func ZeroBytes() []byte

ZeroBytes returns a slice of bytes that represents the zero label.

Types

type KeyType

type KeyType byte
const (
	// KeyInverseMap have keys of form 'b+a'
	KeyInverseMap KeyType = iota

	// KeyForwardMap have keys of form 'a+b'
	// For superpixel->body maps, this key would be superpixel+body.
	KeyForwardMap

	// KeySpatialMap have keys of form 's+a+b'
	// They are useful for composing label maps for a spatial index.
	KeySpatialMap

	// KeyLabelSpatialMap have keys of form 'b+s' and have a sparse volume
	// encoding for its value. They are useful for returning all blocks
	// intersected by a label.
	KeyLabelSpatialMap

	// KeyLabelSizes have keys of form 'v+b'.
	// They allow rapid size range queries.
	KeyLabelSizes
)

Label indexing is handled through a variety of key spaces that optimize throughput for access patterns required by our API. For dcumentation purposes, consider the following key components:

a: original label
b: mapped label
s: spatial index (coordinate of a block)
v: # of voxels for a label

func (KeyType) String

func (t KeyType) String() string

type Labeler

type Labeler interface {
	DataKey(dvid.VersionLocalID, dvid.Index) *datastore.DataKey
}

Labelers can store label data

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL