labelblk

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2016 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Overview

Package labelblk tailors the voxels data type for 64-bit labels and allows loading of NRGBA images (e.g., Raveler superpixel PNG images) that implicitly use slice Z as part of the label index.

Index

Constants

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

Variables

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

Functions

func BlockOnUpdating added in v0.7.1

func BlockOnUpdating(uuid dvid.UUID, name dvid.InstanceName) error

BlockOnUpdating blocks until the given data is not updating from syncs. This is primarily used during testing.

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 RavelerSuperpixelBytes

func RavelerSuperpixelBytes(slice, superpixel32 uint32) []byte

RavelerSuperpixelBytes returns an encoded slice for Raveler (slice, superpixel) tuple. TODO -- Move Raveler-specific functions out of DVID.

func ZeroBytes

func ZeroBytes() []byte

ZeroBytes returns a slice of bytes that represents the zero 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 {
	*imageblk.Data
	Labeling LabelType
	datastore.Updater
}

Data of labelblk type is an extended form of imageblk Data

func GetByUUID

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

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

func GetByVersion

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

GetByVersion 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 labelblk data.

func (*Data) BlockSize

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

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

func (d *Data) DeleteBlocks(ctx *datastore.VersionedCtx, start dvid.ChunkPoint3d, span int) error

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) ([]byte, error)

GetBlocks returns a slice of bytes corresponding to all the blocks 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) GetLabelBlock added in v0.8.0

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

GetLabelBlock returns a block of labels 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 added in v0.8.0

func (d *Data) GetSyncSubs(syncData dvid.Data) datastore.SyncSubs

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

TODO : Unlike the standard imageblk.NewVoxels, the labelblk version can modify the labels based on the z-coordinate of the given geometry for Raveler labeling. This will be removed when Raveler-specific labels are moved outside 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) Send

func (d *Data) Send(s rpc.Session, transmit rpc.Transmit, filter string, versions map[dvid.VersionID]struct{}) error

Send transfers all key-value pairs pertinent to this data type as well as the storage.DataStoreType for them.

func (*Data) SendBlocks added in v0.8.0

func (d *Data) SendBlocks(ctx *datastore.VersionedCtx, w http.ResponseWriter, start dvid.ChunkPoint3d, span int, compression string) error

GetBlocks returns a slice of bytes corresponding to all the blocks along a span in X

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.

type LabelType

type LabelType uint8

LabelType specifies how the 64-bit label is organized, allowing some bytes to encode particular attributes. For example, the "Raveler" LabelType includes the Z-axis coordinate.

const (
	Standard64bit LabelType = iota

	// RavelerLabel uses the Z offset as the higher-order 4 bytes and the
	// superpixel label as the lower 4 bytes.
	RavelerLabel
)

func (LabelType) String

func (lt LabelType) String() string

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