labelblk

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: BSD-3-Clause Imports: 22 Imported by: 3

Documentation

Overview

Package labelblk supports only label volumes. See labelvol package for support of sparse labels. The labelblk and labelvol datatypes typically are synced to each other.

Index

Constants

View Source
const (
	Version  = "0.1"
	RepoURL  = "github.com/janelia-flyem/dvid/datatype/labelblk"
	TypeName = "labelblk"
)
View Source
const (
	DownsizeBlockEvent  = "LABELBLK_DOWNSIZE_ADD"
	DownsizeCommitEvent = "LABELBLK_DOWNSIZE_COMMIT"
)

Variables

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

Functions

func DecodeTKey

func DecodeTKey(tk storage.TKey) (*dvid.IndexZYX, error)

DecodeKey returns a spatial index from a label block key. TODO: Extend this when necessary to allow any form of spatial indexing like CZYX.

func EncodeFormat

func EncodeFormat() dvid.DataValues

func NewTKey

func NewTKey(idx dvid.Index) storage.TKey

NewTKey returns a TKey for a label block, which is a slice suitable for lexicographical ordering on zyx coordinates.

func NewTKeyByCoord

func NewTKeyByCoord(izyx dvid.IZYXString) storage.TKey

NewTKeyByCoord returns a TKey for a block coord in string format.

func ZeroBytes

func ZeroBytes() []byte

ZeroBytes returns a slice of bytes that represents the zero label.

Types

type Block

type Block struct {
	Pos  dvid.ChunkPoint3d
	Data []byte
}

type Data

type Data struct {
	*imageblk.Data
	datastore.Updater
	// contains filtered or unexported fields
}

Data of labelblk type is an extended form of imageblk Data

func GetByDataUUID

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

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

func GetByUUIDName

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

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

func GetByVersionName

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

GetByVersionName returns a pointer to labelblk 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 labelblk data.

func (*Data) BlockSize

func (d *Data) BlockSize() dvid.Point

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

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

CreateComposite creates a new rgba8 image by combining hash of labels + the grayscale

func (*Data) CreateCompositeChunk

func (d *Data) CreateCompositeChunk(chunk *storage.Chunk) error

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

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

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

DoRPC acts as a switchboard for RPC commands.

func (*Data) Equals

func (d *Data) Equals(d2 *Data) bool

func (*Data) Extents

func (d *Data) Extents() *dvid.Extents

func (*Data) GetBlocks

func (d *Data) GetBlocks(v dvid.VersionID, start dvid.ChunkPoint3d, span int) ([]Block, error)

GetBlocks returns any block data along a span in X

func (*Data) GetImage

func (d *Data) GetImage(v dvid.VersionID, vox *Labels, roiname dvid.InstanceName) (*dvid.Image, error)

GetImage retrieves a 2d image from a version node given a geometry of labels.

func (*Data) GetLabelAtPoint

func (d *Data) GetLabelAtPoint(v dvid.VersionID, pt dvid.Point) (uint64, error)

GetLabelAtPoint returns the 64-bit unsigned int label for a given point.

func (*Data) GetLabelBytes

func (d *Data) GetLabelBytes(v dvid.VersionID, bcoord dvid.ChunkPoint3d) ([]byte, error)

GetLabelBytes returns a slice of little-endian uint64 corresponding to the block coordinate.

func (*Data) GetLabelBytesAtPoint

func (d *Data) GetLabelBytesAtPoint(v dvid.VersionID, pt dvid.Point) ([]byte, error)

GetLabelBytesAtPoint returns the 8 byte slice corresponding to a 64-bit label at a point.

func (*Data) GetLabels

func (d *Data) GetLabels(v dvid.VersionID, vox *Labels, r *imageblk.ROI) error

GetLabels copies labels from the storage engine to Labels, a requested subvolume or 2d image.

func (*Data) GetSyncSubs

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

GetSyncSubs implements the datastore.Syncer interface

func (*Data) GetVolume

func (d *Data) GetVolume(v dvid.VersionID, vox *Labels, roiname dvid.InstanceName) ([]byte, error)

GetVolume retrieves a n-d volume from a version node given a geometry of labels.

func (*Data) GobDecode

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

func (*Data) GobEncode

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

func (*Data) InitDataHandlers

func (d *Data) InitDataHandlers() error

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

func (*Data) MarshalJSON

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

func (*Data) NewLabels

func (d *Data) NewLabels(geom dvid.Geometry, img interface{}) (*Labels, error)

NewLabels returns labelblk 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 labelblk data to a remote DVID.

func (*Data) ReadChunk

func (d *Data) ReadChunk(chunk *storage.Chunk) error

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

func (d *Data) SendBlocks(ctx *datastore.VersionedCtx, w http.ResponseWriter, subvol *dvid.Subvolume, compression string) error

SendBlocks writes all blocks within the given subvolume to the http.ResponseWriter.

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

func (d *Data) SetResolution(uuid dvid.UUID, jsonBytes []byte) error

SetResolution loads JSON data giving Resolution.

func (*Data) Shutdown

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

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

type Labels

type Labels struct {
	*imageblk.Voxels
}

Labels are voxels that have uint64 labels.

func (*Labels) ComputeTransform

func (v *Labels) ComputeTransform(block *storage.TKeyValue, 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

func (l *Labels) Interpolable() bool

func (*Labels) String

func (l *Labels) String() string

type Type

type Type struct {
	imageblk.Type
}

Type uses imageblk data type by composition.

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