roi

package
v0.8.18 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package roi implements DVID support for Region-Of-Interest operations.

Index

Constants

View Source
const (
	Version  = "0.1"
	RepoURL  = "github.com/janelia-flyem/dvid/datatype/roi"
	TypeName = "roi"

	DefaultBlockSize = 32
)
View Source
const HelpMessage = `` /* 4613-byte string literal not displayed */

Variables

This section is empty.

Functions

func Get

func Get(ctx *datastore.VersionedCtx) ([]byte, error)

Get returns a JSON-encoded byte slice of the ROI in the form of 4-Spans, where each Span is [z, y, xstart, xend]

func GetSpans

func GetSpans(ctx *datastore.VersionedCtx) ([]dvid.Span, error)

GetSpans returns all (z, y, x0, x1) Spans in sorted order: z, then y, then x0.

func ParseFilterSpec added in v0.8.2

func ParseFilterSpec(spec storage.FilterSpec) (name dvid.InstanceName, v dvid.VersionID, found bool, err error)

ParseFilterSpec returns the specified ROI instance name and version within a FilterSpec. Currently, only one ROI can be specified in a FilterSpec. Multiple ROIs should use a different FilterSpec like "intersect" instead of "roi".

func VoxelBoundsInside added in v0.8.2

func VoxelBoundsInside(e dvid.Extents3d, blocksize dvid.Point3d, spans []dvid.Span) (bool, error)

VoxelBoundsInside returns true if the given voxel extents intersects the spans.

Types

type Data

Data embeds the datastore's Data and extends it with keyvalue properties (none for now).

func DataByFilter added in v0.8.4

func DataByFilter(spec storage.FilterSpec) (d *Data, v dvid.VersionID, found bool, err error)

DataByFilter returns a ROI Data based on a string specification of the form "roi:<roiname>,<uuid>". If the given string is not parsable, the "found" return value is false.

func DataBySpec added in v0.8.2

func DataBySpec(spec string) (d *Data, v dvid.VersionID, found bool, err error)

DataBySpec returns a ROI Data based on a string specification of the form "<roiname>,<uuid>". If the given string is not parsable, the "found" return value is false.

func GetByUUIDName added in v0.8.3

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

GetByUUIDName returns a pointer to ROI data given a version (UUID) and data name.

func (*Data) CopyPropertiesFrom added in v0.8.2

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

func (d *Data) Delete(ctx storage.VersionedCtx) error

Delete removes an ROI.

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

Equals returns false if any version of the ROI is different

func (*Data) GetMask

func (d *Data) GetMask(ctx *datastore.VersionedCtx, subvol *dvid.Subvolume) ([]byte, error)

GetMask returns a binary volume of subvol size where each element is 1 if inside the ROI and 0 if outside the ROI.

func (*Data) GetSpans added in v0.8.2

func (d *Data) GetSpans(v dvid.VersionID) ([]dvid.Span, error)

GetSpans returns all (z, y, x0, x1) Spans in sorted order: z, then y, then x0.

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) IsMutationRequest added in v0.8.5

func (d *Data) IsMutationRequest(action, endpoint string) bool

IsMutationRequest overrides the default behavior to specify POST /ptquery as an immutable request.

func (*Data) MarshalJSON

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

func (*Data) Partition

func (d *Data) Partition(ctx storage.Context, batchsize int32) ([]byte, error)

Partition returns JSON of differently sized subvolumes that attempt to distribute the number of active blocks per subvolume.

func (*Data) PointQuery

func (d *Data) PointQuery(ctx *datastore.VersionedCtx, jsonBytes []byte) ([]byte, error)

PointQuery checks if a JSON-encoded list of voxel points are within an ROI. It returns a JSON list of bools, each corresponding to the original list of points.

func (*Data) PutJSON

func (d *Data) PutJSON(v dvid.VersionID, jsonBytes []byte) error

PutJSON saves JSON-encoded data representing an ROI into the datastore.

func (*Data) PutSpans

func (d *Data) PutSpans(versionID dvid.VersionID, spans []dvid.Span, init bool) error

PutSpans saves a slice of spans representing an ROI into the datastore. If the init parameter is true, all previous spans of this ROI are deleted before writing these spans.

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.

func (*Data) SimplePartition

func (d *Data) SimplePartition(ctx storage.Context, batchsize int32) ([]byte, error)

SimplePartition returns JSON of identically sized subvolumes arranged over ROI

type Immutable added in v0.8.4

type Immutable struct {
	// contains filtered or unexported fields
}

Immutable is an ROI fixed to a particular version that you can check voxel coordinates against.

func ImmutableBySpec added in v0.8.4

func ImmutableBySpec(spec string) (*Immutable, error)

ImmutableBySpec returns an Immutable ROI (or nil if not available) given a name and uuid using string format "<roiname>,<uuid>"

func (Immutable) VoxelWithin added in v0.8.4

func (i Immutable) VoxelWithin(p dvid.Point3d) bool

type Iterator

type Iterator struct {
	// contains filtered or unexported fields
}

Iterator is optimized for detecting whether given keys are within an ROI. It exploits the key, and in particular IndexZYX, ordering so that checks across a volume can be done quickly.

func NewIterator

func NewIterator(roiName dvid.InstanceName, versionID dvid.VersionID, b dvid.Bounder) (*Iterator, error)

func NewIteratorBySpec added in v0.8.1

func NewIteratorBySpec(spec storage.FilterSpec, b dvid.Bounder) (it *Iterator, v dvid.VersionID, found bool, err error)

NewIteratorBySpec returns a ROI iterator based on a string specification of the form "roi:<roiname>,<uuid>" where the ROI instance name and uniquely identifying string form of uuid are given. If the given string is not parsable, the "found" return value is false.

func (*Iterator) InsideFast

func (it *Iterator) InsideFast(indexZYX dvid.IndexZYX) bool

Returns true if the index is inside the ROI volume. Note that this optimized function maintains state and is not concurrency safe; it assumes sequential calls where the considered indexZYX is increasing in Z, Y, and X after either NewIterator() or Reset().

func (*Iterator) Reset

func (it *Iterator) Reset()

type Properties

type Properties struct {
	BlockSize dvid.Point3d

	// Minimum Block Coord Z for ROI
	MinZ int32

	// Maximum Block Coord Z for ROI
	MaxZ int32
}

Properties are additional properties for keyvalue data instances beyond those in standard datastore.Data. These will be persisted to metadata storage.

type Type

type Type struct {
	datastore.Type
}

Type embeds the datastore's Type to create a unique type for keyvalue functions.

func NewType

func NewType() *Type

NewType returns a pointer to a new keyvalue Type with default values set.

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)

NewData returns a pointer to new ROI data with default values.

type ZRange

type ZRange struct {
	MinZ, MaxZ int32
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL