Documentation ¶
Overview ¶
Package labelvol supports label-specific sparse volumes. It can be synced with labelblk and is a different view of 64-bit label data.
Index ¶
- Constants
- Variables
- func DecodeTKey(tk storage.TKey) (label uint64, block dvid.IZYXString, err error)
- func FoundSparseVol(ctx storage.Context, label uint64, bounds Bounds) (bool, error)
- func GetSparseCoarseVol(ctx storage.Context, label uint64) ([]byte, error)
- func GetSparseVol(ctx storage.Context, label uint64, bounds Bounds) ([]byte, error)
- func NewTKey(label uint64, block dvid.IZYXString) storage.TKey
- type Bounds
- type Data
- func (d *Data) DoRPC(request datastore.Request, reply *datastore.Response) error
- func (d *Data) GetLabelRLEs(v dvid.VersionID, label uint64) (dvid.BlockRLEs, error)
- func (d *Data) GetSyncedLabelblk(v dvid.VersionID) (*labelblk.Data, error)
- func (d *Data) GobDecode(b []byte) error
- func (d *Data) GobEncode() ([]byte, error)
- func (d *Data) Help() string
- func (d *Data) InitSync(name dvid.InstanceName) []datastore.SyncSub
- func (d *Data) LoadMutable(root dvid.VersionID, storedVersion, expectedVersion uint64) (bool, error)
- func (d *Data) MarshalJSON() ([]byte, error)
- func (d *Data) MergeLabels(v dvid.VersionID, m labels.MergeOp) error
- func (d *Data) NewLabel(v dvid.VersionID) (uint64, error)
- func (d *Data) PutSparseVol(v dvid.VersionID, label uint64, r io.Reader) error
- func (d *Data) Send(s message.Socket, roiname string, uuid dvid.UUID) error
- func (d *Data) ServeHTTP(uuid dvid.UUID, ctx *datastore.VersionedCtx, w http.ResponseWriter, ...)
- func (d *Data) SplitCoarseLabels(v dvid.VersionID, fromLabel uint64, r io.ReadCloser) (toLabel uint64, err error)
- func (d *Data) SplitLabels(v dvid.VersionID, fromLabel uint64, r io.ReadCloser) (toLabel uint64, err error)
- type Properties
- type Type
Constants ¶
const ( Version = "0.1" RepoURL = "github.com/janelia-flyem/dvid/datatype/labelvol" TypeName = "labelvol" )
const HelpMessage = `` /* 8803-byte string literal not displayed */
Variables ¶
var ( DefaultBlockSize int32 = labelblk.DefaultBlockSize DefaultRes float32 = labelblk.DefaultRes DefaultUnits = labelblk.DefaultUnits )
Functions ¶
func DecodeTKey ¶
DecodeTKey returns a label and block index bytes from a label block RLE key. The block index bytes are returned because different block indices may be used (e.g., CZYX), and its up to caller to determine which one is used for this particular key.
func FoundSparseVol ¶
FoundSparseVol returns true if a sparse volume is found for the given label within the given bounds.
func GetSparseCoarseVol ¶
GetSparseCoarseVol returns an encoded sparse volume given a label. The encoding has the following format where integers are little endian:
byte Set to 0 uint8 Number of dimensions uint8 Dimension of run (typically 0 = X) byte Reserved (to be used later) uint32 # Blocks [TODO. 0 for now] uint32 # Spans Repeating unit of: int32 Block coordinate of run start (dimension 0) int32 Block coordinate of run start (dimension 1) int32 Block coordinate of run start (dimension 2) int32 Length of run
func GetSparseVol ¶
GetSparseVol returns an encoded sparse volume given a label. The encoding has the following format where integers are little endian:
byte Payload descriptor: Bit 0 (LSB) - 8-bit grayscale Bit 1 - 16-bit grayscale Bit 2 - 16-bit normal ... uint8 Number of dimensions uint8 Dimension of run (typically 0 = X) byte Reserved (to be used later) uint32 # Voxels uint32 # Spans Repeating unit of: int32 Coordinate of run start (dimension 0) int32 Coordinate of run start (dimension 1) int32 Coordinate of run start (dimension 2) int32 Length of run bytes Optional payload dependent on first byte descriptor
Types ¶
type Data ¶
type Data struct { *datastore.Data Properties }
Data instance of labelvol, label sparse volumes.
func NewData ¶
func NewData(uuid dvid.UUID, id dvid.InstanceID, name dvid.InstanceName, c dvid.Config) (*Data, error)
NewData returns a pointer to labelvol data.
func (*Data) GetLabelRLEs ¶
Returns RLEs for a given label where the key of the returned map is the block index in string format.
func (*Data) GetSyncedLabelblk ¶
func (*Data) InitSync ¶
func (d *Data) InitSync(name dvid.InstanceName) []datastore.SyncSub
InitSync implements the datastore.Syncer interface
func (*Data) LoadMutable ¶
func (d *Data) LoadMutable(root dvid.VersionID, storedVersion, expectedVersion uint64) (bool, error)
LoadMutable loads mutable properties of label volumes like the maximum labels for each version. Note that we load these max labels from key-value pairs rather than data instance properties persistence, because in the case of a crash, the actually stored repo data structure may be out-of-date compared to the guaranteed up-to-date key-value pairs for max labels.
func (*Data) MarshalJSON ¶
func (*Data) MergeLabels ¶
MergeLabels handles merging of any number of labels throughout the various label data structures. It assumes that the merges aren't cascading, e.g., there is no attempt to merge label 3 into 4 and also 4 into 5. The caller should have flattened the merges. TODO: Provide some indication that subset of labels are under evolution, returning
an "unavailable" status or 203 for non-authoritative response. This might not be feasible for clustered DVID front-ends due to coordination issues.
EVENTS ¶
labels.MergeStartEvent occurs at very start of merge and transmits labels.DeltaMergeStart struct.
labels.MergeBlockEvent occurs for every block of a merged label and transmits labels.DeltaMerge struct.
labels.MergeEndEvent occurs at end of merge and transmits labels.DeltaMergeEnd struct.
func (*Data) PutSparseVol ¶
PutSparseVol stores an encoded sparse volume that stays within a given forward label. Note that this encoded sparse volume is added to any existing sparse volume for a body rather than replace it. To carve out a part of an existing sparse volume, use the SplitLabels().
This function handles modification/deletion of all denormalized data touched by this sparse label volume.
EVENTS
func (*Data) Send ¶
Send transfers all key-value pairs pertinent to this data type as well as the storage.DataStoreType for them.
func (*Data) ServeHTTP ¶
func (d *Data) ServeHTTP(uuid dvid.UUID, ctx *datastore.VersionedCtx, w http.ResponseWriter, r *http.Request)
ServeHTTP handles all incoming HTTP requests for this data.
func (*Data) SplitCoarseLabels ¶
func (d *Data) SplitCoarseLabels(v dvid.VersionID, fromLabel uint64, r io.ReadCloser) (toLabel uint64, err error)
SplitCoarseLabels splits a portion of a label's voxels into a new label, which is returned. The input is a binary sparse volume defined by block coordinates and should be the smaller portion of a labeled region-to-be-split.
EVENTS ¶
labels.SplitStartEvent occurs at very start of split and transmits labels.DeltaSplitStart struct.
labels.SplitBlockEvent occurs for every block of a split label and transmits labels.DeltaSplit struct.
labels.SplitEndEvent occurs at end of split and transmits labels.DeltaSplitEnd struct.
func (*Data) SplitLabels ¶
func (d *Data) SplitLabels(v dvid.VersionID, fromLabel uint64, r io.ReadCloser) (toLabel uint64, err error)
SplitLabels splits a portion of a label's voxels into a new label, which is returned. The input is a binary sparse volume and should preferably be the smaller portion of a labeled region. In other words, the caller should chose to submit for relabeling the smaller portion of any split.
EVENTS ¶
labels.SplitStartEvent occurs at very start of split and transmits labels.DeltaSplitStart struct.
labels.SplitBlockEvent occurs for every block of a split label and transmits labels.DeltaSplit struct.
labels.SplitEndEvent occurs at end of split and transmits labels.DeltaSplitEnd struct.
type Properties ¶
type Properties struct { Resolution dvid.Resolution // Block size for this repo BlockSize dvid.Point3d // The maximum label id found in each version of this instance. // Can be unset if no new label was added at that version, in which case // you must traverse DAG to find max label of parent. MaxLabel map[dvid.VersionID]uint64 // The maximum label for this instance in the entire repo. This allows us to do // conflict-free merges without any relabeling. Note that relabeling (rebasing) // is required if we move data between repos, e.g., when pushing remote nodes, // since we have no control over which labels were created remotely and there // could be conflicts between the local and remote repos. When mutations only // occur within a single repo, however, this atomic label allows us to prevent // conflict across all versions within this repo. MaxRepoLabel uint64 // contains filtered or unexported fields }
Properties are additional properties for data beyond those in standard datastore.Data.
func (Properties) MarshalJSON ¶
func (p Properties) MarshalJSON() ([]byte, error)