Documentation ¶
Overview ¶
Package labelmap handles both volumes of label data as well as indexing to quickly find and generate sparse volumes of any particular label. It differs from labelmap in using in-memory label maps to greatly decrease changes to underlying label data key-value pairs, instead handling all merges through changes in label maps.
Index ¶
- Constants
- Variables
- func ChangeLabelIndex(d dvid.Data, v dvid.VersionID, label uint64, delta labels.SupervoxelChanges) error
- func DecodeAffinitiesTKey(tk storage.TKey) (label uint64, err error)
- func DecodeBlockTKey(tk storage.TKey) (scale uint8, idx *dvid.IndexZYX, err error)
- func DecodeLabelIndexTKey(tk storage.TKey) (label uint64, err error)
- func DeleteLabelIndex(d dvid.Data, v dvid.VersionID, label uint64) error
- func EncodeFormat() dvid.DataValues
- func GetBoundedIndex(d dvid.Data, v dvid.VersionID, label uint64, bounds dvid.Bounds, ...) (*labels.Index, error)
- func GetLabelIndex(d dvid.Data, v dvid.VersionID, label uint64, isSupervoxel bool) (*labels.Index, error)
- func GetLabelSize(d dvid.Data, v dvid.VersionID, label uint64, isSupervoxel bool) (uint64, error)
- func GetLabelSizes(d dvid.Data, v dvid.VersionID, labels []uint64, isSupervoxel bool) (sizes []uint64, err error)
- func GetSupervoxelBlocks(d dvid.Data, v dvid.VersionID, supervoxel uint64) (dvid.IZYXSlice, error)
- func NewAffinitiesTKey(label uint64) storage.TKey
- func NewBlockTKey(scale uint8, idx dvid.Index) storage.TKey
- func NewBlockTKeyByCoord(scale uint8, izyx dvid.IZYXString) storage.TKey
- func NewLabelIndexTKey(label uint64) storage.TKey
- func PutLabelIndex(d dvid.Data, v dvid.VersionID, label uint64, idx *labels.Index) error
- func ZeroBytes() []byte
- 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) AnyScaleUpdating() bool
- func (d *Data) BlockSize() dvid.Point
- func (d *Data) CleaveLabel(v dvid.VersionID, label uint64, info dvid.ModInfo, r io.ReadCloser) (cleaveLabel, mutID uint64, err error)
- func (d *Data) CopyPropertiesFrom(src datastore.DataService, fs storage.FilterSpec) error
- func (d *Data) CreateCompositeChunk(chunk *storage.Chunk) error
- func (d *Data) DescribeTKeyClass(tkc storage.TKeyClass) string
- func (d *Data) DoRPC(req datastore.Request, reply *datastore.Response) error
- func (d *Data) DumpMutations(startUUID, endUUID dvid.UUID, filename string) (comment string, err error)
- func (d *Data) Equals(d2 *Data) bool
- func (d *Data) Extents() *dvid.Extents
- func (d *Data) FoundSparseVol(ctx *datastore.VersionedCtx, label uint64, bounds dvid.Bounds, ...) (bool, error)
- func (d *Data) GetImage(v dvid.VersionID, vox *Labels, supervoxels bool, scale uint8, ...) (*dvid.Image, error)
- func (d *Data) GetLabelAtPoint(v dvid.VersionID, pt dvid.Point) (uint64, error)
- func (d *Data) GetLabelAtScaledPoint(v dvid.VersionID, pt dvid.Point, scale uint8, supervoxels bool) (uint64, error)
- func (d *Data) GetLabelBytes(v dvid.VersionID, bcoord dvid.ChunkPoint3d) ([]byte, error)
- func (d *Data) GetLabelPoints(v dvid.VersionID, pts []dvid.Point3d, scale uint8, useSupervoxels bool) (mapped []uint64, err error)
- func (d *Data) GetLabels(v dvid.VersionID, supervoxels bool, scale uint8, vox *Labels, r *imageblk.ROI) error
- func (d *Data) GetMapStats(ctx *datastore.VersionedCtx) (jsonBytes []byte, err error)
- func (d *Data) GetMappedLabels(v dvid.VersionID, supervoxels []uint64) (mapped []uint64, found []bool, err error)
- func (d *Data) GetMaxDownresLevel() uint8
- func (d *Data) GetMutationHistory(w http.ResponseWriter, fromUUID, toUUID dvid.UUID, target uint64) error
- func (d *Data) GetPointsInSupervoxels(v dvid.VersionID, pts []dvid.Point3d, supervoxels []uint64) (inSupervoxels []bool, err error)
- func (d *Data) GetSparseCoarseVol(ctx *datastore.VersionedCtx, label uint64, bounds dvid.Bounds, ...) ([]byte, error)
- func (d *Data) GetSupervoxelAtPoint(v dvid.VersionID, pt dvid.Point) (uint64, error)
- func (d *Data) GetSupervoxels(v dvid.VersionID, label uint64) (labels.Set, error)
- func (d *Data) GetVolume(v dvid.VersionID, vox *Labels, supervoxels bool, scale uint8, ...) ([]byte, error)
- func (d *Data) GobDecode(b []byte) error
- func (d *Data) GobEncode() ([]byte, error)
- func (d *Data) InitDataHandlers() error
- func (d *Data) Initialize()
- func (d *Data) LoadImages(v dvid.VersionID, offset dvid.Point, filenames []string) error
- func (d *Data) LoadMutable(root dvid.VersionID, storedVersion, expectedVersion uint64) (bool, error)
- func (d *Data) MarshalJSON() ([]byte, error)
- func (d *Data) MarshalJSONExtents(ctx *datastore.VersionedCtx) ([]byte, error)
- func (d *Data) MergeLabels(v dvid.VersionID, op labels.MergeOp, info dvid.ModInfo) (mutID uint64, err error)
- func (d *Data) NewLabels(geom dvid.Geometry, img interface{}) (*Labels, error)
- func (d *Data) PushData(p *datastore.PushSession) error
- func (d *Data) PutLabels(v dvid.VersionID, subvol *dvid.Subvolume, data []byte, ...) error
- func (d *Data) ReadChunk(chunk *storage.Chunk) error
- func (d *Data) ReadLogRequired() bool
- func (d *Data) RenumberLabels(v dvid.VersionID, origLabel, newLabel uint64, info dvid.ModInfo) (mutID uint64, err error)
- func (d *Data) ScaleUpdating(scale uint8) bool
- func (d *Data) ServeHTTP(uuid dvid.UUID, ctx *datastore.VersionedCtx, w http.ResponseWriter, ...) (activity map[string]interface{})
- func (d *Data) SetNextLabelStart(nextLabelID uint64) error
- func (d *Data) Shutdown(wg *sync.WaitGroup)
- func (d *Data) SplitLabels(v dvid.VersionID, fromLabel uint64, r io.ReadCloser, info dvid.ModInfo) (toLabel, mutID uint64, err error)
- func (d *Data) SplitSupervoxel(v dvid.VersionID, svlabel, splitlabel, remainlabel uint64, r io.ReadCloser, ...) (splitSupervoxel, remainSupervoxel, mutID uint64, err error)
- func (d *Data) StartScaleUpdate(scale uint8)
- func (d *Data) StopScaleUpdate(scale uint8)
- func (d *Data) StoreDownres(v dvid.VersionID, hiresScale uint8, hires downres.BlockMap) (downres.BlockMap, error)
- func (d *Data) WriteLogRequired() bool
- func (d *Data) WriteSparseCoarseVols(ctx *datastore.VersionedCtx, w io.Writer, begLabel, endLabel uint64, ...) error
- type IngestedBlock
- type Labels
- type MutatedBlock
- type SparseVolFormat
- type Type
- type VCache
- func (vc *VCache) ApplyMappingToBlock(mappedVersions distFromRoot, block *labels.Block)
- func (vc *VCache) MappedLabel(v dvid.VersionID, label uint64) (uint64, bool)
- func (vc *VCache) MappedLabels(v dvid.VersionID, supervoxels []uint64) (mapped []uint64, found []bool, err error)
- func (vc *VCache) SupervoxelSplitsJSON(v dvid.VersionID) (string, error)
Constants ¶
const ( Version = "0.1" RepoURL = "github.com/janelia-flyem/dvid/datatype/labelmap" TypeName = "labelmap" )
const KVWriteSize = 500
KVWriteSize is the # of key-value pairs we will write as one atomic batch write.
const (
// NumSVMapShards is the number of shards for the supervoxel map.
NumSVMapShards = 100
)
Variables ¶
var ( DefaultBlockSize int32 = 64 DefaultRes float32 = imageblk.DefaultRes DefaultUnits = imageblk.DefaultUnits )
Functions ¶
func ChangeLabelIndex ¶
func ChangeLabelIndex(d dvid.Data, v dvid.VersionID, label uint64, delta labels.SupervoxelChanges) error
ChangeLabelIndex applies changes to a label's index and then stores the result. Supervoxel size changes for blocks should be passed into the function. The passed SupervoxelDelta can contain more supervoxels than the label index.
func DecodeAffinitiesTKey ¶
DecodeAffinitiesTKey parses a TKey and returns the corresponding label.
func DecodeBlockTKey ¶
DecodeBlockTKey returns a spatial index from a label block key. TODO: Extend this when necessary to allow any form of spatial indexing like CZYX.
func DecodeLabelIndexTKey ¶
DecodeLabelIndexTKey parses a TKey and returns the corresponding label.
func DeleteLabelIndex ¶
DeleteLabelIndex deletes the index for a given label set.
func EncodeFormat ¶
func EncodeFormat() dvid.DataValues
func GetBoundedIndex ¶
func GetBoundedIndex(d dvid.Data, v dvid.VersionID, label uint64, bounds dvid.Bounds, isSupervoxel bool) (*labels.Index, error)
GetBoundedIndex gets bounded label index data from storage for a given data instance.
func GetLabelIndex ¶
func GetLabelIndex(d dvid.Data, v dvid.VersionID, label uint64, isSupervoxel bool) (*labels.Index, error)
GetLabelIndex gets label set index data from storage for a given data instance and version. If isSupervoxel is true, the label is interpreted as a supervoxel and the label set index containing the given supervoxel is returned. Concurrency-safe access and supports caching. If a label has been mapped to another, a nil Index is returned.
func GetLabelSize ¶
GetLabelSize returns the # of voxels in the given label. If isSupervoxel = true, the given label is interpreted as a supervoxel id and the size is of a supervoxel. If a label doesn't exist, a zero (not error) is returned.
func GetLabelSizes ¶
func GetLabelSizes(d dvid.Data, v dvid.VersionID, labels []uint64, isSupervoxel bool) (sizes []uint64, err error)
GetLabelSizes returns the # of voxels in the given labels. If isSupervoxel = true, the given labels are interpreted as supervoxel ids and the sizes are of a supervoxel. If a label doesn't exist, a zero (not error) is returned.
func GetSupervoxelBlocks ¶
GetSupervoxelBlocks gets the blocks corresponding to a supervoxel id.
func NewAffinitiesTKey ¶
NewAffinitiesTKey returns a TKey corresponding to a label's affinities.
func NewBlockTKey ¶
NewBlockTKey returns a TKey for a label block, which is a slice suitable for lexicographical ordering on zyx coordinates.
func NewBlockTKeyByCoord ¶
func NewBlockTKeyByCoord(scale uint8, izyx dvid.IZYXString) storage.TKey
NewBlockTKeyByCoord returns a TKey for a block coord in string format.
func NewLabelIndexTKey ¶
NewLabelIndexTKey returns a TKey corresponding to a label.
func PutLabelIndex ¶
PutLabelIndex persists a label index data for a given data instance and version. If the given index is nil, the index is deleted. Concurrency-safe and supports caching.
Types ¶
type Data ¶
type Data struct { *imageblk.Data datastore.Updater // 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 // The next label ID to be returned for new labels. This can override MaxRepoLabel // if it is non-zero. If zero, it is not used. This was added to allow new // labels to be assigned that have lower IDs than existing labels. NextLabel uint64 // True if sparse volumes (split, merge, sparse volume optimized GET) are supported // for this data instance. (Default true) IndexedLabels bool // Maximum down-resolution level supported. Each down-res level is 2x scope of // the higher level. MaxDownresLevel uint8 // contains filtered or unexported fields }
Data of labelmap type is an extended form of imageblk Data
func GetByDataUUID ¶
GetByDataUUID returns a pointer to labelmap data given a data UUID. Returns error if not found.
func GetByUUIDName ¶
GetByUUIDName returns a pointer to labelmap data given a UUID and data name.
func GetByVersionName ¶
GetByVersionName returns a pointer to labelmap data given a version 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 labelmap data.
func (*Data) AnyScaleUpdating ¶
func (*Data) CleaveLabel ¶
func (d *Data) CleaveLabel(v dvid.VersionID, label uint64, info dvid.ModInfo, r io.ReadCloser) (cleaveLabel, mutID uint64, err error)
CleaveLabel synchornously cleaves a label given supervoxels to be cleaved. Requires JSON in request body using the following format:
[supervoxel1, supervoxel2, ...]
Each element of the JSON array is a supervoxel to be cleaved from the label and either given a new label or the one optionally supplied via the "cleavelabel" query string. A cleave label can be specified via the "toLabel" parameter, which if 0 will have an automatic label ID selected for the cleaved body.
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) CreateCompositeChunk ¶
CreateCompositeChunk processes each chunk of labels and grayscale data, saving the composited result into an rgba8. Only some multiple of the # of CPU cores can be used for chunk handling before it waits for chunk processing to abate via the buffered server.HandlerToken channel.
func (*Data) DescribeTKeyClass ¶
DescribeTKeyClass returns a string explanation of what a particular TKeyClass is used for. Implements the datastore.TKeyClassDescriber interface.
func (*Data) DumpMutations ¶
func (d *Data) DumpMutations(startUUID, endUUID dvid.UUID, filename string) (comment string, err error)
DumpMutations makes a log of all mutations from the start UUID to the end UUID.
func (*Data) FoundSparseVol ¶
func (d *Data) FoundSparseVol(ctx *datastore.VersionedCtx, label uint64, bounds dvid.Bounds, isSupervoxel bool) (bool, error)
FoundSparseVol returns true if a sparse volume is found for the given label within the given bounds.
func (*Data) GetImage ¶
func (d *Data) GetImage(v dvid.VersionID, vox *Labels, supervoxels bool, scale uint8, roiname dvid.InstanceName) (*dvid.Image, error)
GetImage retrieves a 2d image from a version node given a geometry of labels.
func (*Data) GetLabelAtPoint ¶
GetLabelAtPoint returns the 64-bit unsigned int label for a given point.
func (*Data) GetLabelAtScaledPoint ¶
func (d *Data) GetLabelAtScaledPoint(v dvid.VersionID, pt dvid.Point, scale uint8, supervoxels bool) (uint64, error)
GetLabelAtScaledPoint returns the 64-bit unsigned int label for a given point.
func (*Data) GetLabelBytes ¶
GetLabelBytes returns a block of hi-res (body) labels (scale 0) in packed little-endian uint64 format
func (*Data) GetLabelPoints ¶
func (d *Data) GetLabelPoints(v dvid.VersionID, pts []dvid.Point3d, scale uint8, useSupervoxels bool) (mapped []uint64, err error)
GetLabelPoints returns labels or supervoxels corresponding to given 3d points.
func (*Data) GetLabels ¶
func (d *Data) GetLabels(v dvid.VersionID, supervoxels bool, scale uint8, vox *Labels, r *imageblk.ROI) error
GetLabels copies labels from the storage engine to Labels, a requested subvolume or 2d image. If supervoxels is true, the returned labels are not mapped but are the raw supervoxels.
func (*Data) GetMapStats ¶ added in v0.9.17
func (d *Data) GetMapStats(ctx *datastore.VersionedCtx) (jsonBytes []byte, err error)
GetMapStats returns JSON describing in-memory mapping stats.
func (*Data) GetMappedLabels ¶
func (d *Data) GetMappedLabels(v dvid.VersionID, supervoxels []uint64) (mapped []uint64, found []bool, err error)
GetMappedLabels returns an array of mapped labels, which could be the same as the passed slice, for the given version of the data instance.
func (*Data) GetMaxDownresLevel ¶
GetMaxDownresLevel returns the number of down-res levels, where level 0 = high-resolution and each subsequent level has one-half the resolution.
func (*Data) GetMutationHistory ¶
func (d *Data) GetMutationHistory(w http.ResponseWriter, fromUUID, toUUID dvid.UUID, target uint64) error
GetMutationHistory writes JSON of the mutations that were done to the given label at toUUID version, where we delimit the time range of interest to [fromUUID, toUUID] versions. The mutations are written backwards in time toUUID -> fromUUID.
func (*Data) GetPointsInSupervoxels ¶
func (d *Data) GetPointsInSupervoxels(v dvid.VersionID, pts []dvid.Point3d, supervoxels []uint64) (inSupervoxels []bool, err error)
GetPointsInSupervoxels returns the 3d points that fall within given supervoxels that are assumed to be mapped to one label. If supervoxels are assigned to more than one label, or a mapping is not available, an error is returned. The label index is not used so this function will use immutable data underneath if there are no supervoxel splits.
func (*Data) GetSparseCoarseVol ¶
func (d *Data) GetSparseCoarseVol(ctx *datastore.VersionedCtx, label uint64, bounds dvid.Bounds, isSupervoxel bool) ([]byte, error)
GetSparseCoarseVol returns an encoded sparse volume given a label. This will return nil slice if the given label was not found. The encoding has the following format where integers are little endian and blocks are returned in sorted ZYX order (small Z first):
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) GetSupervoxelAtPoint ¶
GetSupervoxelAtPoint returns the 64-bit unsigned int supervoxel id for a given point.
func (*Data) GetSupervoxels ¶
GetSupervoxels returns the set of supervoxel ids that compose the given label. Used in other datatypes private interfaces (e.g., tarsupervoxels) and generally useful for other packages.
func (*Data) GetVolume ¶
func (d *Data) GetVolume(v dvid.VersionID, vox *Labels, supervoxels bool, scale uint8, roiname dvid.InstanceName) ([]byte, error)
GetVolume retrieves a n-d volume from a version node given a geometry of labels.
func (*Data) InitDataHandlers ¶
InitDataHandlers launches goroutines to handle each labelmap instance's syncs.
func (*Data) Initialize ¶
func (d *Data) Initialize()
Initialize establishes the in-memory labelmap and other supporting data systems if specified in the server configuration: - index caching if cache size is specified in the server config. - mutation cache for label indices if specified in server config.
func (*Data) LoadImages ¶
LoadImages bulk loads images using different techniques if it is a multidimensional file like HDF5 or a sequence of PNG/JPG/TIF images.
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 and next 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) MarshalJSONExtents ¶
func (d *Data) MarshalJSONExtents(ctx *datastore.VersionedCtx) ([]byte, error)
func (*Data) MergeLabels ¶
func (d *Data) MergeLabels(v dvid.VersionID, op labels.MergeOp, info dvid.ModInfo) (mutID uint64, err error)
MergeLabels synchronously merges 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) NewLabels ¶
NewLabels returns labelmap Labels, a representation of externally usable subvolume or slice data, given some geometry and optional image data. If img is passed in, the function will initialize Voxels with data from the image. Otherwise, it will allocate a zero buffer of appropriate size.
func (*Data) PushData ¶
func (d *Data) PushData(p *datastore.PushSession) error
PushData pushes labelmap data to a remote DVID.
func (*Data) PutLabels ¶
func (d *Data) PutLabels(v dvid.VersionID, subvol *dvid.Subvolume, data []byte, roiname dvid.InstanceName, mutate bool) error
PutLabels persists voxels from a subvolume into the storage engine. This involves transforming a supplied volume of uint64 with known geometry into many labels.Block that tiles the subvolume. Messages are sent to subscribers for ingest events.
func (*Data) ReadChunk ¶
ReadChunk reads a chunk of data as part of a mapped operation. Only some multiple of the # of CPU cores can be used for chunk handling before it waits for chunk processing to abate via the buffered server.HandlerToken channel.
func (*Data) ReadLogRequired ¶
func (*Data) RenumberLabels ¶ added in v0.9.17
func (d *Data) RenumberLabels(v dvid.VersionID, origLabel, newLabel uint64, info dvid.ModInfo) (mutID uint64, err error)
RenumberLabels synchronously changes a label to another label, also modifying the mapping of constituent supervoxels appropriately. For sync purposes, the Merge events are used since renumbering label A->B is same as merging label A->B where B is an empty, new label. However, from a mapping perspective, a renumbered label can be mapped to zero since it cannot have an underlying supervoxel, but a merged label could have a supervoxel with the same ID.
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) ScaleUpdating ¶
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) SetNextLabelStart ¶
SetNextLabelStart sets the next label ID for this labelmap instance across the entire repo.
func (*Data) Shutdown ¶
Shutdown terminates blocks until syncs are done then terminates background goroutines processing data.
func (*Data) SplitLabels ¶
func (d *Data) SplitLabels(v dvid.VersionID, fromLabel uint64, r io.ReadCloser, info dvid.ModInfo) (toLabel, mutID 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.
func (*Data) SplitSupervoxel ¶
func (d *Data) SplitSupervoxel(v dvid.VersionID, svlabel, splitlabel, remainlabel uint64, r io.ReadCloser, info dvid.ModInfo, downscale bool) (splitSupervoxel, remainSupervoxel, mutID uint64, err error)
SplitSupervoxel splits a portion of a supervoxel's voxels into two new labels, which can be optionally set to desired labels if passed in (see splitlabel and remainlabel in parameters). The input is a binary sparse volume and should be totally contained by the given supervoxel. The first returned label is assigned to the split voxels while the second returned label is assigned to the remainder voxels.
func (*Data) StartScaleUpdate ¶
func (*Data) StopScaleUpdate ¶
func (*Data) StoreDownres ¶
func (d *Data) StoreDownres(v dvid.VersionID, hiresScale uint8, hires downres.BlockMap) (downres.BlockMap, error)
StoreDownres computes a downscale representation of a set of mutated blocks.
func (*Data) WriteLogRequired ¶
func (*Data) WriteSparseCoarseVols ¶
func (d *Data) WriteSparseCoarseVols(ctx *datastore.VersionedCtx, w io.Writer, begLabel, endLabel uint64, bounds dvid.Bounds) error
WriteSparseCoarseVols returns a stream of sparse volumes with blocks of the given label in encoded RLE format:
uint64 label <coarse sparse vol as given below> uint64 label <coarse sparse vol as given below> ... The coarse sparse vol has the following format where integers are little endian and the order of data is exactly as specified below: int32 # 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
type IngestedBlock ¶
type IngestedBlock struct { MutID uint64 BCoord dvid.IZYXString Data *labels.Block }
IngestedBlock is the unit of delta for a IngestBlockEvent.
type Labels ¶
Labels are voxels that have uint64 labels.
func (*Labels) ComputeTransform ¶
func (v *Labels) ComputeTransform(tkey storage.TKey, blockSize dvid.Point) (blockBeg, dataBeg, dataEnd dvid.Point, err error)
ComputeTransform determines the block coordinate and beginning + ending voxel points for the data corresponding to the given Block.
func (*Labels) Interpolable ¶
type MutatedBlock ¶
type MutatedBlock struct { MutID uint64 BCoord dvid.IZYXString Prev *labels.Block Data *labels.Block }
MutatedBlock tracks previous and updated block data. It is the unit of delta for a MutateBlockEvent.
type SparseVolFormat ¶
type SparseVolFormat uint8
SparseVolFormat indicates the type of encoding used for sparse volume representation.
const ( // FormatLegacyRLE is Legacy RLE encoding with header that gives # spans. FormatLegacyRLE SparseVolFormat = iota // FormatStreamingRLE specifies Streaming RLE encoding FormatStreamingRLE // FormatBinaryBlocks specifies a streaming set of binary Blocks FormatBinaryBlocks )
type Type ¶
Type uses imageblk data type by composition.
func (*Type) NewDataService ¶
func (dtype *Type) NewDataService(uuid dvid.UUID, id dvid.InstanceID, name dvid.InstanceName, c dvid.Config) (datastore.DataService, error)
type VCache ¶ added in v1.0.0
type VCache struct {
// contains filtered or unexported fields
}
VCache is holds in-memory versioned data for (1) version-aware, sharded label map, (2) distance of a version from DAG root, and (3) split ops. The label map tries to be memory efficient and also improves concurrency by using sharded maps hashed by label modulo.
func (*VCache) ApplyMappingToBlock ¶ added in v1.0.0
ApplyMappingToBlock applies label mapping (given an ancestry path) to the passed labels.Block.
func (*VCache) MappedLabel ¶ added in v1.0.0
MappedLabel returns the mapped label and a boolean: true if a mapping was found and false if none was found. For faster mapping, large scale transformations, e.g. block-level output, should not use this routine but work directly with mapLabel() doing locking and ancestry lookup outside loops.