dvid: github.com/janelia-flyem/dvid/datatype/labelvol Index | Files

package labelvol

import "github.com/janelia-flyem/dvid/datatype/labelvol"

Package labelvol supports label-specific sparse volumes. It can be synced with labelblk and is a different view of 64-bit label data.

Index

Package Files

keys.go labelvol.go merge_split.go push.go sync.go

Constants

const (
    Version  = "0.1"
    RepoURL  = "github.com/janelia-flyem/dvid/datatype/labelvol"
    TypeName = "labelvol"
)

Variables

var (
    DefaultBlockSize int32   = labelblk.DefaultBlockSize
    DefaultRes       float32 = labelblk.DefaultRes
    DefaultUnits             = labelblk.DefaultUnits
)

func DecodeTKey Uses

func DecodeTKey(tk storage.TKey) (label uint64, block dvid.IZYXString, err error)

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 NewTKey Uses

func NewTKey(label uint64, block dvid.IZYXString) storage.TKey

NewTKey returns a TKey for storing a "label + spatial index", where the spatial index references a block that contains a voxel with the given label.

type Data Uses

type Data struct {
    *datastore.Data
    Properties

    // Keep track of sync operations that could be updating the data.
    // TODO: Think about making this per label since sync status is pessimistic, assuming
    // all labels are being updated.
    datastore.Updater
    // contains filtered or unexported fields
}

Data instance of labelvol, label sparse volumes.

func GetByDataUUID Uses

func GetByDataUUID(dataUUID dvid.UUID) (*Data, error)

GetByDataUUID returns a pointer to labelvol data given a data UUID.

func GetByUUIDName Uses

func GetByUUIDName(uuid dvid.UUID, name dvid.InstanceName) (*Data, error)

GetByUUIDName returns a pointer to labelvol data given a version (UUID) and data name.

func GetByVersionName Uses

func GetByVersionName(v dvid.VersionID, name dvid.InstanceName) (*Data, error)

GetByVersionName returns a pointer to labelblk data given a UUID and data name.

func NewData Uses

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) CopyPropertiesFrom Uses

func (d *Data) CopyPropertiesFrom(src datastore.DataService, fs storage.FilterSpec) error

CopyPropertiesFrom copies the data instance-specific properties from a given data instance into the receiver's properties. Fulfills the datastore.PropertyCopier interface.

func (*Data) DeleteArea Uses

func (d *Data) DeleteArea(ctx *datastore.VersionedCtx, label uint64, subvol *dvid.Subvolume) error

func (*Data) DescribeTKeyClass Uses

func (d *Data) DescribeTKeyClass(tkc storage.TKeyClass) string

DescribeTKeyClass returns a string explanation of what a particular TKeyClass is used for. Implements the datastore.TKeyClassDescriber interface.

func (*Data) DoRPC Uses

func (d *Data) DoRPC(req datastore.Request, reply *datastore.Response) error

DoRPC acts as a switchboard for RPC commands.

func (*Data) DumpSubvols Uses

func (d *Data) DumpSubvols(uuid dvid.UUID, v dvid.VersionID, dirStr string)

func (*Data) FoundSparseVol Uses

func (d *Data) FoundSparseVol(ctx *datastore.VersionedCtx, label uint64, bounds dvid.Bounds) (bool, error)

FoundSparseVol returns true if a sparse volume is found for the given label within the given bounds.

func (*Data) GetLabelRLEs Uses

func (d *Data) GetLabelRLEs(v dvid.VersionID, label uint64) (dvid.BlockRLEs, error)

Returns RLEs for a given label where the key of the returned map is the block index in string format.

func (*Data) GetSparseCoarseVol Uses

func (d *Data) GetSparseCoarseVol(ctx *datastore.VersionedCtx, label uint64) ([]byte, error)

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 (*Data) GetSparseVol Uses

func (d *Data) GetSparseVol(ctx *datastore.VersionedCtx, label uint64, bounds dvid.Bounds) ([]byte, error)

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

func (*Data) GetSyncSubs Uses

func (d *Data) GetSyncSubs(synced dvid.Data) (datastore.SyncSubs, error)

GetSyncSubs implements the datastore.Syncer interface

func (*Data) GetSyncedLabelblk Uses

func (d *Data) GetSyncedLabelblk() (*labelblk.Data, error)

GetSyncedLabelblk returns the synced labelblk data instance or returns an error if there is no synced labelblk.

func (*Data) GobDecode Uses

func (d *Data) GobDecode(b []byte) error

func (*Data) GobEncode Uses

func (d *Data) GobEncode() ([]byte, error)

func (*Data) Help Uses

func (d *Data) Help() string

func (*Data) InitDataHandlers Uses

func (d *Data) InitDataHandlers() error

InitDataHandlers launches goroutines to handle each labelvol instance's syncs.

func (*Data) LoadMutable Uses

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 Uses

func (d *Data) MarshalJSON() ([]byte, error)

func (*Data) MergeLabels Uses

func (d *Data) MergeLabels(v dvid.VersionID, m labels.MergeOp) error

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) NewFilter Uses

func (d *Data) NewFilter(fs storage.FilterSpec) (storage.Filter, error)

NewFilter returns a Filter for use with a push of key-value pairs.

func (*Data) NewLabel Uses

func (d *Data) NewLabel(v dvid.VersionID) (uint64, error)

NewLabel returns a new label for the given version.

func (*Data) PushData Uses

func (d *Data) PushData(p *datastore.PushSession) error

PushData does a labelvol-specific push using optional ROI filters.

func (*Data) RemapVersions Uses

func (d *Data) RemapVersions(vmap dvid.VersionMap) error

RemapVersions modifies internal data instance properties that rely on server-specific version ids. This is necessary after DVID-to-DVID transmission.

func (*Data) ServeHTTP Uses

func (d *Data) ServeHTTP(uuid dvid.UUID, ctx *datastore.VersionedCtx, w http.ResponseWriter, r *http.Request) (activity map[string]interface{})

ServeHTTP handles all incoming HTTP requests for this data.

func (*Data) Shutdown Uses

func (d *Data) Shutdown(wg *sync.WaitGroup)

Shutdown terminates blocks until syncs are done then terminates background goroutines processing data.

func (*Data) SplitCoarseLabels Uses

func (d *Data) SplitCoarseLabels(v dvid.VersionID, fromLabel, splitLabel uint64, r io.ReadCloser) (toLabel uint64, err error)

SplitCoarseLabels splits a portion of a label's voxels into a given split label or, if the given split label is 0, 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 Uses

func (d *Data) SplitLabels(v dvid.VersionID, fromLabel, splitLabel uint64, r io.ReadCloser) (toLabel uint64, err error)

SplitLabels splits a portion of a label's voxels into a given split label or, if the given split label is 0, 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. It is assumed that the given split voxels are within the fromLabel set of voxels and will generate unspecified behavior if this is not the case.

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 DumpFiles Uses

type DumpFiles struct {
    // contains filtered or unexported fields
}

type Filter Uses

type Filter struct {
    *Data
    // contains filtered or unexported fields
}

func (*Filter) Check Uses

func (f *Filter) Check(tkv *storage.TKeyValue) (skip bool, err error)

type Properties Uses

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 Uses

func (p Properties) MarshalJSON() ([]byte, error)

type Type Uses

type Type struct {
    datastore.Type
}

func (*Type) Help Uses

func (dtype *Type) Help() string

func (*Type) NewDataService Uses

func (dtype *Type) NewDataService(uuid dvid.UUID, id dvid.InstanceID, name dvid.InstanceName, c dvid.Config) (datastore.DataService, error)

Package labelvol imports 26 packages (graph) and is imported by 2 packages. Updated 2019-11-12. Refresh now. Tools for package owners.