labelvol

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2015 License: BSD-3-Clause Imports: 22 Imported by: 0

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

View Source
const (
	Version  = "0.1"
	RepoURL  = "github.com/janelia-flyem/dvid/datatype/labelvol"
	TypeName = "labelvol"
)
View Source
const HelpMessage = `` /* 8803-byte string literal not displayed */

Variables

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

Functions

func DecodeTKey

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 FoundSparseVol

func FoundSparseVol(ctx storage.Context, label uint64, bounds Bounds) (bool, error)

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

func GetSparseCoarseVol

func GetSparseCoarseVol(ctx storage.Context, 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 GetSparseVol

func GetSparseVol(ctx storage.Context, label uint64, bounds 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 NewTKey

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.

Types

type Bounds

type Bounds struct {
	VoxelBounds *dvid.Bounds
	BlockBounds *dvid.Bounds
	Exact       bool // All RLEs must respect the voxel bounds.  If false, just screen on blocks.
}

type Data

type Data struct {
	*datastore.Data
	Properties
}

Data instance of labelvol, label sparse volumes.

func GetByUUID

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

GetByUUID returns a pointer to labelvol data given a version (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) DoRPC

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

DoRPC acts as a switchboard for RPC commands.

func (*Data) GetLabelRLEs

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) GetSyncedLabelblk

func (d *Data) GetSyncedLabelblk(v dvid.VersionID) (*labelblk.Data, error)

func (*Data) GobDecode

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

func (*Data) GobEncode

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

func (*Data) Help

func (d *Data) Help() string

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 (d *Data) MarshalJSON() ([]byte, error)

func (*Data) MergeLabels

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) NewLabel

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

NewLabel returns a new label for the given version.

func (*Data) PutSparseVol

func (d *Data) PutSparseVol(v dvid.VersionID, label uint64, r io.Reader) error

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

func (d *Data) Send(s message.Socket, roiname string, uuid dvid.UUID) error

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)

type Type

type Type struct {
	datastore.Type
}

func (*Type) Help

func (dtype *Type) Help() string

func (*Type) NewDataService

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

Jump to

Keyboard shortcuts

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