annotation

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: 26 Imported by: 2

Documentation

Overview

Package annotation supports point annotation management and queries.

Index

Constants

View Source
const (
	Version  = "0.1"
	RepoURL  = "github.com/janelia-flyem/dvid/datatype/annotation"
	TypeName = "annotation"
)
View Source
const (
	FormatFlatBuffers formatType = iota
	FormatProtobuf3
	FormatJSON
)
View Source
const (
	ModifyElementsEvent = "ANNOTATION_MOD_ELEMENTS"
	SetElementsEvent    = "ANNOTATION_SET_ELEMENTS"
)

Annotation number change event identifiers.

Variables

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

Functions

func BlockTKeyRange

func BlockTKeyRange() (min, max storage.TKey)

func BlockTKeyZRange added in v1.0.0

func BlockTKeyZRange(begBlockCoord, endBlockCoord dvid.ChunkPoint3d) (min, max storage.TKey)

func DecodeBlockTKey

func DecodeBlockTKey(tk storage.TKey) (pt dvid.ChunkPoint3d, err error)

func DecodeLabelTKey

func DecodeLabelTKey(tk storage.TKey) (label uint64, err error)

func NewBlockTKey

func NewBlockTKey(pt dvid.ChunkPoint3d) storage.TKey

func NewLabelTKey

func NewLabelTKey(label uint64) storage.TKey

func NewTagTKey

func NewTagTKey(tag Tag) (storage.TKey, error)

NewTagTKey returns a TKey for a given tag.

Types

type Data

type Data struct {
	*datastore.Data
	Properties

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

	sync.RWMutex // For CAS ops.  TODO: Make more specific (e.g., point locks) for efficiency.
	// contains filtered or unexported fields
}

Data instance of labelvol, label sparse volumes.

func GetByDataUUID

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

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

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 annotation data.

func (*Data) DeleteElement

func (d *Data) DeleteElement(ctx *datastore.VersionedCtx, pt dvid.Point3d, kafkaOff bool) error

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

func (d *Data) GetLabelJSON(ctx *datastore.VersionedCtx, label uint64, addRels bool) ([]byte, error)

GetLabelJSON returns JSON for synapse elements in a given label.

func (*Data) GetROISynapses

func (d *Data) GetROISynapses(ctx *datastore.VersionedCtx, roiSpec storage.FilterSpec) (Elements, error)

GetROISynapses returns synapse elements for a given ROI.

func (*Data) GetRegionSynapses

func (d *Data) GetRegionSynapses(ctx *datastore.VersionedCtx, ext *dvid.Extents3d) (Elements, error)

GetRegionSynapses returns synapse elements for a given subvolume of image space.

func (*Data) GetSyncSubs

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

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

func (*Data) GetSyncedLabelvol

func (d *Data) GetSyncedLabelvol() *labelvol.Data

func (*Data) GetTagJSON

func (d *Data) GetTagJSON(ctx *datastore.VersionedCtx, tag Tag, addRels bool) (jsonBytes []byte, err error)

GetTagJSON returns JSON for synapse elements in a given tag.

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

func (d *Data) MoveElement(ctx *datastore.VersionedCtx, from, to dvid.Point3d, kafkaOff bool) error

func (*Data) ProcessLabelAnnotations

func (d *Data) ProcessLabelAnnotations(v dvid.VersionID, f func(label uint64, elems ElementsNR)) error

ProcessLabelAnnotations will pass all annotations, label by label, to the given function.

func (*Data) RecreateDenormalizations

func (d *Data) RecreateDenormalizations(ctx *datastore.VersionedCtx, inMemory, check bool)

RecreateDenormalizations will recreate label and tag denormalizations from the block-based elements.

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

func (d *Data) StoreBlocks(ctx *datastore.VersionedCtx, r io.Reader, kafkaOff bool) (numBlocks int, err error)

StoreBlocks performs a synchronous store of synapses in JSON format, not returning until the data blocks are complete.

func (*Data) StoreElements

func (d *Data) StoreElements(ctx *datastore.VersionedCtx, r io.Reader, kafkaOff bool) error

StoreElements performs a synchronous store of synapses in JSON format, not returning until the data and its denormalizations are complete.

func (*Data) StreamAll

func (d *Data) StreamAll(ctx *datastore.VersionedCtx, w http.ResponseWriter) error

StreamAll returns all elements for this data instance.

func (*Data) StreamBlocks

func (d *Data) StreamBlocks(ctx *datastore.VersionedCtx, w http.ResponseWriter, ext *dvid.Extents3d) error

StreamBlocks returns synapse elements for a given subvolume of image space.

type DeltaModifyElements

type DeltaModifyElements struct {
	Add []ElementPos
	Del []ElementPos
}

DeltaModifyElements is a change in the elements assigned to a label. Need positions of elements because subscribers may have ROI filtering.

type DeltaSetElements

type DeltaSetElements struct {
	Set []ElementPos
}

DeltaSetElements is a replacement of elements assigned to a label.

type Element

type Element struct {
	ElementNR
	Rels Relationships
}

Element describes a synaptic element's properties, including Relationships.

func (Element) Copy

func (e Element) Copy() *Element

type ElementNR

type ElementNR struct {
	Pos  dvid.Point3d
	Kind ElementType
	Tags Tags              // Indexed
	Prop map[string]string // Non-Indexed
}

ElementNR describes a synaptic element's properties with No Relationships (NR), used for label and tag annotations while block-indexed annotations include the relationships.

func (ElementNR) Copy

func (e ElementNR) Copy() *ElementNR

func (ElementNR) String

func (e ElementNR) String() string

type ElementPos

type ElementPos struct {
	Label uint64
	Kind  ElementType
	Pos   dvid.Point3d
}

ElementPos describes the label and kind of an annotation, useful for synchronizing changes in data to other data types like labelsz.

type ElementType

type ElementType uint8

ElementType gives the type of a synaptic element.

const (
	UnknownElem ElementType = iota
	PostSyn                 // Post-synaptic element
	PreSyn                  // Pre-synaptic element
	Gap                     // Gap junction
	Note                    // A note or bookmark with some description
)

func StringToElementType

func StringToElementType(s string) ElementType

StringToElementType converts a string

func (ElementType) IsSynaptic

func (e ElementType) IsSynaptic() bool

IsSynaptic returns true if the ElementType is some synaptic component.

func (ElementType) MarshalJSON

func (e ElementType) MarshalJSON() ([]byte, error)

func (ElementType) String

func (e ElementType) String() string

func (*ElementType) UnmarshalJSON

func (e *ElementType) UnmarshalJSON(b []byte) error

type Elements

type Elements []Element

Elements is a slice of Element, which includes relationships.

func (Elements) Len

func (elems Elements) Len() int

func (Elements) Less

func (elems Elements) Less(i, j int) bool

Less returns true if element[i] < element[j] where ordering is determined by Pos and Kind in that order. Relationships and Tags are not considered in ordering.

func (Elements) Normalize

func (elems Elements) Normalize() Elements

Returns Elements that can be used for DeepEqual because all positions, relationships, and tags are sorted.

func (Elements) Swap

func (elems Elements) Swap(i, j int)

type ElementsNR

type ElementsNR []ElementNR

ElementsNR is a slice of elements without relationships.

func (ElementsNR) Len

func (elems ElementsNR) Len() int

func (ElementsNR) Less

func (elems ElementsNR) Less(i, j int) bool

Less returns true if element[i] < element[j] where ordering is determined by Pos and Kind in that order. Tags are not considered in ordering.

func (ElementsNR) Normalize

func (elems ElementsNR) Normalize() ElementsNR

Normalize returns ElementsNR that can be used for DeepEqual because all positions and tags are sorted.

func (ElementsNR) Swap

func (elems ElementsNR) Swap(i, j int)

type LabelElements

type LabelElements map[uint64]ElementsNR

type LabelPoints

type LabelPoints map[uint64][]dvid.Point3d

type Properties

type Properties struct {
}

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

type RelationType

type RelationType uint8
const (
	UnknownRel RelationType = iota
	PostSynTo
	PreSynTo
	ConvergentTo
	GroupedWith
)

func (RelationType) MarshalJSON

func (r RelationType) MarshalJSON() ([]byte, error)

func (*RelationType) UnmarshalJSON

func (r *RelationType) UnmarshalJSON(b []byte) error

type Relationship

type Relationship struct {
	Rel RelationType
	To  dvid.Point3d
}

Relationship is a link between two synaptic elements.

type Relationships

type Relationships []Relationship

func (Relationships) Len

func (r Relationships) Len() int

func (Relationships) Less

func (r Relationships) Less(i, j int) bool

func (Relationships) Swap

func (r Relationships) Swap(i, j int)

type Tag

type Tag string

Tag is a string description of a synaptic element grouping, e.g., "convergent".

func DecodeTagTKey

func DecodeTagTKey(tk storage.TKey) (Tag, error)

DecodeTagTKey returns the Tag corresponding to this type-specific key.

type Tags

type Tags []Tag

func (Tags) Changes

func (t Tags) Changes(t2 Tags) (removed, added Tags)

Changes returns tags removed or added from the receiver.

func (Tags) Len

func (t Tags) Len() int

func (Tags) Less

func (t Tags) Less(i, j int) bool

func (Tags) Removed

func (t Tags) Removed(t2 Tags) Tags

Removed returns tags removed from the receiver.

func (Tags) Swap

func (t Tags) Swap(i, j int)

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