labelsz

package
v0.9.16 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: BSD-3-Clause Imports: 20 Imported by: 1

Documentation

Overview

Package labelsz supports ranking labels by # annotations of each type.

Index

Constants

View Source
const (
	Version  = "0.1"
	RepoURL  = "github.com/janelia-flyem/dvid/datatype/labelsz"
	TypeName = "labelsz"
)
View Source
const (
	MaxLabelsReturned = 10000 // Maximum number of labels returned in JSON
)

Variables

This section is empty.

Functions

func NewTypeLabelTKey

func NewTypeLabelTKey(i IndexType, label uint64) storage.TKey

NewTypeLabelTKey returns a type-specific key for the (index type, label) tuple.

func NewTypeSizeLabelTKey

func NewTypeSizeLabelTKey(i IndexType, sz uint32, label uint64) storage.TKey

NewTypeSizeLabelTKey returns a type-specific key for the (index type, size, label) tuple.

Types

type Data

type Data struct {
	*datastore.Data
	Properties

	// Keep track of sync operations that could be updating the data.
	datastore.Updater

	sync.RWMutex
	// contains filtered or unexported fields
}

Data instance of labelvol, label sparse volumes.

func GetByUUIDName

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

GetByUUIDName returns a pointer to annotation 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 labelsz data.

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(request 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) GetCountElementType

func (d *Data) GetCountElementType(ctx *datastore.VersionedCtx, label uint64, i IndexType) (uint32, error)

GetCountElementType returns a count of the given ElementType for a given label.

func (*Data) GetLabelsByThreshold

func (d *Data) GetLabelsByThreshold(ctx *datastore.VersionedCtx, i IndexType, minSize uint32, offset, num int) (LabelSizes, error)

GetLabelsByThreshold returns a sorted list of labels that meet the given minSize threshold. We allow a maximum of MaxLabelsReturned returned labels and start with rank "offset".

func (*Data) GetSyncSubs

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

GetSyncSubs implements the datastore.Syncer interface. Returns a list of subscriptions to the sync data instance that will notify the receiver.

func (*Data) GetSyncedAnnotation

func (d *Data) GetSyncedAnnotation() *annotation.Data

func (*Data) GetTopElementType

func (d *Data) GetTopElementType(ctx *datastore.VersionedCtx, n int, i IndexType) (LabelSizes, error)

GetTopElementType returns a sorted list of the top N labels that have the given ElementType.

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

func (d *Data) ReloadData(ctx *datastore.VersionedCtx)

func (*Data) SendCountsByElementType

func (d *Data) SendCountsByElementType(w http.ResponseWriter, ctx *datastore.VersionedCtx, labels []uint64, idxType IndexType) error

SendCountsByElementType writes the counts for given index type for a list of labels

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

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

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

func (*Data) SyncPending added in v0.9.12

func (d *Data) SyncPending() bool

SyncPending returns true if any sync messages are in queue

type IndexType

type IndexType uint8

IndexType gives the type of index.

const (
	UnknownIndex IndexType = iota
	PostSyn                // Post-synaptic element
	PreSyn                 // Pre-synaptic element
	Gap                    // Gap junction
	Note                   // A note or bookmark with some description
	AllSyn                 // PostSyn, PreSyn, or Gap
	Voxels                 // Number of voxels
)

func DecodeTypeLabelTKey

func DecodeTypeLabelTKey(tk storage.TKey) (i IndexType, label uint64, err error)

DecodeTypeLabelTKey decodes a type-specific key into a (index type, label) tuple.

func DecodeTypeSizeLabelTKey

func DecodeTypeSizeLabelTKey(tk storage.TKey) (i IndexType, sz uint32, label uint64, err error)

DecodeTypeSizeLabelTKey decodes a type-specific key into a (index type, size, label) tuple.

func StringToIndexType

func StringToIndexType(s string) IndexType

StringToIndexType converts a string to an IndexType

func (IndexType) String

func (i IndexType) String() string

type LabelSize

type LabelSize struct {
	Label uint64
	Size  uint32
}

LabelSize is the count for a given label for some metric like # of PreSyn annotations.

type LabelSizes

type LabelSizes []LabelSize

LabelSizes is a sortable slice of LabelSize

func (LabelSizes) Len

func (s LabelSizes) Len() int

func (LabelSizes) Less

func (s LabelSizes) Less(i, j int) bool

func (LabelSizes) Swap

func (s LabelSizes) Swap(i, j int)

type Properties

type Properties struct {
	// StaticROI is an optional static ROI specification of the form "<roiname>,<uuid>"
	// Note that it *cannot* mutate after the labelsz instance is created.
	StaticROI string
}

Properties are additional properties for data beyond those in standard datastore.Data.

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