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 NewTKey(label uint64, block dvid.IZYXString) storage.TKey
- type Data
- func GetByDataUUID(dataUUID dvid.UUID) (*Data, error)
- func GetByUUIDName(uuid dvid.UUID, name dvid.InstanceName) (*Data, error)
- func GetByVersionName(v dvid.VersionID, name dvid.InstanceName) (*Data, error)
- func NewData(uuid dvid.UUID, id dvid.InstanceID, name dvid.InstanceName, c dvid.Config) (*Data, error)
- func (d *Data) CopyPropertiesFrom(src datastore.DataService, fs storage.FilterSpec) error
- func (d *Data) DeleteArea(ctx *datastore.VersionedCtx, label uint64, subvol *dvid.Subvolume) error
- func (d *Data) DescribeTKeyClass(tkc storage.TKeyClass) string
- func (d *Data) DoRPC(req datastore.Request, reply *datastore.Response) error
- func (d *Data) DumpSubvols(uuid dvid.UUID, v dvid.VersionID, dirStr string)
- func (d *Data) FoundSparseVol(ctx *datastore.VersionedCtx, label uint64, bounds dvid.Bounds) (bool, error)
- func (d *Data) GetLabelRLEs(v dvid.VersionID, label uint64) (dvid.BlockRLEs, error)
- func (d *Data) GetSparseCoarseVol(ctx *datastore.VersionedCtx, label uint64) ([]byte, error)
- func (d *Data) GetSparseVol(ctx *datastore.VersionedCtx, label uint64, bounds dvid.Bounds) ([]byte, error)
- func (d *Data) GetSyncSubs(synced dvid.Data) (datastore.SyncSubs, error)
- func (d *Data) GetSyncedLabelblk() (*labelblk.Data, error)
- func (d *Data) GobDecode(b []byte) error
- func (d *Data) GobEncode() ([]byte, error)
- func (d *Data) Help() string
- func (d *Data) InitDataHandlers() error
- 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) NewFilter(fs storage.FilterSpec) (storage.Filter, error)
- func (d *Data) NewLabel(v dvid.VersionID) (uint64, error)
- func (d *Data) PushData(p *datastore.PushSession) error
- func (d *Data) RemapVersions(vmap dvid.VersionMap) error
- func (d *Data) ServeHTTP(uuid dvid.UUID, ctx *datastore.VersionedCtx, w http.ResponseWriter, ...) (activity map[string]interface{})
- func (d *Data) Shutdown(wg *sync.WaitGroup)
- func (d *Data) SplitCoarseLabels(v dvid.VersionID, fromLabel, splitLabel uint64, r io.ReadCloser) (toLabel uint64, err error)
- func (d *Data) SplitLabels(v dvid.VersionID, fromLabel, splitLabel uint64, r io.ReadCloser) (toLabel uint64, err error)
- type DumpFiles
- type Filter
- type Properties
- type Type
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 )
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.
Types ¶
type Data ¶
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 ¶
GetByDataUUID returns a pointer to labelvol data given a data UUID.
func GetByUUIDName ¶
GetByUUIDName returns a pointer to labelvol data given a version (UUID) and data name.
func GetByVersionName ¶
GetByVersionName returns a pointer to labelblk data given a UUID and data name.
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) CopyPropertiesFrom ¶
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 ¶
func (*Data) DescribeTKeyClass ¶
DescribeTKeyClass returns a string explanation of what a particular TKeyClass is used for. Implements the datastore.TKeyClassDescriber interface.
func (*Data) DumpSubvols ¶
func (*Data) FoundSparseVol ¶
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 ¶
Returns RLEs for a given label where the key of the returned map is the block index in string format.
func (*Data) 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 (*Data) GetSparseVol ¶
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 ¶
GetSyncSubs implements the datastore.Syncer interface
func (*Data) GetSyncedLabelblk ¶
GetSyncedLabelblk returns the synced labelblk data instance or returns an error if there is no synced labelblk.
func (*Data) InitDataHandlers ¶
InitDataHandlers launches goroutines to handle each labelvol instance's syncs.
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) PushData ¶
func (d *Data) PushData(p *datastore.PushSession) error
PushData does a labelvol-specific push using optional ROI filters.
func (*Data) RemapVersions ¶
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 ¶
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 ¶
Shutdown terminates blocks until syncs are done then terminates background goroutines processing data.
func (*Data) SplitCoarseLabels ¶
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 ¶
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 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)