dvid

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: 44 Imported by: 46

Documentation

Overview

Package dvid provides types, constants, and functions that have no other dependencies and can be used by all packages within DVID. This includes core data structures, command string handling, and command packaging. Since these elements are used at multiple DVID layers, we separate them here and allow reuse in layer-specific types through embedding.

Index

Constants

View Source
const (
	LocalIDSize   = 2
	LocalID32Size = 4

	MaxLocalID   = 0xFFFF
	MaxLocalID32 = 0xFFFFFFFF
)
View Source
const (
	MaxInstanceID = MaxLocalID32
	MaxRepoID     = MaxLocalID32
	MaxVersionID  = MaxLocalID32
	MaxClientID   = MaxLocalID32

	InstanceIDSize = 4
	RepoIDSize     = 4
	VersionIDSize  = 4
	ClientIDSize   = 4
)
View Source
const (
	NoCompression      CompressionLevel = 0
	BestSpeed                           = 1
	BestCompression                     = 9
	DefaultCompression                  = -1
)
View Source
const (
	Uncompressed CompressionFormat = 0
	Snappy                         = 1
	Gzip                           = 2 // Gzip stores length and checksum automatically.
	LZ4                            = 4
	JPEG                           = 5
)
View Source
const (
	Kilo = 1 << 10
	Mega = 1 << 20
	Giga = 1 << 30
	Tera = 1 << 40
)
View Source
const (
	// EncodingBinary denotes no payload bytes since binary sparse volume is
	// defined by just start and run length.
	EncodingBinary byte = 0x00

	// EncodingGrayscale8 denotes an 8-bit grayscale payload.
	EncodingGrayscale8 = 0x01

	// EncodingGrayscale16 denotes a 16-bit grayscale payload.
	EncodingGrayscale16 = 0x02

	// EncodingNormal16 denotes 16-bit encoded normals.
	EncodingNormal16 = 0x04
)

Sparse Volume binary encoding payload descriptors.

View Source
const BitsOfInt = 32 << (^uint(0) >> 63)

BitsOfInt is the number of bits used for an int

View Source
const ChunkPoint2dSize = 8
View Source
const ChunkPoint3dSize = 12
View Source
const CoordinateBits = 32
View Source
const DataShapeBytes = 7
View Source
const DefaultJPEGQuality = 80

DefaultJPEGQuality is the quality of images returned if requesting JPEG images and an explicit Quality amount is omitted.

View Source
const IndexZYXSize = ChunkPoint3dSize
View Source
const NilUUID = UUID("")
View Source
const VertexIDSize = 8

Variables

View Source
var (
	// XY describes a 2d rectangle of voxels that share a z-coord.
	XY = DataShape{3, []uint8{0, 1}}

	// XZ describes a 2d rectangle of voxels that share a y-coord.
	XZ = DataShape{3, []uint8{0, 2}}

	// YZ describes a 2d rectangle of voxels that share a x-coord.
	YZ = DataShape{3, []uint8{1, 2}}

	// Arb describes a 2d rectangle of voxels with arbitrary 3d orientation.
	Arb = DataShape{3, nil}

	// Vol3d describes a 3d volume of voxels
	Vol3d = DataShape{3, []uint8{0, 1, 2}}
)
View Source
var (
	MaxIndexZYX = IndexZYX(MaxChunkPoint3d)
	MinIndexZYX = IndexZYX(MinChunkPoint3d)
)
View Source
var (
	MaxChunkPoint2d = ChunkPoint2d{math.MaxInt32, math.MaxInt32}
	MinChunkPoint2d = ChunkPoint2d{math.MinInt32, math.MinInt32}
)
View Source
var DefaultChecksum = NoChecksum

DefaultChecksum is the type of checksum employed for all data operations. Note that many database engines already implement some form of corruption test and checksum can be set on each datatype instance.

View Source
var (
	Font *truetype.Font
)
View Source
var (
	// NumCPU is the number of cores available to this DVID server.
	NumCPU int
)

Functions

func AliasByteToUint16

func AliasByteToUint16(b []byte) ([]uint16, error)

AliasByteToUint16 returns a uint16 slice that reuses the passed byte slice. NOTE: The passed byte slice must be aligned for uint16.

func AliasByteToUint32

func AliasByteToUint32(b []byte) ([]uint32, error)

AliasByteToUint32 returns a uint32 slice that reuses the passed byte slice. NOTE: The passed byte slice must be aligned for uint32.

func AliasByteToUint64

func AliasByteToUint64(b []byte) (out []uint64, err error)

AliasByteToUint64 returns a uint64 slice that reuses the passed byte slice. NOTE: The passed byte slice must be aligned for uint64. Use New8ByteAlignBytes() to allocate for guarantee.

func AliasUint16ToByte

func AliasUint16ToByte(in []uint16) []byte

AliasUint16ToByte returns the underlying byte slice for a uint16 slice.

func AliasUint32ToByte

func AliasUint32ToByte(in []uint32) []byte

AliasUint32ToByte returns the underlying byte slice for a uint32 slice.

func AliasUint64ToByte

func AliasUint64ToByte(in []uint64) []byte

AliasUint64ToByte returns the underlying byte slice for a uint64 slice.

func AllowRequests

func AllowRequests()

AllowRequests sets dvid to process requests

func BlockAligned

func BlockAligned(geom Bounder, blockSize Point) bool

BlockAligned returns true if the bounds for a n-d volume are aligned to blocks of the given size. Alignment requires that the start point is the first voxel in a block and the end point is the last voxel in a block.

func BlockOnActiveCgo

func BlockOnActiveCgo()

BlockOnActiveCgo will block until all active writing cgo routines have been finished. This requires cgo routines to be bracketed by:

dvid.StartCgo()
/* Some cgo code that's writing */
dvid.StopCgo()

func ByteToUint64

func ByteToUint64(b []byte) (out []uint64, err error)

ByteToUint64 copies a properly aligned byte slice into a []uint64.

func ConvertToAbsolute

func ConvertToAbsolute(relativePath string, anchorDir string) (string, error)

Converts the given (possibly) relative path into an absolute path, relative to the given anchor directory, not the current working directory. If the given relativePath is already an absolute path, it is returned unchanged.

func Criticalf

func Criticalf(format string, args ...interface{})

func DataFromPost

func DataFromPost(r *http.Request, key string) ([]byte, error)

DataFromPost returns data submitted in the given key of a POST request.

func DataTypeBytes

func DataTypeBytes(t DataType) int32

DataTypeBytes returns the # of bytes for a given type string. For example, "uint16" is 2 bytes. No error checking is performed to make sure string is valid.

func Debugf

func Debugf(format string, args ...interface{})

func DecodeSerializationFormat

func DecodeSerializationFormat(s SerializationFormat) (CompressionFormat, Checksum)

func DenyRequests

func DenyRequests()

DenyRequests sets dvid to ignore requests

func Deserialize

func Deserialize(s []byte, object interface{}) error

Deserialize a Go object using Gob encoding

func EmptyValue

func EmptyValue() []byte

func Errorf

func Errorf(format string, args ...interface{})

func EstimateGoroutines

func EstimateGoroutines(percentCPUs float64, goroutineMB int32) int

EstimateGoroutines returns the # of goroutines that can be launched given a percentage (up to 1.0) of available CPUs (set by command line option or # cores) and/or the megabytes (MB) of memory needed for each goroutine. A minimum of 1 goroutine is returned. TODO: Actually use the required memory provided in argument. For now,

only returns percentage of maximum # of cores.

func GetNumBlocks

func GetNumBlocks(geom Geometry, blockSize Point) int

GetNumBlocks returns the number of n-d blocks necessary to cover the given geometry.

func GoImageFromData

func GoImageFromData(data []byte, nx, ny int) (image.Image, error)

GoImageFromData returns a go Image given pixel data.

func GoImageFromFile

func GoImageFromFile(filename string) (image.Image, string, error)

GoImageFromFile returns an image and its format name given a file name.

func ImageData

func ImageData(img image.Image) (data []uint8, bytesPerPixel, stride int32, err error)

ImageData returns the underlying pixel data for an image or an error if the image doesn't have the requisite []uint8 pixel data.

func ImageGrayFromData

func ImageGrayFromData(data []uint8, nx, ny int) (img *image.Gray)

ImageGrayFromData returns a Gray image given data and image size.

func ImageNRGBA64FromData

func ImageNRGBA64FromData(data []byte, nx, ny int) (img *image.NRGBA64)

ImageNRGBA64FromData returns a NRGBA64 image given 64-bit data and image size.

func Infof

func Infof(format string, args ...interface{})

func ListDataShapes

func ListDataShapes() (shapes []string)

ListDataShapes returns a slice of shape names

func LogImmediately

func LogImmediately(s string)

LogImmediately writes a message to the log file immediately, bypassing any queue of log messages.

func MakeGzipHandler

func MakeGzipHandler(fn http.HandlerFunc) http.HandlerFunc

func MaxInt32

func MaxInt32(a, b int32) int32

func MinInt32

func MinInt32(a, b int32) int32

func New8ByteAlignBytes

func New8ByteAlignBytes(numBytes uint32) ([]byte, []uint64)

New8ByteAlignBytes returns a byte slice that has an 8 byte alignment guarantee based on the Go compiler spec. The source []uint64 must be preserved until the byte slice is no longer needed.

func NumberActiveCGo

func NumberActiveCGo() uint64

NumberActiveCGo returns the number of active CGo routines, typically involved with database operations.

func PendingLogMessages

func PendingLogMessages() int

PendingLogMessages returns the number of log messages that are in queue to be written.

func PlaceholderImage

func PlaceholderImage(shape DataShape, imageSize Point, message string) (image.Image, error)

PlaceholderImage returns an solid image with a message and text describing the shape.

func PrintNonZero

func PrintNonZero(message string, value []byte)

PrintNonZero prints the number of non-zero bytes in a slice of bytes.

func RandomBytes

func RandomBytes(numBytes int32) []byte

RandomBytes returns a slices of random bytes.

func ReadJSONFile

func ReadJSONFile(filename string) (value map[string]interface{}, err error)

ReadJSONFile returns a map[string]interface{} with decoded JSON from a file. If a file is not organized as a JSON object, an error will be returned.

func ReportPanic

func ReportPanic(msg, sendingServer string)

ReportPanic prints the message and stack trace to stderr, the log, and via email if an email notifier was setup.

func RequestsOK

func RequestsOK() bool

RequestsOK returns true if dvid should respond to requests

func SendEmail

func SendEmail(subject, message string, recipients []string, periodicTopic string) error

SendEmail sends e-mail to the given recipients or the default emails loaded during configuration. If a "periodicTopic" is set, then only one email per ten minutes is sent for that particular topic.

func SendHTTP

func SendHTTP(w http.ResponseWriter, r *http.Request, name string, data []byte)

SendHTTP sends data after setting an appropriate Content-Type by examining the name and also some byte sniffing.

func Serialize

func Serialize(object interface{}, compress Compression, checksum Checksum) ([]byte, error)

Serialize an arbitrary Go object using Gob encoding and optional compression, checksum. If your object is []byte, you should preferentially use SerializeData since the Gob encoding process adds some overhead in performance as well as size of wire format to describe the transmitted types.

func SerializeData

func SerializeData(data []byte, compress Compression, checksum Checksum) ([]byte, error)

SerializeData serializes a slice of bytes using optional compression, checksum. Checksum will be ignored if the underlying compression already employs checksums, e.g., Gzip.

func SerializePrecompressedData

func SerializePrecompressedData(data []byte, compress Compression, checksum Checksum) ([]byte, error)

SerializePrecompressedData serializes a slice of bytes that have already been compressed and adds DVID serialization for discerning optional compression and checksum. Checksum will be ignored if the underlying compression already employs checksums, e.g., Gzip.

func SetEmailServer

func SetEmailServer(e EmailConfig)

SetEmailServer sets the email server used for all subsequent SendEmail calls.

func SetImageHeader

func SetImageHeader(w http.ResponseWriter, formatStr string) error

Sets the header's content type to approrprirate media type. Default is PNG.

func SetLogMode

func SetLogMode(newMode ModeFlag)

SetLogMode sets the severity required for a log message to be printed. For example, SetMode(dvid.WarningMode) will log any calls using Warningf, Errorf, or Criticalf. To turn off all logging, use SilentMode.

func Shutdown

func Shutdown()

Shutdown closes any logging, blocking until the log has been flushed of pending messages.

func StartCgo

func StartCgo()

StartCgo is used to mark the beginning of a cgo routine and blocks if we have requested a BlockOnActiveCgo(). This is used for graceful shutdowns and monitoring.

func StopCgo

func StopCgo()

func SupportsGzipEncoding

func SupportsGzipEncoding(r *http.Request) bool

SupportsGzipEncoding returns true if the http requestor can accept gzip encoding.

func TimeCriticalf

func TimeCriticalf(format string, args ...interface{})

func TimeDebugf

func TimeDebugf(format string, args ...interface{})

func TimeErrorf

func TimeErrorf(format string, args ...interface{})

func TimeInfof

func TimeInfof(format string, args ...interface{})

func TimeWarningf

func TimeWarningf(format string, args ...interface{})

func Warningf

func Warningf(format string, args ...interface{})

func WriteGzip

func WriteGzip(gzipData []byte, w http.ResponseWriter, r *http.Request) error

WriteGzip will write already gzip-encoded data to the ResponseWriter unless the requestor cannot support it. In that case, the gzip data is uncompressed and sent uncompressed.

func WriteImageHttp

func WriteImageHttp(w http.ResponseWriter, img image.Image, formatStr string) error

WriteImageHttp writes an image to a HTTP response writer using a format and optional compression strength specified in a string, e.g., "png", "jpg:80".

func WriteJSONFile

func WriteJSONFile(filename string, value interface{}) error

WriteJSONFile writes an arbitrary but exportable Go object to a JSON file.

Types

type AutoInstanceStore

type AutoInstanceStore interface {
	AutoInstances() (name, repoUUID string, n int) // name is empty string if none requested
}

AutoInstanceStore is a store that can request automatic temporary instances to be created.

type Axis

type Axis uint8

Axis enumerates different types of axis (x, y, z, time, etc)

const (
	XAxis Axis = iota
	YAxis
	ZAxis
	TAxis
)

func (Axis) String

func (a Axis) String() string

type BinaryVolume

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

BinaryVolume holds 3d binary data including a 3d offset.

func NewBinaryVolume

func NewBinaryVolume(offset, size Point3d, res NdFloat32) *BinaryVolume

NewBinaryVolume returns a BinaryVolume with an allocated 3d volume for data.

func (*BinaryVolume) CheckSurface

func (binvol *BinaryVolume) CheckSurface(x, y, z int32) (normx, normy, normz float32, isSurface bool)

CheckSurface checks to see if the given voxel within the BinaryVolume is set, and if so, calculates a normal based on a Zucker-Hummel 3x3x3 convolution.

func (*BinaryVolume) ShiftUp

func (binvol *BinaryVolume) ShiftUp(dz int32)

Shift the buffer up by dz voxels.

type BlockCounts

type BlockCounts struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

BlockCounts is a thread-safe type for counting block references.

func (*BlockCounts) Decr

func (c *BlockCounts) Decr(block IZYXString)

Decr decrements the count for a block.

func (*BlockCounts) Empty

func (c *BlockCounts) Empty() bool

Empty returns true if there are no counts.

func (*BlockCounts) Incr

func (c *BlockCounts) Incr(block IZYXString)

Incr increments the count for a block.

func (*BlockCounts) Value

func (c *BlockCounts) Value(block IZYXString) int

Value returns the count for a block.

type BlockRLEs

type BlockRLEs map[IZYXString]RLEs

BlockRLEs is a single label's map of block coordinates to RLEs for that label. The key is a string of the serialized block coordinate.

func (BlockRLEs) NumVoxels

func (brles BlockRLEs) NumVoxels() uint64

NumVoxels is the number of voxels contained within a label's block RLEs.

func (BlockRLEs) SortedKeys

func (brles BlockRLEs) SortedKeys() IZYXSlice

SortedKeys returns a slice of IZYXString sorted in ascending order.

type Bool

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

Bool is a concurrency-safe bool.

func (*Bool) SetFalse

func (b *Bool) SetFalse()

func (*Bool) SetTrue

func (b *Bool) SetTrue()

func (*Bool) Value

func (b *Bool) Value() bool

type Bounder

type Bounder interface {
	// StartPoint returns the offset to first point of data.
	StartPoint() Point

	// EndPoint returns the last point.
	EndPoint() Point
}

type Bounds

type Bounds struct {
	Voxel *OptionalBounds
	Block *OptionalBounds
	Exact bool // If false, just screen on blocks.
}

Bounding provides two levels of optional bounds (voxel and block) as well as whether bounds must be exact to voxel level.

type ByZYX

type ByZYX ListChunkPoint3d

func (*ByZYX) Len

func (list *ByZYX) Len() int

func (*ByZYX) Less

func (list *ByZYX) Less(i, j int) bool

Points are ordered by Z, then Y, then X.

func (*ByZYX) Swap

func (list *ByZYX) Swap(i, j int)

type Checksum

type Checksum uint8

Checksum is the type of checksum employed for error checking stored data. The maximum number of checksum types is limited to 2 bits (3 types).

const (
	NoChecksum Checksum = 0
	CRC32               = 1
)

func (Checksum) String

func (checksum Checksum) String() string

type ChunkExtents3d

type ChunkExtents3d struct {
	MinChunk ChunkPoint3d
	MaxChunk ChunkPoint3d
}

ChunkExtents3d defines a 3d volume of chunks

func (*ChunkExtents3d) Extend

func (ext *ChunkExtents3d) Extend(pt ChunkPoint3d) bool

func (*ChunkExtents3d) ExtendDim

func (ext *ChunkExtents3d) ExtendDim(dim int, val int32) bool

type ChunkIndexer

type ChunkIndexer interface {
	Index

	ChunkPoint

	// Min returns a ChunkIndexer that is the minimum of its value and the passed one.
	Min(ChunkIndexer) (min ChunkIndexer, changed bool)

	// Max returns a ChunkIndexer that is the maximum of its value and the passed one.
	Max(ChunkIndexer) (max ChunkIndexer, changed bool)

	// DuplicateChunkIndexer returns a duplicate that can act as a ChunkIndexer.
	DuplicateChunkIndexer() ChunkIndexer
}

ChunkIndexer adds chunk point access to an index.

type ChunkPoint

type ChunkPoint interface {
	SimplePoint

	// MinPoint returns the minimum point within a chunk and first in an iteration.
	MinPoint(size Point) Point

	// MaxPoint returns the maximum point within a chunk and last in an iteration.
	MaxPoint(size Point) Point
}

ChunkPoint describes a particular chunk in chunk space.

type ChunkPoint2d

type ChunkPoint2d [2]int32

ChunkPoint2d handles 2d signed chunk coordinates.

func (ChunkPoint2d) MaxPoint

func (c ChunkPoint2d) MaxPoint(size Point) Point

MaxPoint returns the maximum voxel coordinate of the given 2d chunk.

func (ChunkPoint2d) MinPoint

func (c ChunkPoint2d) MinPoint(size Point) Point

MinPoint returns the smallest voxel coordinate of the given 2d chunk.

func (ChunkPoint2d) NumDims

func (c ChunkPoint2d) NumDims() uint8

func (ChunkPoint2d) String

func (c ChunkPoint2d) String() string

func (ChunkPoint2d) Value

func (c ChunkPoint2d) Value(dim uint8) int32

Value returns the value at the specified dimension.

type ChunkPoint3d

type ChunkPoint3d [3]int32

ChunkPoint3d handles 3d signed chunk coordinates.

func GetChunkPoint3d added in v1.0.0

func GetChunkPoint3d(pt, chunkSize Point3d) (chunkPt ChunkPoint3d, aligned bool)

func StringToChunkPoint3d

func StringToChunkPoint3d(str, separator string) (pt ChunkPoint3d, err error)

Parse a string of format "%d<sep>%d<sep>%d,..." into a ChunkPoint3d

func (ChunkPoint3d) BoundingVoxels

func (c ChunkPoint3d) BoundingVoxels(blockSize Point3d) (minBlockVoxel, maxBlockVoxel Point3d)

BoundingVoxels returns the minimum and maximum voxel coordinates for a given chunk where each chunk is of the given block size.

func (ChunkPoint3d) Equals

func (c ChunkPoint3d) Equals(c2 ChunkPoint3d) bool

func (ChunkPoint3d) MaxPoint

func (c ChunkPoint3d) MaxPoint(size Point) Point

MaxPoint returns the maximum voxel coordinate of the given 3d chunk.

func (ChunkPoint3d) MinPoint

func (c ChunkPoint3d) MinPoint(size Point) Point

MinPoint returns the smallest voxel coordinate of the given 3d chunk.

func (ChunkPoint3d) NumDims

func (c ChunkPoint3d) NumDims() uint8

func (*ChunkPoint3d) SetMaximum

func (p *ChunkPoint3d) SetMaximum(p2 ChunkPoint3d)

SetMaximum sets the point to the maximum elements of current and passed points.

func (*ChunkPoint3d) SetMinimum

func (p *ChunkPoint3d) SetMinimum(p2 ChunkPoint3d)

SetMinimum sets the point to the minimum elements of current and passed points.

func (ChunkPoint3d) String

func (c ChunkPoint3d) String() string

func (ChunkPoint3d) ToIZYXString

func (p ChunkPoint3d) ToIZYXString() IZYXString

func (ChunkPoint3d) Value

func (c ChunkPoint3d) Value(dim uint8) int32

Value returns the value at the specified dimension.

func (ChunkPoint3d) WithinChunkBoundingBox added in v1.0.0

func (c ChunkPoint3d) WithinChunkBoundingBox(minChunk, maxChunk ChunkPoint3d) bool

WithinChunkBoundingBox returns true if the chunk is within the given bounding box using chunk coordinates.

type ChunkPointNd

type ChunkPointNd []int32

ChunkPointNd handles N-dimensional signed chunk coordinates.

func (ChunkPointNd) MaxPoint

func (c ChunkPointNd) MaxPoint(size Point) Point

MaxPoint returns the maximum voxel coordinate of the given 3d chunk.

func (ChunkPointNd) MinPoint

func (c ChunkPointNd) MinPoint(size Point) Point

MinPoint returns the smallest voxel coordinate of the given 3d chunk.

func (ChunkPointNd) NumDims

func (c ChunkPointNd) NumDims() uint8

func (ChunkPointNd) String

func (c ChunkPointNd) String() string

func (ChunkPointNd) Value

func (c ChunkPointNd) Value(dim uint8) int32

Value returns the value at the specified dimension.

type ChunkSizer

type ChunkSizer interface {
	ChunkSize() Point
}

ChunkSizer objects can return their chunk size. In DVID, a Chunk is the unit of storage, for example, the unit of a value in a key-value store.

type Chunkable

type Chunkable interface {
	// Chunk returns a point in chunk space, the partition in which the given point falls.
	// For example, a chunk could be a tile (or a subvolume/block) and this returns the
	// tile's coordinate in tile space.
	Chunk(size Point) ChunkPoint

	// PointInChunk returns a point in a particular chunk's space.  For example, if a chunk
	// is a block of voxels, then the returned point is in that block coordinate space with
	// the first voxel in the block as the origin or zero point.
	PointInChunk(size Point) Point
}

Chunkable is an interface for n-dimensional points that can be partitioned into chunks.

type ClientID

type ClientID LocalID32

ClientID is a DVID server-specific identifier of an authorized client. It is used with data keys to track key-values on a per-client basis.

func ClientIDFromBytes

func ClientIDFromBytes(b []byte) ClientID

ClientIDFromBytes returns a VersionID from the start of the slice and the number of bytes used. Note: No error checking is done to ensure byte slice has sufficient bytes for ClientID.

func (ClientID) Bytes

func (id ClientID) Bytes() []byte

Bytes returns a sequence of bytes encoding this ClientID. Binary representation is big-endian to preserve lexicographic order.

type Command

type Command []string

Command supports command-line interaction with DVID. The first item in the string slice is the command, which may be "help" or the name of DVID data name ("uint8"). If the first item is the name of a data type, the second item will have a type-specific command like "get". The other arguments are command arguments or optional settings of the form "<key>=<value>".

func (Command) Argument

func (cmd Command) Argument(pos int) string

Returns the argument at the given position using zero indexing. Settings are not considered arguments. If no argument is at the given position, this returns the empty string.

func (Command) CommandArgs

func (cmd Command) CommandArgs(startPos int, targets ...*string) []string

CommandArgs sets a variadic argument set of string pointers to data command arguments, ignoring setting arguments of the form "<key>=<value>". If there aren't enough arguments to set a target, the target is set to the empty string. It returns an 'overflow' slice that has all arguments beyond those needed for targets.

Example: Given the command string "add param1 param2 42 data/*.png"

var s1, s2, s3, s4 string
filenames := CommandArgs(0, &s1, &s2, &s3, &s4)
fmt.Println(filenames)
fmt.Println(s1)
fmt.Println(s2, s3)
fmt.Println(s4)

Would print out:
   ["data/foo-1.png", "data/foo-2.png", "data/foo-3.png"]
   add
   param1 param2
   42

func (Command) FilenameArgs

func (cmd Command) FilenameArgs(startPos int, targets ...*string) (filenames []string, err error)

FilenameArgs is similar to CommandArgs except it can take filename glob patterns at the end of the string, and will find matches and return those.

func (Command) Name

func (cmd Command) Name() string

Name returns the first argument of the command (in lower case) which is assumed to be the name of the command.

func (Command) Setting

func (cmd Command) Setting(key string) (value string, found bool)

Setting scans a command for any "key=value" argument and returns the value of the passed 'key'. Key is case sensitive for this function.

func (Command) Settings

func (cmd Command) Settings() Config

Settings scans a command for any "key=value" argument and returns a Config, which is a map of key-value data. All keys are converted to lower case for case-insensitive matching.

func (Command) String

func (cmd Command) String() string

String returns a space-separated command line

func (Command) TypeCommand

func (cmd Command) TypeCommand() string

TypeCommand returns the name of a type-specific command (in lower case).

type Compression

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

Compression is the format of compression for storing data. NOTE: Should be no more than 8 (3 bits) compression types.

func NewCompression

func NewCompression(format CompressionFormat, level CompressionLevel) (Compression, error)

NewCompression returns a Compression struct that maps compression-specific details to a DVID-wide compression.

func (Compression) Format

func (c Compression) Format() CompressionFormat

func (Compression) Level

func (c Compression) Level() CompressionLevel

func (Compression) MarshalBinary

func (c Compression) MarshalBinary() ([]byte, error)

MarshalBinary fulfills the encoding.BinaryMarshaler interface.

func (Compression) MarshalJSON

func (c Compression) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Compression) String

func (c Compression) String() string

func (*Compression) UnmarshalBinary

func (c *Compression) UnmarshalBinary(data []byte) error

UnmarshalBinary fulfills the encoding.BinaryUnmarshaler interface.

func (*Compression) UnmarshalJSON

func (c *Compression) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type CompressionFormat

type CompressionFormat uint8

CompressionFormat specifies the compression algorithm and is limited to 3 bits (7 types)

func DeserializeData

func DeserializeData(s []byte, uncompress bool) ([]byte, CompressionFormat, error)

DeserializeData deserializes a slice of bytes using stored compression, checksum. If uncompress parameter is false, the data is not uncompressed.

func (CompressionFormat) String

func (format CompressionFormat) String() string

type CompressionLevel

type CompressionLevel int8

CompressionLevel goes from 1 (fastest) to 9 (highest compression) as in deflate. Default compression is -1 so need signed int8.

type Config

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

Config is a map of keyword to arbitrary data to specify configurations via keyword. Keywords are case-insensitive.

func NewConfig

func NewConfig() Config

func (*Config) Clear

func (c *Config) Clear()

Clear removes all configuration data.

func (*Config) Get

func (c *Config) Get(key string) (interface{}, bool)

func (Config) GetAll

func (c Config) GetAll() map[string]interface{}

func (Config) GetBool

func (c Config) GetBool(key string) (value, found bool, err error)

GetBool returns a bool value of the given key with string value. If setting of key is not parseable as a bool ("false", "true", "0", or "1"), returns an error. If the key is not found, it will also return a false bool (the Go zero value for bool).

func (Config) GetInt

func (c Config) GetInt(key string) (i int, found bool, err error)

GetInt returns an int value of the given key with string value. Returns an error if the key's value is not parsable as int.

func (Config) GetInt64 added in v0.9.17

func (c Config) GetInt64(key string) (i int64, found bool, err error)

GetInt64 returns an int value of the given key with string value. Returns an error if the key's value is not parsable as int.

func (Config) GetRange

func (c Config) GetRange(key, separator string) (*int32, *int32, error)

GetRange returns two int32 from a string where each integer is delimited by a separator. If the key is not found, nils are returned.

func (Config) GetShapes

func (c Config) GetShapes(key, separator string) ([]DataShape, error)

GetShapes returns DataShapes from a string where each shape specification is delimited by a separator. If the key is not found, nil is returned.

func (Config) GetString

func (c Config) GetString(key string) (s string, found bool, err error)

GetString returns a string value of the given key. If setting of key is not a string, returns an error. Returns zero value string ("") if not found.

func (Config) MarshalJSON

func (c Config) MarshalJSON() ([]byte, error)

func (*Config) Remove

func (c *Config) Remove(keys ...string)

Remove removes the key/value pairs with the given keys.

func (*Config) Set

func (c *Config) Set(key string, value interface{})

func (*Config) SetAll

func (c *Config) SetAll(kv map[string]interface{})

func (*Config) SetByJSON

func (c *Config) SetByJSON(jsonData io.Reader) error

Sets a configuration using valid JSON. Since Config is case-insensitive, JSON object names are converted to lower case.

type Data

type Data interface {
	InstanceID() InstanceID

	DataUUID() UUID
	DataName() InstanceName
	RootUUID() UUID
	RootVersionID() (VersionID, error)
	DAGRootUUID() (UUID, error)

	TypeName() TypeString
	TypeURL() URLString
	TypeVersion() string

	Tags() map[string]string

	// Versioned returns false if this data has only one version for an entire repo.
	Versioned() bool

	// KVStore returns the key-value store used for this data.
	KVStore() (Store, error)

	// Returns a concurrency-friendly unique operations ID for this Data.
	// The ID is monotonically increasing although it is not necessarily sequential.
	NewMutationID() uint64

	DataSetter

	IsDeleted() bool
	SetDeleted(bool) // use true if this data is in process of being deleted
}

Data is the minimal interface for datatype-specific data that is implemented in datatype packages. This interface is defined in the low-level dvid package so it is accessible at all levels of dvid, although the implementation of this interface occurs at the datastore and datatype-level packages.

type DataID

type DataID struct {
	// DataUUID is a globally unique identifier for this particular data instance,
	// whether it gets renamed or a portion of its DAG gets distributed to another
	// server.
	DataUUID UUID

	// Name, which can be changed over time.
	Name InstanceName

	// RootUUID is the root of the subgraph in which this data instance is defined.
	// Because a portion of data can be distributed to other servers, the current
	// DAG might be truncated, so the RootUUID can also be a child of the data
	// instance's original RootUUID.
	RootUUID UUID
}

DataID returns unique identifiers for a data instance. A data instance can be identified by a globally-unique, invariant UUID or a changing two-tuple (name, data root UUID).

type DataSetter

type DataSetter interface {
	SetKVStore(Store)
	SetLogStore(Store)

	SetInstanceID(InstanceID)
	SetDataUUID(UUID)
	SetName(InstanceName)
	SetRootUUID(UUID)

	// SetSync defines a set of data UUIDs for syncing with this data instance.
	// This could be used by higher software layers to implement pub/sub-style syncing.
	SetSync(UUIDSet)

	SetTags(map[string]string)

	// PersistMetadata writes changes for this data instance out to the metadata store.
	PersistMetadata() error
}

DataSetter provides interface for setting main properties of Data during initialization and remote transmission.

type DataShape

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

DataShape describes the number of dimensions and the ordering of the dimensions.

func BytesToDataShape

func BytesToDataShape(b []byte) (s DataShape, err error)

BytesToDataShape recovers a DataShape from a series of bytes.

func (DataShape) AxisName

func (s DataShape) AxisName(axis uint8) string

AxisName returns common axis descriptions like X, Y, and Z for a shapes dimensions.

func (DataShape) Bytes

func (s DataShape) Bytes() []byte

Bytes returns a fixed length byte representation that can be used for keys. Up to 5-d shapes can be used.

func (DataShape) ChunkPoint3d

func (s DataShape) ChunkPoint3d(p, size Point) (ChunkPoint3d, error)

ChunkPoint3d returns a chunk point where the XY is determined by the type of slice orientation of the DataShape, and the Z is the non-chunked coordinate. This is useful for tile generation where you have 2d tiles in a 3d space.

func (DataShape) Duplicate

func (s DataShape) Duplicate() DataShape

Duplicate returns a duplicate of the DataShape.

func (DataShape) Equals

func (s DataShape) Equals(s2 DataShape) bool

Equals returns true if the passed DataShape is identical.

func (DataShape) GetFloat2D

func (s DataShape) GetFloat2D(fslice NdFloat32) (x, y float32, err error)

GetFloat2D returns elements of a N-d float array given a 2d shape.

func (DataShape) GetSize2D

func (s DataShape) GetSize2D(size SimplePoint) (width, height int32, err error)

GetSize2D returns the width and height of a 2D shape given a n-D size.

func (DataShape) PlaneToChunkPoint3d

func (s DataShape) PlaneToChunkPoint3d(x, y int32, offset, size Point) (ChunkPoint3d, error)

PlaneToChunkPoint3d returns a chunk point corresponding to the given point on the DataShape's plane. If DataShape is not a plane, returns an error.

func (DataShape) ShapeDimension

func (s DataShape) ShapeDimension(axis uint8) (uint8, error)

ShapeDimension returns the axis number for a shape dimension.

func (DataShape) ShapeDimensions

func (s DataShape) ShapeDimensions() int8

ShapeDimensions returns the number of dimensions for this shape.

func (DataShape) String

func (s DataShape) String() string

func (DataShape) TotalDimensions

func (s DataShape) TotalDimensions() int8

TotalDimensions returns the full dimensionality of space within which there is this DataShape.

type DataShapeString

type DataShapeString string

String for specifying a slice orientation or subvolume

func (DataShapeString) DataShape

func (s DataShapeString) DataShape() (shape DataShape, err error)

DataShape returns the data shape constant associated with the string.

type DataShapes

type DataShapes []DataShape

DataShapes are a slice of DataShape.

type DataSpecifier

type DataSpecifier string

DataSpecifier is a scope for a configuration setting. It can be one of the following:

a plain string -> TypeString (the name of a datatype)
a quoted string of form "InstanceName, VersionUUID" -> data instance
a quoted string of form "DataUUID" -> data instance

The DataSpecifier can be used as the key of a map, and is useful when configuring which data is stored using different storage engines.

func GetDataSpecifier

func GetDataSpecifier(name InstanceName, uuid UUID) DataSpecifier

GetDataSpecifier returns an DataSpecifier given an instance name and a version UUID.

func GetDataSpecifierByTag

func GetDataSpecifierByTag(tag, value string) DataSpecifier

GetDataSpecifierByTag returns a DataSpecifier given a tag and its value.

type DataType

type DataType uint8

DataType is a unique ID for each type of data within DVID, e.g., a uint8 or a float32.

const (
	T_uint8 DataType = iota
	T_int8
	T_uint16
	T_int16
	T_uint32
	T_int32
	T_uint64
	T_int64
	T_float32
	T_float64
)

type DataValue

type DataValue struct {
	T     DataType
	Label string
}

DataValue describes the data type and label for each value within an element. Terminology: An "element" is some grouping, e.g., data associated with a voxel. A "value" is one component of the data for an element, or said another way, an element can have many values that may be of differing type and size.

func (DataValue) MarshalJSON

func (dv DataValue) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*DataValue) UnmarshalJSON

func (dv *DataValue) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (DataValue) ValueBytes

func (dv DataValue) ValueBytes() int32

ValueBytes returns the number of bytes for this value

type DataValues

type DataValues []DataValue

DataValues describes the interleaved values within an element.

func (DataValues) AverageData

func (values DataValues) AverageData(src, dst []byte, srcW, dstW, dstH, reduceW, reduceH int32)

AverageData averages the source slice of data and stores the result in the dst slice.

func (DataValues) BytesPerElement

func (values DataValues) BytesPerElement() int32

func (DataValues) BytesPerValue

func (values DataValues) BytesPerValue() (int32, error)

BytesPerValue returns the # bytes for each value of an element if all values have equal size. An error is returned if values are varying sizes for an element. Use ValueBytes(dim) to get bytes/value for elements with varying # of bytes per value.

func (DataValues) MarshalBinary

func (values DataValues) MarshalBinary() ([]byte, error)

MarshalBinary fulfills the encoding.BinaryMarshaler interface.

func (*DataValues) UnmarshalBinary

func (values *DataValues) UnmarshalBinary(b []byte) error

UnmarshalBinary fulfills the encoding.BinaryUnmarshaler interface.

func (DataValues) ValueBytes

func (values DataValues) ValueBytes(n int) int32

ValueBytes returnes the size of the nth value in an element.

func (DataValues) ValueDataType

func (values DataValues) ValueDataType() (DataType, error)

ValueDataType returns the dvid.DataType used for all values in an element. If the data types vary, e.g., an int32 then a float32, this function will return an error.

func (DataValues) ValuesPerElement

func (values DataValues) ValuesPerElement() int32

type Dimension

type Dimension struct {
	Name  string
	Units string
	// contains filtered or unexported fields
}

type DirtyBlocks

type DirtyBlocks struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

DirtyBlocks tracks dirty labels across versions

func (*DirtyBlocks) Decr

func (d *DirtyBlocks) Decr(iv InstanceVersion, block IZYXString)

func (*DirtyBlocks) Empty

func (d *DirtyBlocks) Empty(iv InstanceVersion) bool

func (*DirtyBlocks) Incr

func (d *DirtyBlocks) Incr(iv InstanceVersion, block IZYXString)

func (*DirtyBlocks) IsDirty

func (d *DirtyBlocks) IsDirty(iv InstanceVersion, block IZYXString) bool

type ElementProperties

type ElementProperties map[string]struct{}

ElementProperties is a set of strings corresponding to properties stored at an graph edge or vertex (it might make sense to store some properties with the vertex or edge)

type EmailConfig

type EmailConfig struct {
	Notify   []string
	Username string
	Password string
	Server   string
	Port     int
}

EmailConfig holds information necessary for SMTP use.

func (EmailConfig) Host

func (e EmailConfig) Host() string

Host returns the email server information.

func (EmailConfig) IsAvailable

func (e EmailConfig) IsAvailable() bool

IsAvailable returns true if the server and port are set to non-zero values.

type Extents

type Extents struct {
	MinPoint Point
	MaxPoint Point

	MinIndex ChunkIndexer
	MaxIndex ChunkIndexer
	// contains filtered or unexported fields
}

Extents holds the extents of a volume in both absolute voxel coordinates and lexicographically sorted chunk indices.

func (*Extents) AdjustIndices

func (ext *Extents) AdjustIndices(indexBeg, indexEnd ChunkIndexer) bool

AdjustIndices modifies extents based on new block indices in concurrency-safe manner.

func (*Extents) AdjustPoints

func (ext *Extents) AdjustPoints(pointBeg, pointEnd Point) bool

AdjustPoints modifies extents based on new voxel coordinates in concurrency-safe manner.

func (*Extents) Duplicate

func (ext *Extents) Duplicate() Extents

Duplicate creates a duplicate Extents.

func (*Extents) EndPoint

func (ext *Extents) EndPoint() Point

EndPoint returns the last point.

func (*Extents) StartPoint

func (ext *Extents) StartPoint() Point

StartPoint returns the offset to first point of data.

type Extents3d

type Extents3d struct {
	MinPoint Point3d
	MaxPoint Point3d
}

Extents defines a 3d volume

func GetTileExtents

func GetTileExtents(tileCoord ChunkPoint3d, plane DataShape, tileSize Point3d) (e Extents3d, err error)

GetTileExtents returns the extents of a tile in voxels.

func NewExtents3dFromStrings

func NewExtents3dFromStrings(offsetStr, sizeStr, sep string) (*Extents3d, error)

NewExtents3dFromStrings returns an Extents3d given string representations of offset and size in voxels.

func (*Extents3d) BlockRange

func (ext *Extents3d) BlockRange(size Point3d) (min, max ChunkPoint3d)

BlockRange returns the starting and ending block coordinate for given extents and block size.

func (*Extents3d) BlockWithin

func (ext *Extents3d) BlockWithin(size Point3d, coord ChunkPoint3d) bool

BlockWithin returns true if given block coord is within the extents partitioned using the give block size, or false if it is not given a 3d point size or block coord.

func (*Extents3d) Extend

func (ext *Extents3d) Extend(pt Point3d) bool

func (*Extents3d) ExtendDim

func (ext *Extents3d) ExtendDim(dim int, val int32) bool

func (*Extents3d) VoxelWithin

func (ext *Extents3d) VoxelWithin(pt Point3d) bool

VoxelWithin returns true if given point is within the extents.

type Filename

type Filename string

Filename has a base name + extension.

func (Filename) HasExtensionPrefix

func (fname Filename) HasExtensionPrefix(exts ...string) bool

HasExtensionPrefix returns true if the given string forms a prefix for the filename's extension.

type Geometry

type Geometry interface {
	Bounder

	// DataShape describes the shape of the data.
	DataShape() DataShape

	// Size returns the extent in each dimension.
	Size() Point

	// NumVoxels returns the number of voxels within this space.
	NumVoxels() int64

	String() string
}

Geometry describes the shape, size, and position of data in the DVID volume.

func Isotropy2D

func Isotropy2D(voxelSize NdFloat32, geom Geometry, isotropic bool) (Geometry, error)

Returns the image size necessary to compute an isotropic slice of the given dimensions. If isotropic is false, simply returns the original slice geometry. If isotropic is true, uses the higher resolution dimension.

func NewOrthogSlice

func NewOrthogSlice(s DataShape, offset Point, size Point2d) (Geometry, error)

NewOrthogSlice returns an OrthogSlice of chosen orientation, offset, and size.

func NewSliceFromStrings

func NewSliceFromStrings(str DataShapeString, offsetStr, sizeStr, sep string) (Geometry, error)

NewSliceFromStrings returns a Geometry object for a XY, XZ, or YZ slice given a data shape string, offset ("0,10,20"), and size ("250,250").

type GraphEdge

type GraphEdge struct {
	*GraphElement
	Vertexpair VertexPairID
}

GraphEdge defines an edge in a graph; if a directed edge is desired it must be specified as an edge property

type GraphElement

type GraphElement struct {
	Properties ElementProperties
	Weight     float64
}

GraphElement defines fundamental data common to both vertices and edges

type GraphVertex

type GraphVertex struct {
	*GraphElement
	Id       VertexID
	Vertices []VertexID
}

GraphVertex defines a vertex in a graph; a vertex should have a unique id

type Hashable

type Hashable interface {
	// Hash provides a consistent mapping from an Index to an integer (0,n]
	Hash(n int) int
}

Hashable is a type that provies a function to hash itself to an integer range.

type IZYXSlice

type IZYXSlice []IZYXString

IZYXSlice is a typically sorted slice of IZYXString

func (*IZYXSlice) Delete

func (i *IZYXSlice) Delete(i2 IZYXSlice)

Delete removes the given sorted IZYXSlice from the receiver.

func (IZYXSlice) Downres

func (i IZYXSlice) Downres(scale uint8) (IZYXSlice, error)

Downres returns a down-resolution version of the IZYXSlice where the factor is 2^scale. The receiver IZYXSlice does not have to be sorted.

func (IZYXSlice) FitToBounds

func (i IZYXSlice) FitToBounds(bounds *OptionalBounds) (IZYXSlice, error)

FitToBounds returns a copy IZYXSlice that has been adjusted to fit within the given optional block bounds. The receiver IZYXSlice is assumed to be sorted.

func (IZYXSlice) GetBounds

func (i IZYXSlice) GetBounds() (minPt, maxPt Point3d, err error)

GetBounds returns the minimum and maximum coordinate in the IZYXSlice.

func (IZYXSlice) Len

func (i IZYXSlice) Len() int

func (IZYXSlice) Less

func (i IZYXSlice) Less(a, b int) bool

func (IZYXSlice) MarshalBinary

func (i IZYXSlice) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface

func (*IZYXSlice) Merge

func (i *IZYXSlice) Merge(i2 IZYXSlice)

Merge merges the given sorted IZYXSlice into the receiver.

func (IZYXSlice) MergeCopy

func (i IZYXSlice) MergeCopy(i2 IZYXSlice) IZYXSlice

MergeCopy returns a merge of two sorted IZYXSlice. Both IZYXSlices should be sorted before use of this function and the result is a copy not a reference.

func (IZYXSlice) Split

func (i IZYXSlice) Split(rm IZYXSlice) (IZYXSlice, error)

Split removes the IZYXs from the receiver and returns the remainder as a copy. This assumes both deleted blocks and receiver are sorted.

func (IZYXSlice) String

func (i IZYXSlice) String() string

func (IZYXSlice) Swap

func (i IZYXSlice) Swap(a, b int)

func (*IZYXSlice) UnmarshalBinary

func (i *IZYXSlice) UnmarshalBinary(b []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.

func (IZYXSlice) WriteSerializedRLEs

func (i IZYXSlice) WriteSerializedRLEs(w io.Writer) (spans uint32, err error)

WriteSerializedRLEs writes serialized RLEs and returns the number of spans. Note this function assumes the receiver is already sorted.

type IZYXString

type IZYXString string

IZYXString is the stringified version of IndexZYX.Bytes(), optimized for lexicographic ordering.

func (IZYXString) Downres added in v1.0.0

func (i IZYXString) Downres(scale uint8) (IZYXString, error)

Downres returns an IZYXString downres'd by the given scale.

func (IZYXString) Halfres

func (i IZYXString) Halfres() (IZYXString, error)

Halfres returns an IZYXString representing a chunk point divided in two.

func (IZYXString) Hash

func (i IZYXString) Hash(n int) int

Hash returns an integer [0, n) where the returned values should be reasonably spread among the range of returned values. This implementation makes sure that any range query along x, y, or z direction will map to different handlers.

func (IZYXString) IndexZYX

func (i IZYXString) IndexZYX() (IndexZYX, error)

IndexZYX returns an index from a string representation of the coordinate.

func (IZYXString) String

func (i IZYXString) String() string

String returns a nicely formatted string of the 3d block coordinate or "corrupted coordinate".

func (IZYXString) ToChunkPoint3d

func (i IZYXString) ToChunkPoint3d() (ChunkPoint3d, error)

func (IZYXString) Unpack

func (i IZYXString) Unpack() (x, y, z int32, err error)

Unpack returns the constituent x, y, and z coordinates of the corresponding index.

func (IZYXString) VoxelOffset

func (i IZYXString) VoxelOffset(chunkSize Point3d) (offset Point3d, err error)

func (IZYXString) Z

func (i IZYXString) Z() (int32, error)

type Image

type Image struct {
	DataFormat   DataValues
	Interpolable bool

	Which   uint8
	Gray    *image.Gray
	Gray16  *image.Gray16
	NRGBA   *image.NRGBA
	NRGBA64 *image.NRGBA64
}

Image contains a standard Go image as well as a data format description so non-standard image values like uint64 labels or uint32 intensities can be handled. A DVID image also knows whether it should be interpolated on resizing or must keep pixel values without interpolation, e.g., when using labels. Better Gob serialization is handled by a union of possible image types compared to a generic image.Image interface: see https://groups.google.com/d/msg/golang-dev/_t4pqoeuflE/DbqSf41wr5EJ

func ImageFromBytes

func ImageFromBytes(data []byte, format DataValues, interpolable bool) (*Image, string, error)

ImageFromBytes returns a DVID Image from binary image data, e.g., a PNG file. Returns a string representing the type of encoding used for the image.

func ImageFromData

func ImageFromData(dstW, dstH int32, data []byte, format DataValues, interpolable bool) (*Image, error)

ImageFromData returns a DVID Image from raw data and dimensions.

func ImageFromGoImage

func ImageFromGoImage(src image.Image, format DataValues, interpolable bool) (*Image, error)

ImageFromGoImage returns a DVID image from a go image and a data format specification. DVID images must have identical data type values within a pixel.

func (*Image) Bounds

func (img *Image) Bounds() image.Rectangle

Bounds returns the size of the image. If an image is not set, it returns the zero recatnagle (image.ZR)

func (*Image) Data

func (img *Image) Data() []uint8

Data returns a slice of bytes corresponding to the image pixels.

func (*Image) DataPtr

func (img *Image) DataPtr(x, y int32) ([]byte, error)

DataPtr returns a slice of bytes corresponding to the value at point (x,y) in image.

func (*Image) Deserialize

func (img *Image) Deserialize(b []byte) error

Deserialze deserializes an Image from a possibly compressioned, checksummed byte slice.

func (Image) Get

func (img Image) Get() image.Image

Get returns an image.Image from the union struct.

func (Image) GetDrawable

func (img Image) GetDrawable() draw.Image

Get returns an image.Image from the union struct.

func (Image) GetJPEG

func (img Image) GetJPEG(quality int) ([]byte, error)

GetJPEG returns bytes in JPEG format where quality is 1-100, higher is better, and quality 0 is DefaultJPEGQuality.

func (Image) GetPNG

func (img Image) GetPNG() ([]byte, error)

GetPNG returns bytes in PNG format.

func (*Image) InterpolateImage

func (img *Image) InterpolateImage(dstW, dstH int) (image.Image, error)

InterpolateImage returns an image scaled to the given geometry using simple nearest-neighbor interpolation.

func (*Image) MarshalBinary

func (img *Image) MarshalBinary() ([]byte, error)

MarshalBinary fulfills the encoding.BinaryMarshaler interface.

func (*Image) NumBytes

func (img *Image) NumBytes() int32

Returns the number of bytes to be expected for this image and data format.

func (*Image) ResizeImage

func (img *Image) ResizeImage(dstW, dstH int) (image.Image, error)

ResizeImage returns an image scaled to the given geometry without doing interpolation.

func (*Image) ScaleImage

func (img *Image) ScaleImage(dstW, dstH int) (*Image, error)

ScaleImage scales a DVID image to the destination geometry size, using nearest-neighbor or interpolation depending on the type of data.

func (*Image) Serialize

func (img *Image) Serialize(compress Compression, checksum Checksum) ([]byte, error)

Serialize writes optional compressed and checksummed bytes representing image data.

func (*Image) SubImage

func (img *Image) SubImage(r image.Rectangle) (*Image, error)

SubImage returns an image representing the portion of the image p visible through r. The returned image shares pixels with the original image.

func (*Image) UnmarshalBinary

func (img *Image) UnmarshalBinary(b []byte) error

UnmarshalBinary fulfills the encoding.BinaryUnmarshaler interface.

type Index

type Index interface {
	// Duplicate returns a duplicate Index
	Duplicate() Index

	// Bytes returns a byte representation of the Index.  Integer components of
	// the Index should probably be serialized in big endian for improved
	// lexicographic ordering.
	Bytes() []byte

	// IndexFromBytes sets the receiver from the given bytes.
	IndexFromBytes([]byte) error

	// Scheme returns a string describing the indexing scheme.
	Scheme() string

	// String returns a human readable description of the Index.
	String() string
}

Index provides partioning of the data, typically in spatiotemporal ways. In the case of voxels, this could be an IndexZYX implementation that uses a 3d coordinate packed into a slice of bytes. It can be used to fill a TKey.

type IndexBytes

type IndexBytes []byte

IndexBytes satisfies an Index interface with a slice of bytes.

func (*IndexBytes) Bytes

func (i *IndexBytes) Bytes() []byte

func (*IndexBytes) Duplicate

func (i *IndexBytes) Duplicate() Index

func (*IndexBytes) Hash

func (i *IndexBytes) Hash(n int) int

func (*IndexBytes) IndexFromBytes

func (i *IndexBytes) IndexFromBytes(b []byte) error

func (*IndexBytes) Scheme

func (i *IndexBytes) Scheme() string

func (*IndexBytes) String

func (i *IndexBytes) String() string

type IndexCZYX

type IndexCZYX struct {
	Channel int32
	IndexZYX
}

IndexCZYX implements the Index interface and provides simple indexing on "channel" C, then Z, then Y, then X. Since IndexZYX is embedded, we get ChunkIndexer interface.

func (*IndexCZYX) Bytes

func (i *IndexCZYX) Bytes() []byte

Bytes returns a byte representation of the Index.

func (*IndexCZYX) Duplicate

func (i *IndexCZYX) Duplicate() Index

func (*IndexCZYX) IndexFromBytes

func (i *IndexCZYX) IndexFromBytes(b []byte) error

IndexFromBytes returns an index from bytes. The passed Index is used just to choose the appropriate byte decoding scheme.

func (*IndexCZYX) Scheme

func (i *IndexCZYX) Scheme() string

func (*IndexCZYX) String

func (i *IndexCZYX) String() string

type IndexCZYXIterator

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

----- IndexIterator implementation ------------

func NewIndexCZYXIterator

func NewIndexCZYXIterator(channel int32, start, end ChunkPoint3d) *IndexCZYXIterator

NewIndexCZYXIterator returns an IndexIterator that iterates over XYZ space for a C.

func (*IndexCZYXIterator) IndexSpan

func (it *IndexCZYXIterator) IndexSpan() (beg, end Index, err error)

func (*IndexCZYXIterator) NextSpan

func (it *IndexCZYXIterator) NextSpan()

func (*IndexCZYXIterator) Valid

func (it *IndexCZYXIterator) Valid() bool

type IndexHilbert

type IndexHilbert []byte

TODO -- Hilbert curve

func (IndexHilbert) Scheme

func (i IndexHilbert) Scheme() string

type IndexIterator

type IndexIterator interface {
	Valid() bool
	IndexSpan() (beg, end Index, err error)
	NextSpan()
}

IndexIterator is an interface that can return a sequence of indices.

type IndexMorton

type IndexMorton []byte

TODO -- Morton (Z-order) curve

func (IndexMorton) Scheme

func (i IndexMorton) Scheme() string

type IndexRange

type IndexRange struct {
	Minimum, Maximum Index
}

IndexRange defines the extent of data via minimum and maximum indices.

type IndexString

type IndexString string

IndexString satisfies an Index interface with a string.

func (*IndexString) Bytes

func (i *IndexString) Bytes() []byte

func (*IndexString) Duplicate

func (i *IndexString) Duplicate() Index

func (*IndexString) Hash

func (i *IndexString) Hash(n int) int

func (*IndexString) IndexFromBytes

func (i *IndexString) IndexFromBytes(b []byte) error

func (*IndexString) Scheme

func (i *IndexString) Scheme() string

func (*IndexString) String

func (i *IndexString) String() string

type IndexUint8

type IndexUint8 uint8

IndexUint8 satisfies an Index interface with an 8-bit unsigned integer index.

func (*IndexUint8) Bytes

func (i *IndexUint8) Bytes() []byte

Bytes returns a byte representation of the Index.

func (*IndexUint8) Duplicate

func (i *IndexUint8) Duplicate() Index

func (*IndexUint8) Hash

func (i *IndexUint8) Hash(n int) int

Hash returns an integer [0, n)

func (*IndexUint8) IndexFromBytes

func (i *IndexUint8) IndexFromBytes(b []byte) error

func (*IndexUint8) Scheme

func (i *IndexUint8) Scheme() string

func (*IndexUint8) String

func (i *IndexUint8) String() string

type IndexZYX

type IndexZYX ChunkPoint3d

IndexZYX implements the Index interface and provides simple indexing on Z, then Y, then X. Note that index elements are unsigned to better handle sequential access of negative/positive coordinates. The binary representation of an index must behave reasonably for both negative and positive coordinates, e.g., when moving from -1 to 0 the binary representation isn't discontinous so the lexicographical ordering switches. The simplest way to achieve this is to convert to an unsigned (positive) integer space where all coordinates are greater or equal to (0,0,...).

func (*IndexZYX) Bytes

func (i *IndexZYX) Bytes() []byte

Bytes returns a byte representation of the Index. This should layout integer space as consecutive in binary representation so we use bigendian and convert signed integer space to unsigned integer space.

func (*IndexZYX) Duplicate

func (i *IndexZYX) Duplicate() Index

func (*IndexZYX) DuplicateChunkIndexer

func (i *IndexZYX) DuplicateChunkIndexer() ChunkIndexer

DuplicateChunkIndexer returns a duplicate that can act as a ChunkIndexer.

func (*IndexZYX) Hash

func (i *IndexZYX) Hash(n int) int

Hash returns an integer [0, n) where the returned values should be reasonably spread among the range of returned values. This implementation makes sure that any range query along x, y, or z direction will map to different handlers. The underlying algorithm is identical to use of IZYXString so the has for either an IZYXString or IndexZYX representation will return the identical hash.

func (*IndexZYX) IndexFromBytes

func (i *IndexZYX) IndexFromBytes(b []byte) error

IndexFromBytes returns an index from key bytes. The passed Index is used just to choose the appropriate byte decoding scheme.

func (*IndexZYX) MarshalBinary

func (i *IndexZYX) MarshalBinary() ([]byte, error)

MarshalBinary fulfills the encoding.BinaryMarshaler interface and stores index ZYX as X, Y, Z in little endian int32 format. Note that this should NOT be used when creating a DVID key; use Bytes(), which stores big endian for better lexicographic ordering.

func (*IndexZYX) Max

func (i *IndexZYX) Max(idx ChunkIndexer) (ChunkIndexer, bool)

Max returns a ChunkIndexer that is the maximum of its value and the passed one.

func (*IndexZYX) MaxPoint

func (i *IndexZYX) MaxPoint(size Point) Point

MaxPoint returns the maximum voxel coordinate for a chunk.

func (*IndexZYX) Min

func (i *IndexZYX) Min(idx ChunkIndexer) (ChunkIndexer, bool)

Min returns a ChunkIndexer that is the minimum of its value and the passed one.

func (*IndexZYX) MinPoint

func (i *IndexZYX) MinPoint(size Point) Point

MinPoint returns the minimum voxel coordinate for a chunk.

func (*IndexZYX) NumDims

func (i *IndexZYX) NumDims() uint8

func (*IndexZYX) Scheme

func (i *IndexZYX) Scheme() string

func (*IndexZYX) String

func (i *IndexZYX) String() string

String produces a pretty printable string of the index in hex format.

func (*IndexZYX) ToIZYXString

func (i *IndexZYX) ToIZYXString() IZYXString

func (IndexZYX) ToVoxelOffset

func (i IndexZYX) ToVoxelOffset(chunkSize Point3d) Point3d

func (*IndexZYX) UnmarshalBinary

func (i *IndexZYX) UnmarshalBinary(b []byte) error

UnmarshalBinary fulfills the encoding.BinaryUnmarshaler interface and sets index ZYX using little endian int32 format. Note that this should NOT be used when retrieving a DVID key; use IndexFromBytes(), which decodes big endian due to key lexicographic ordering.

func (*IndexZYX) Unpack

func (i *IndexZYX) Unpack() (x, y, z int32)

func (*IndexZYX) Value

func (i *IndexZYX) Value(dim uint8) int32

Value returns the value at the specified dimension for this index.

type IndexZYXIterator

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

----- IndexIterator implementation ------------

func NewIndexZYXIterator

func NewIndexZYXIterator(start, end ChunkPoint3d) *IndexZYXIterator

NewIndexZYXIterator returns an IndexIterator that iterates over XYZ space.

func (*IndexZYXIterator) IndexSpan

func (it *IndexZYXIterator) IndexSpan() (beg, end Index, err error)

func (*IndexZYXIterator) NextSpan

func (it *IndexZYXIterator) NextSpan()

func (*IndexZYXIterator) Valid

func (it *IndexZYXIterator) Valid() bool

type InstanceID

type InstanceID LocalID32

InstanceID is a DVID server-specific identifier for data instances. Each InstanceID is only used within one repo, so all key/values for a repo can be obtained by doing range queries on instances associated with a repo. Valid InstanceIDs should be greater than 0.

func InstanceIDFromBytes

func InstanceIDFromBytes(b []byte) InstanceID

InstanceIDFromBytes returns a LocalID from the start of the slice and the number of bytes used. Note: No error checking is done to ensure byte slice has sufficient bytes for InstanceID.

func (InstanceID) Bytes

func (id InstanceID) Bytes() []byte

Bytes returns a sequence of bytes encoding this InstanceID.

type InstanceMap

type InstanceMap map[InstanceID]InstanceID

type InstanceName

type InstanceName string

InstanceName is a string that is the name of DVID data.

type InstanceNames

type InstanceNames []InstanceName

InstanceNames is a slice of DVID data instance names.

func (InstanceNames) String

func (i InstanceNames) String() string

type InstanceVersion

type InstanceVersion struct {
	Data    UUID
	Version VersionID
}

InstanceVersion identifies a particular version of a data instance.

func (InstanceVersion) String

func (iv InstanceVersion) String() string

type ListChunkPoint3d

type ListChunkPoint3d struct {
	Points  []ChunkPoint3d
	Indices []int
}

func ListChunkPoint3dFromVoxels

func ListChunkPoint3dFromVoxels(jsonBytes []byte, blockSize Point) (*ListChunkPoint3d, error)

ListChunkPoint3dFromVoxels creates a ListChunkPoint3d from JSON of voxel coordinates:

[ [x0, y0, z0], [x1, y1, z1], ... ]

type LocalID

type LocalID uint16

LocalID is a unique id for some data in a DVID instance. This unique id is a much smaller representation than the actual data (e.g., a version UUID or data type url) and can be represented with fewer bytes in keys.

func LocalIDFromBytes

func LocalIDFromBytes(b []byte) (id LocalID, length int)

LocalIDFromBytes returns a LocalID from the start of the slice and the number of bytes used. Note: No error checking is done to ensure byte slice has sufficient bytes for LocalID.

func (LocalID) Bytes

func (id LocalID) Bytes() []byte

Bytes returns a sequence of bytes encoding this LocalID. Binary representation will be big-endian to make integers lexigraphically ordered.

type LocalID32

type LocalID32 uint32

LocalID32 is a 32-bit unique id within this DVID instance.

func LocalID32FromBytes

func LocalID32FromBytes(b []byte) (id LocalID32, length int)

LocalID32FromBytes returns a LocalID from the start of the slice and the number of bytes used. Note: No error checking is done to ensure byte slice has sufficient bytes for LocalID.

func (LocalID32) Bytes

func (id LocalID32) Bytes() []byte

Bytes returns a sequence of bytes encoding this LocalID32.

type LogConfig

type LogConfig struct {
	Logfile string
	MaxSize int `toml:"max_log_size"`
	MaxAge  int `toml:"max_log_age"`
}

func (*LogConfig) SetLogger

func (c *LogConfig) SetLogger()

SetLogger creates a logger that saves to a rotating log file.

type Logger

type Logger interface {
	// Debug writes a string synchronously without formatting using Debug level.
	Debug(s string)

	// Info writes a string synchronously without formatting using Info level.
	Info(s string)

	// Warning writes a string synchronously without formatting using Warning level.
	Warning(s string)

	// Error writes a string synchronously without formatting using Error level.
	Error(s string)

	// Critical writes a string synchronously without formatting using Critical level.
	Critical(s string)

	// Debugf formats its arguments analogous to fmt.Printf and records the text as a log
	// message at Debug level.  If dvid.Verbose is not true, these logs aren't written.
	// Messages are sent through a buffered channel to make logging more asynchronous.
	Debugf(format string, args ...interface{})

	// Infof is like Debugf, but at Info level and will be written regardless if not in
	// verbose mode.
	Infof(format string, args ...interface{})

	// Warningf is like Debugf, but at Warning level.
	Warningf(format string, args ...interface{})

	// Errorf is like Debugf, but at Error level.
	Errorf(format string, args ...interface{})

	// Criticalf is like Debugf, but at Critical level.
	Criticalf(format string, args ...interface{})

	// Shutdown makes sure logs are closed.
	Shutdown()
}

Logger provides a way for the application to log messages at different severities. Implementations will vary if the app is in the cloud or on a local server.

type ModInfo

type ModInfo struct {
	User string
	App  string
	Time string
}

ModInfo gives a user, app and time for a modification

func GetModInfo

func GetModInfo(r *http.Request) ModInfo

GetModInfo sets and returns a ModInfo using "u" query string.

func (ModInfo) String added in v0.9.17

func (info ModInfo) String() string

type ModeFlag

type ModeFlag uint
const (
	DebugMode ModeFlag = iota
	InfoMode
	WarningMode
	ErrorMode
	CriticalMode
	SilentMode
)

type NdFloat32

type NdFloat32 []float32

NdFloat32 is an N-dimensional slice of float32

func StringToNdFloat32

func StringToNdFloat32(str, separator string) (nd NdFloat32, err error)

Parse a string of format "%f,%f,%f,..." into a slice of float32.

func (NdFloat32) Equals

func (n NdFloat32) Equals(n2 NdFloat32) bool

Equals returns true if two NdFloat32 are equal for each component.

func (NdFloat32) GetMax

func (n NdFloat32) GetMax() float32

GetMax returns the maximum element of the N-dimensional float.

func (NdFloat32) GetMin

func (n NdFloat32) GetMin() float32

GetMin returns the minimum element of the N-dimensional float.

func (NdFloat32) MultScalar

func (n NdFloat32) MultScalar(x float32) NdFloat32

MultScalar multiples a N-dimensional float by a float32

func (NdFloat32) String

func (n NdFloat32) String() string

type NdString

type NdString []string

NdString is an N-dimensional slice of strings

func StringToNdString

func StringToNdString(str, separator string) (nd NdString, err error)

Parse a string of format "%f,%f,%f,..." into a slice of float32.

func (NdString) ChunkPoint3d

func (n NdString) ChunkPoint3d() (p ChunkPoint3d, err error)

func (NdString) Point2d

func (n NdString) Point2d() (p Point2d, err error)

func (NdString) Point3d

func (n NdString) Point3d() (p Point3d, err error)

func (NdString) PointNd

func (n NdString) PointNd() (PointNd, error)

type OptionalBounds

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

OptionalBounds holds optional bounds in X, Y, and Z. This differs from Extents in allowing optional min and max bounds along each dimension.

func OptionalBoundsFromQueryString

func OptionalBoundsFromQueryString(r *http.Request) (*OptionalBounds, error)

OptionalBoundsFromQueryString returns OptionalBounds from a set of query strings.

func (*OptionalBounds) Adjust

func (b *OptionalBounds) Adjust(minPt, maxPt *Point3d)

Adjust modifies the given minimum and maximum point to reflect additional optional bounds.

func (*OptionalBounds) BeyondZ

func (b *OptionalBounds) BeyondZ(pt ChunkPoint3d) bool

BeyondZ returns true if the given Z is beyond a set max Z bound.

func (*OptionalBounds) BoundedX

func (b *OptionalBounds) BoundedX() bool

BoundedX returns true if there is some bound set in the X dimension

func (*OptionalBounds) BoundedY

func (b *OptionalBounds) BoundedY() bool

BoundedY returns true if there is some bound set in the Y dimension

func (*OptionalBounds) BoundedZ

func (b *OptionalBounds) BoundedZ() bool

BoundedZ returns true if there is some bound set in the Z dimension

func (*OptionalBounds) Divide

func (b *OptionalBounds) Divide(pt Point3d) *OptionalBounds

Divide returns a new bounds that has all optionally set bounds divided by the given point.

func (*OptionalBounds) IsSet

func (b *OptionalBounds) IsSet() bool

IsSet returns true if at least one bound in some dimension has been set.

func (*OptionalBounds) MaxX

func (b *OptionalBounds) MaxX() (x int32, ok bool)

func (*OptionalBounds) MaxY

func (b *OptionalBounds) MaxY() (y int32, ok bool)

func (*OptionalBounds) MaxZ

func (b *OptionalBounds) MaxZ() (z int32, ok bool)

func (*OptionalBounds) MinX

func (b *OptionalBounds) MinX() (x int32, ok bool)

func (*OptionalBounds) MinY

func (b *OptionalBounds) MinY() (y int32, ok bool)

func (*OptionalBounds) MinZ

func (b *OptionalBounds) MinZ() (z int32, ok bool)

func (*OptionalBounds) Outside

func (b *OptionalBounds) Outside(pt ChunkPoint3d) bool

Outside returns true if the given chunk point is outside any set bound.

func (*OptionalBounds) OutsideX

func (b *OptionalBounds) OutsideX(x int32) bool

OutsideX returns true if the given X is outside a set X bound.

func (*OptionalBounds) OutsideY

func (b *OptionalBounds) OutsideY(y int32) bool

OutsideY returns true if the given Y is outside a set Y bound.

func (*OptionalBounds) OutsideZ

func (b *OptionalBounds) OutsideZ(z int32) bool

OutsideZ returns true if the given Z is outside a set Z bound.

func (*OptionalBounds) SetMaxX

func (b *OptionalBounds) SetMaxX(x int32)

func (*OptionalBounds) SetMaxY

func (b *OptionalBounds) SetMaxY(y int32)

func (*OptionalBounds) SetMaxZ

func (b *OptionalBounds) SetMaxZ(z int32)

func (*OptionalBounds) SetMinX

func (b *OptionalBounds) SetMinX(x int32)

func (*OptionalBounds) SetMinY

func (b *OptionalBounds) SetMinY(y int32)

func (*OptionalBounds) SetMinZ

func (b *OptionalBounds) SetMinZ(z int32)

func (*OptionalBounds) String

func (b *OptionalBounds) String() string

type OrthogSlice

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

OrthogSlice is a 2d rectangle orthogonal to two axis of the space that is slices. It fulfills a Geometry interface.

func (OrthogSlice) DataShape

func (s OrthogSlice) DataShape() DataShape

func (OrthogSlice) Duplicate

func (s OrthogSlice) Duplicate() OrthogSlice

func (OrthogSlice) EndPoint

func (s OrthogSlice) EndPoint() Point

func (OrthogSlice) NumVoxels

func (s OrthogSlice) NumVoxels() int64

func (*OrthogSlice) SetSize

func (s *OrthogSlice) SetSize(size Point2d)

func (OrthogSlice) Size

func (s OrthogSlice) Size() Point

func (OrthogSlice) StartPoint

func (s OrthogSlice) StartPoint() Point

func (OrthogSlice) String

func (s OrthogSlice) String() string

type Point

type Point interface {
	SimplePoint

	// CheckedValue returns the point's value for the specified dimension and checks dim bounds.
	CheckedValue(dim uint8) (int32, error)

	// Duplicate returns a copy of the point.
	Duplicate() Point

	// Modify returns a copy of the point with the given (dim, value) components modified.
	Modify(map[uint8]int32) Point

	// AddScalar adds a scalar value to this point.
	AddScalar(int32) Point

	// DivScalar divides this point by a scalar value.
	DivScalar(int32) Point

	// Add returns the addition of two points.
	Add(Point) Point

	// Sub returns the subtraction of the passed point from the receiver.
	Sub(Point) Point

	// Mod returns a point where each component is the receiver modulo the passed point's components.
	Mod(Point) Point

	// Div returns the division of the receiver by the passed point.
	Div(Point) Point

	// Mult returns the multiplication of the receiver by the passed point.
	Mult(Point) Point

	// Max returns a Point where each of its elements are the maximum of two points' elements.
	Max(Point) (Point, bool)

	// Min returns a Point where each of its elements are the minimum of two points' elements.
	Min(Point) (Point, bool)

	// Distance returns the integer distance (rounding down).
	Distance(Point) int32

	// Prod returns the product of the point elements.
	Prod() int64

	String() string
}

Point is an interface for n-dimensional points. Types that implement the interface can optimize for particular dimensionality.

func NewPoint

func NewPoint(values []int32) (Point, error)

NewPoint returns an appropriate Point implementation for the number of dimensions passed in.

func SliceToPoint

func SliceToPoint(coord []int32) (p Point, err error)

Convert a slice of int32 into an appropriate Point implementation.

func StringToPoint

func StringToPoint(str, separator string) (p Point, err error)

StringToPoint parses a string of format "%d<sep>%d<sep>%d..." into a Point

type Point2d

type Point2d [2]int32

Point2d is a 2d point.

func RectSize

func RectSize(rect image.Rectangle) (size Point2d)

RectSize returns the size of a rectangle as a Point2d.

func StringToPoint2d

func StringToPoint2d(str, separator string) (Point2d, error)

StringToPoint2d parses a string of format "%d<sep>%d,..." into a Point2d

func (Point2d) Add

func (p Point2d) Add(x Point) Point

Add returns the addition of two points.

func (Point2d) AddScalar

func (p Point2d) AddScalar(value int32) Point

AddScalar adds a scalar value to this point.

func (Point2d) CheckedValue

func (p Point2d) CheckedValue(dim uint8) (int32, error)

CheckedValue returns the point's value for the specified dimension and checks dim bounds.

func (Point2d) Chunk

func (p Point2d) Chunk(size Point) ChunkPoint

Chunk returns the chunk space coordinate of the chunk containing the point.

func (Point2d) Distance

func (p Point2d) Distance(x Point) int32

Distance returns the integer distance (rounding down).

func (Point2d) Div

func (p Point2d) Div(x Point) (result Point)

Div returns the division of the receiver by the passed point.

func (Point2d) DivScalar

func (p Point2d) DivScalar(value int32) Point

DivScalar divides this point by a scalar value.

func (Point2d) Duplicate

func (p Point2d) Duplicate() Point

Duplicate returns a copy of the point without any pointer references.

func (Point2d) Max

func (p Point2d) Max(x Point) (Point, bool)

Max returns a Point where each of its elements are the maximum of two points' elements.

func (Point2d) Min

func (p Point2d) Min(x Point) (Point, bool)

Min returns a Point where each of its elements are the minimum of two points' elements.

func (Point2d) Mod

func (p Point2d) Mod(x Point) (result Point)

Mod returns a point where each component is the receiver modulo the passed point's components.

func (Point2d) Modify

func (p Point2d) Modify(settings map[uint8]int32) Point

Modify returns a copy of the point with the given (dim, value) components modified.

func (Point2d) Mult

func (p Point2d) Mult(x Point) (result Point)

Mult returns the multiplication of the receiver by the passed point.

func (Point2d) NumDims

func (p Point2d) NumDims() uint8

NumDims returns the dimensionality of this point.

func (Point2d) PointInChunk

func (p Point2d) PointInChunk(size Point) Point

PointInChunk returns a point in containing block (chunk) space for the given point.

func (Point2d) Prod

func (p Point2d) Prod() int64

func (Point2d) String

func (pt Point2d) String() string

func (Point2d) Sub

func (p Point2d) Sub(x Point) Point

Sub returns the subtraction of the passed point from the receiver.

func (Point2d) Value

func (p Point2d) Value(dim uint8) int32

Value returns the point's value for the specified dimension without checking dim bounds.

type Point3d

type Point3d [3]int32

Point3d is an ordered list of three 32-bit signed integers that implements the Point interface.

func GetPoint3dFrom2d

func GetPoint3dFrom2d(plane DataShape, p2d Point2d, fill int32) (Point3d, error)

GetPoint3dFrom2d returns a 3d point from a 2d point in a plane. The fill is used for the dimension not on the plane.

func StringToPoint3d

func StringToPoint3d(str, separator string) (Point3d, error)

StringToPoint3d parses a string of format "%d<sep>%d<sep>%d,..." into a Point3d

func (Point3d) Add

func (p Point3d) Add(x Point) Point

Add returns the addition of two points.

func (Point3d) Add3d

func (p Point3d) Add3d(p2 Point3d) Point3d

Add3d returns the addition of a Point3d.

func (Point3d) AddScalar

func (p Point3d) AddScalar(value int32) Point

AddScalar adds a scalar value to this point.

func (Point3d) Bytes

func (p Point3d) Bytes() []byte

Bytes returns a byte representation of the Point3d in little endian format.

func (Point3d) CheckedValue

func (p Point3d) CheckedValue(dim uint8) (int32, error)

CheckedValue returns the point's value for the specified dimension and checks dim bounds.

func (Point3d) Chunk

func (p Point3d) Chunk(size Point) ChunkPoint

Chunk returns the chunk space coordinate of the chunk containing the point.

func (Point3d) ChunkIndexer

func (p Point3d) ChunkIndexer(size Point3d) ChunkIndexer

ChunkIndexer returns an chunk indexer from a 3d point.

func (Point3d) Distance

func (p Point3d) Distance(x Point) int32

Distance returns the integer distance (rounding down).

func (Point3d) Div

func (p Point3d) Div(x Point) (result Point)

Div returns the division of the receiver by the passed point.

func (Point3d) DivScalar

func (p Point3d) DivScalar(value int32) Point

DivScalar divides this point by a scalar value.

func (Point3d) Duplicate

func (p Point3d) Duplicate() Point

Duplicate returns a copy of the point without any pointer references.

func (Point3d) Equals

func (p Point3d) Equals(p2 Point3d) bool

func (Point3d) Expand2d

func (p Point3d) Expand2d(plane DataShape, size Point2d) (Point3d, error)

Expand2d returns a 3d point increased by given size in the given plane

func (*Point3d) FromZYXBytes

func (p *Point3d) FromZYXBytes(zyx []byte) error

FromZYXBytes sets a point from an encoded slice.

func (Point3d) Less

func (p Point3d) Less(p2 Point3d) bool

func (Point3d) MapKey

func (p Point3d) MapKey() string

func (Point3d) Max

func (p Point3d) Max(x Point) (Point, bool)

Max returns a Point where each of its elements are the maximum of two points' elements.

func (Point3d) Min

func (p Point3d) Min(x Point) (Point, bool)

Min returns a Point where each of its elements are the minimum of two points' elements.

func (Point3d) Mod

func (p Point3d) Mod(x Point) (result Point)

Mod returns a point where each component is the receiver modulo the passed point's components.

func (Point3d) Modify

func (p Point3d) Modify(settings map[uint8]int32) Point

Modify returns a copy of the point with the given (dim, value) components modified.

func (Point3d) Mult

func (p Point3d) Mult(x Point) (result Point)

Div returns the multiplication of the receiver by the passed point.

func (Point3d) NumDims

func (p Point3d) NumDims() uint8

NumDims returns the dimensionality of this point.

func (Point3d) Point3dInChunk

func (p Point3d) Point3dInChunk(size Point3d) Point3d

Point3dInChunk returns a point in containing block (chunk) space for the given point.

func (Point3d) PointFromBytes

func (p Point3d) PointFromBytes(b []byte) (readPt Point3d, err error)

PointFromBytes returns a Point3d from bytes. The passed point is used just to choose the appropriate byte decoding scheme.

func (Point3d) PointInChunk

func (p Point3d) PointInChunk(size Point) Point

PointInChunk returns a point in containing block (chunk) space for the given point.

func (Point3d) Prod

func (p Point3d) Prod() int64

func (*Point3d) SetMaximum

func (p *Point3d) SetMaximum(p2 Point3d)

SetMaximum sets the point to the maximum elements of current and passed points.

func (*Point3d) SetMinimum

func (p *Point3d) SetMinimum(p2 Point3d)

SetMinimum sets the point to the minimum elements of current and passed points.

func (Point3d) String

func (p Point3d) String() string

func (Point3d) Sub

func (p Point3d) Sub(x Point) Point

Sub returns the subtraction of the passed point from the receiver.

func (Point3d) ToBlockIZYXString

func (p Point3d) ToBlockIZYXString(size Point3d) IZYXString

ToBlockIZYXString returns an encoded string for a point's block, suitable for use in maps.

func (Point3d) ToZYXBytes

func (p Point3d) ToZYXBytes() []byte

ToZYXBytes returns the point in a byte slice format suitable for use as a map index, etc.

func (Point3d) Value

func (p Point3d) Value(dim uint8) int32

Value returns the point's value for the specified dimension without checking dim bounds.

type PointNd

type PointNd []int32

PointNd is a slice of N 32-bit signed integers that implements the Point interface.

func StringToPointNd

func StringToPointNd(str, separator string) (nd PointNd, err error)

StringToPointNd parses a string of format "%d,%d,%d,..." into a slice of int32.

func (PointNd) Add

func (p PointNd) Add(x Point) Point

Add returns the addition of two points.

func (PointNd) AddScalar

func (p PointNd) AddScalar(value int32) Point

AddScalar adds a scalar value to this point.

func (PointNd) CheckedValue

func (p PointNd) CheckedValue(dim uint8) (int32, error)

CheckedValue returns the point's value for the specified dimension and checks dim bounds.

func (PointNd) Chunk

func (p PointNd) Chunk(size Point) ChunkPoint

Chunk returns the chunk space coordinate of the chunk containing the point.

func (PointNd) Distance

func (p PointNd) Distance(x Point) int32

Distance returns the integer distance (rounding down).

func (PointNd) Div

func (p PointNd) Div(x Point) Point

Div returns the division of the receiver by the passed point.

func (PointNd) DivScalar

func (p PointNd) DivScalar(value int32) Point

DivScalar divides this point by a scalar value.

func (PointNd) Duplicate

func (p PointNd) Duplicate() Point

Duplicate returns a copy of the point without any pointer references.

func (PointNd) Max

func (p PointNd) Max(x Point) (Point, bool)

Max returns a Point where each of its elements are the maximum of two points' elements.

func (PointNd) Min

func (p PointNd) Min(x Point) (Point, bool)

Min returns a Point where each of its elements are the minimum of two points' elements.

func (PointNd) Mod

func (p PointNd) Mod(x Point) Point

Mod returns a point where each component is the receiver modulo the passed point's components.

func (PointNd) Modify

func (p PointNd) Modify(settings map[uint8]int32) Point

Modify returns a copy of the point with the given (dim, value) components modified.

func (PointNd) Mult

func (p PointNd) Mult(x Point) Point

Div returns the multiplication of the receiver by the passed point.

func (PointNd) NumDims

func (p PointNd) NumDims() uint8

NumDims returns the dimensionality of this point.

func (PointNd) PointInChunk

func (p PointNd) PointInChunk(size Point) Point

PointInChunk returns a point in containing block (chunk) space for the given point.

func (PointNd) Prod

func (p PointNd) Prod() int64

func (PointNd) String

func (p PointNd) String() string

func (PointNd) Sub

func (p PointNd) Sub(x Point) Point

Sub returns the subtraction of the passed point from the receiver.

func (PointNd) Value

func (p PointNd) Value(dim uint8) int32

Value returns the point's value for the specified dimension without checking dim bounds.

type RLE

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

RLE is a single run-length encoded span with a start coordinate and length along a coordinate (typically X).

func NewRLE

func NewRLE(start Point3d, length int32) RLE

func (RLE) Excise

func (rle RLE) Excise(rle2 RLE) RLEs

Excise returns the portion of the receiver that is not in the passed RLE. If the RLEs do not intersect, nil is returned. Up to two fragments can be generated and they will be in sorted in start X.

func (*RLE) Extend

func (rle *RLE) Extend(n int32)

func (RLE) GetRangeIZYXString

func (rle RLE) GetRangeIZYXString() (beg, end IZYXString)

func (RLE) Intersects

func (rle RLE) Intersects(rle2 RLE) bool

func (RLE) Length

func (rle RLE) Length() int32

func (RLE) Less

func (rle RLE) Less(rle2 RLE) bool

func (RLE) MarshalBinary

func (rle RLE) MarshalBinary() ([]byte, error)

MarshalBinary fulfills the encoding.BinaryMarshaler interface.

func (RLE) StartPt

func (rle RLE) StartPt() Point3d

func (RLE) String

func (rle RLE) String() string

func (*RLE) UnmarshalBinary

func (rle *RLE) UnmarshalBinary(b []byte) error

UnmarshalBinary fulfills the encoding.BinaryUnmarshaler interface.

func (RLE) Within

func (rle RLE) Within(pt Point3d) bool

func (RLE) WriteTo

func (rle RLE) WriteTo(w io.Writer) (n int64, err error)

WriteTo fulfills the io.WriterTo interface.

type RLEs

type RLEs []RLE

RLEs are simply a slice of RLE. Sorting only takes into account the start point and not the length.

func ReadRLEs

func ReadRLEs(r io.Reader) (RLEs, error)

func (*RLEs) Add

func (rles *RLEs) Add(rles2 RLEs) (voxelsAdded int64)

Add adds the given RLEs to the receiver when there's a possibility of overlapping RLEs. If you are guaranteed the RLEs are disjoint, e.g., the passed and receiver RLEs are in different subvolumes, then just concatenate the RLEs instead of calling this function. The returned "voxelsAdded" gives the # of non-overlapping voxels added. TODO: If this is a bottleneck, employ better than this brute force insertion method.

func (RLEs) FitToBounds

func (rles RLEs) FitToBounds(bounds *OptionalBounds) RLEs

FitToBounds returns a copy that has been adjusted to fit within the given optional bounds.

func (RLEs) Len

func (rles RLEs) Len() int

func (RLEs) Less

func (rles RLEs) Less(i, j int) bool

func (RLEs) MarshalBinary

func (rles RLEs) MarshalBinary() ([]byte, error)

MarshalBinary fulfills the encoding.BinaryMarshaler interface.

func (RLEs) Normalize

func (rles RLEs) Normalize() RLEs

Normalize returns a sorted slice of RLEs where there are no directly adjacent RLEs along X.

func (RLEs) Offset

func (rles RLEs) Offset(offset Point3d) (out RLEs)

Offset returns RLEs that have been offset by negative of given point.

func (RLEs) Partition

func (rles RLEs) Partition(blockSize Point3d) (BlockRLEs, error)

Partition splits RLEs up into block-sized RLEs using the given block size. The return is a map of RLEs with stringified ZYX block coordinate keys.

func (RLEs) Split

func (rles RLEs) Split(splits RLEs) (RLEs, error)

Split removes RLEs, which must be a subset of current RLEs, from the receiver and returns the remainder.

func (RLEs) Stats

func (rles RLEs) Stats() (numVoxels uint64, numRuns int32)

Stats returns the total number of voxels and runs.

func (RLEs) Swap

func (rles RLEs) Swap(i, j int)

func (*RLEs) UnmarshalBinary

func (rles *RLEs) UnmarshalBinary(b []byte) error

UnmarshalBinary fulfills the encoding.BinaryUnmarshaler interface.

func (*RLEs) UnmarshalBinaryReader

func (rles *RLEs) UnmarshalBinaryReader(r io.Reader, numRLEs uint32) error

UnmarshalBinaryReader reads from a reader instead of a static slice of bytes. This will likely be more efficient for very large RLEs that are being streamed into the server.

func (RLEs) Within

func (rles RLEs) Within(pts []Point3d) (in []int)

Within returns a slice of indices to the given pts that are within the RLEs.

type RepoID

type RepoID LocalID32

RepoID is a DVID server-specific identifier for a particular Repo. Valid RepoIDs should be greater than 0.

func RepoIDFromBytes

func RepoIDFromBytes(b []byte) RepoID

RepoIDFromBytes returns a RepoID from the start of the slice and the number of bytes used. Note: No error checking is done to ensure byte slice has sufficient bytes for RepoID.

func (RepoID) Bytes

func (id RepoID) Bytes() []byte

Bytes returns a sequence of bytes encoding this RepoID. Binary representation is big-endian to preserve lexicographic order.

type Resolution

type Resolution struct {
	// Resolution of voxels in volume
	VoxelSize NdFloat32

	// Units of resolution, e.g., "nanometers"
	VoxelUnits NdString
}

func (Resolution) IsIsotropic

func (r Resolution) IsIsotropic() bool

IsIsotropic returns true if resolution in all dimensions is equal.

func (Resolution) Set3dNanometers

func (r Resolution) Set3dNanometers(pt Point3d)

Set3dNanometers sets a resolution to the given pt with "nanometers" units

func (Resolution) Set3dNanometersFloat added in v0.9.17

func (r Resolution) Set3dNanometersFloat(res [3]float64)

Set3dNanometers sets a resolution to the given pt with "nanometers" units

type Response

type Response struct {
	ContentType string
	Text        string
	Status      string
}

Response provides a few string fields to pass information back from a remote operation.

type SerializationFormat

type SerializationFormat uint8

SerializationFormat combines both compression and checksum methods. First 3 bits specifies compression, next 2 bits is the checkum, and the final 3 bits is reserved for future use.

func EncodeSerializationFormat

func EncodeSerializationFormat(compress Compression, checksum Checksum) SerializationFormat

type SimplePoint

type SimplePoint interface {
	// NumDims returns the dimensionality of this point.
	NumDims() uint8

	// Value returns the point's value for the specified dimension without checking dim bounds.
	Value(dim uint8) int32
}

type Span

type Span [4]int32

Span is (Z, Y, X0, X1). TODO -- Consolidate with dvid.RLE since both handle run-length encodings in X, although dvid.RLE handles voxel coordinates not block (chunk) coordinates.

func (*Span) Extends

func (s *Span) Extends(x, y, z int32) bool

Extends returns true and modifies the span if the given point is one more in x direction than this span. Else it returns false.

func (Span) Includes

func (s Span) Includes(block ChunkPoint3d) bool

func (Span) Less

func (s Span) Less(s2 Span) bool

func (Span) LessChunkPoint3d

func (s Span) LessChunkPoint3d(block ChunkPoint3d) bool

func (Span) String

func (s Span) String() string

func (Span) Unpack

func (s Span) Unpack() (z, y, x0, x1 int32)

type Spans

type Spans []Span

Spans is a slice of Span

func (Spans) Blocks

func (s Spans) Blocks(size Point3d) IZYXSlice

Blocks returns an unsorted list of blocks spanned by the spans.

func (Spans) Count

func (s Spans) Count() uint64

Count returns the number of elements spanned by the spans.

func (Spans) Extents

func (s Spans) Extents() (offset, size Point3d)

Extents returns the offset and size of the bounding box traversed by the receiver Spans.

func (Spans) Len

func (s Spans) Len() int

func (Spans) Less

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

func (Spans) MarshalBinary

func (s Spans) MarshalBinary() ([]byte, error)

MarshalBinary implements the encoding.BinaryMarshaler interface. It returns a binary serialization of the RLEs for the spans with the first 4 bytes corresponding to the number of spans.

func (Spans) Normalize

func (s Spans) Normalize() Spans

Normalize returns a sorted and merged list of Span. Spans are in z, y, then x order. Any adjacent spans are merged into a larger span.

func (Spans) Swap

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

func (*Spans) UnmarshalBinary

func (s *Spans) UnmarshalBinary(b []byte) error

UnmarshalBinary implements the encoding.BinaryUnmarshaler interface

func (Spans) VoxelCounts

func (s Spans) VoxelCounts(size Point3d) map[IZYXString]uint32

VoxelCounts returns a map of blocks spanned by the spans and the number of voxels within each block encompassed by spans.

type SparseVol

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

SparseVol represents a collection of voxels that may be in an arbitrary shape and have a label. It is particularly good for storing sparse voxels that may traverse large amounts of space.

func (*SparseVol) AddRLE

func (vol *SparseVol) AddRLE(rles RLEs)

AddRLE adds an RLE to a SparseVol.

func (*SparseVol) AddSerializedRLEs

func (vol *SparseVol) AddSerializedRLEs(encoding []byte) error

AddSerializedRLEs adds binary encoding of RLEs to SparseVol.

func (*SparseVol) Clear

func (vol *SparseVol) Clear()

func (*SparseVol) Label

func (vol *SparseVol) Label() uint64

func (*SparseVol) MaximumPoint3d

func (vol *SparseVol) MaximumPoint3d() Point3d

func (*SparseVol) MinimumPoint3d

func (vol *SparseVol) MinimumPoint3d() Point3d

func (*SparseVol) NumVoxels

func (vol *SparseVol) NumVoxels() uint64

func (*SparseVol) RLEs

func (vol *SparseVol) RLEs() RLEs

func (*SparseVol) SetLabel

func (vol *SparseVol) SetLabel(label uint64)

func (*SparseVol) Size

func (vol *SparseVol) Size() Point3d

func (*SparseVol) SurfaceSerialization

func (vol *SparseVol) SurfaceSerialization(blockNz int32, res NdFloat32) ([]byte, error)

SurfaceSerialization returns binary-encoded surface data with the following format:

First 4 bytes (little-endian) # voxels (N)
Array of N vertices, each with 3 little-endian float32 (x,y,z)
Array of N normals, each with 3 little-endian float32 (nx,ny,nz)

The blockNz parameter is necessary since underlying RLEs in the SparseVol are ordered by blocks in Z but not within a block, so RLEs can have different Z within a block.

type Store

type Store interface {
	fmt.Stringer
	StoreCloser
	StoreIdentifiable

	GetStoreConfig() StoreConfig
}

Store allows polyglot persistence of data. The Store implementation could be an ordered key-value database, graph store, etc.

type StoreCloser

type StoreCloser interface {
	Close()
}

StoreCloser stores can be closed.

type StoreConfig

type StoreConfig struct {
	Config

	// Engine is a simple name describing the engine, e.g., "basholeveldb"
	Engine string
}

StoreConfig is a store-specific configuration where each store implementation defines the types of parameters it accepts.

type StoreIdentifiable

type StoreIdentifiable interface {
	// Equal returns true if this store matches the given store configuration.
	Equal(StoreConfig) bool
}

StoreIdentifiable stores can say whether they are identified by a given store configuration.

type Subsetter

type Subsetter interface {
	// MaximumExtents returns a range of indices for which data is available at
	// some DVID server.
	MaximumExtents() IndexRange

	// AvailableExtents returns a range of indices for which data is available
	// at this DVID server.  It is the currently available extents.
	AvailableExtents() IndexRange
}

Subsetter can tell us its range of Index and how much it has actually available in this server. It's used to implement limited cloning, e.g., only cloning a quarter of an image volume. TODO: Fulfill implementation for voxels data type.

type Subvolume

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

Subvolume describes a 3d box Geometry. The "Sub" prefix emphasizes that the data is usually a smaller portion of the volume held by the DVID datastore. Note that the 3d coordinate system is assumed to be a Right-Hand system like OpenGL.

func NewSubvolume

func NewSubvolume(offset, size Point) *Subvolume

NewSubvolume returns a Subvolume given a subvolume's origin and size.

func NewSubvolumeFromStrings

func NewSubvolumeFromStrings(offsetStr, sizeStr, sep string) (*Subvolume, error)

NewSubvolumeFromStrings returns a Subvolume given string representations of offset ("0,10,20") and size ("250,250,250").

func (*Subvolume) BoundingChunks

func (s *Subvolume) BoundingChunks(chunkSize Point) (minChunk, maxChunk ChunkPoint3d, err error)

BoundingChunks returns the min and max chunk coordinates that bound the subvolume

func (*Subvolume) DataShape

func (s *Subvolume) DataShape() DataShape

func (*Subvolume) EndPoint

func (s *Subvolume) EndPoint() Point

func (*Subvolume) NewIndexZYXIterator

func (s *Subvolume) NewIndexZYXIterator(chunkSize Point) (IndexIterator, error)

NewIndexZYXIterator returns an iterator that can move across subvolume.

func (*Subvolume) NumVoxels

func (s *Subvolume) NumVoxels() int64

func (*Subvolume) Size

func (s *Subvolume) Size() Point

func (*Subvolume) StartPoint

func (s *Subvolume) StartPoint() Point

func (*Subvolume) String

func (s *Subvolume) String() string

type TimeLog

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

TimeLog adds elapsed time to logging. Example:

mylog := NewTimeLog()
...
mylog.Debugf("stuff happened")  // Appends elapsed time from NewTimeLog() to message.

func NewTimeLog

func NewTimeLog() TimeLog

func (TimeLog) Criticalf

func (t TimeLog) Criticalf(format string, args ...interface{})

func (TimeLog) Debugf

func (t TimeLog) Debugf(format string, args ...interface{})

func (TimeLog) Errorf

func (t TimeLog) Errorf(format string, args ...interface{})

func (TimeLog) Infof

func (t TimeLog) Infof(format string, args ...interface{})

func (TimeLog) Shutdown

func (t TimeLog) Shutdown()

func (TimeLog) Warningf

func (t TimeLog) Warningf(format string, args ...interface{})

type TypeString

type TypeString string

TypeString is a string that is the name of a DVID data type.

type URLString

type URLString string

URLString is a string representing a URL.

type UUID

type UUID string

UUID is a 32 character hexidecimal string (a RFC4122 version 4 UUID) that uniquely identifies nodes in a datastore's DAG. We need universally unique identifiers to prevent collisions during creation of child nodes by distributed DVIDs: http://en.wikipedia.org/wiki/Universally_unique_identifier An empty string is an invalid (NilUUID).

func NewUUID

func NewUUID() UUID

NewUUID returns a UUID

func StringToUUID

func StringToUUID(s string) (UUID, error)

StringToUUID converts a string to a UUID, checking to make sure it is a 32 character hex string.

type UUIDSet

type UUIDSet map[UUID]struct{}

UUIDSet is a set of UUIDs.

func (UUIDSet) Add

func (uset UUIDSet) Add(uset2 UUIDSet)

Add adds a given UUIDSet to the receiver.

func (UUIDSet) Equals

func (uset UUIDSet) Equals(uset2 UUIDSet) bool

Equals returns true if the two UUIDSets have the same elements.

type Vector3d

type Vector3d [3]float64

Vector3d is a 3D vector of 64-bit floats, a recommended type for math operations.

func StringToVector3d

func StringToVector3d(str, separator string) (Vector3d, error)

func (Vector3d) Add

func (v Vector3d) Add(x Vector3d) Vector3d

func (Vector3d) Distance

func (v Vector3d) Distance(x Vector3d) float64

Distance returns the distance between two points a and b.

func (Vector3d) DivideScalar

func (v Vector3d) DivideScalar(x float64) Vector3d

func (*Vector3d) Increment

func (v *Vector3d) Increment(x Vector3d)

func (Vector3d) String

func (v Vector3d) String() string

func (Vector3d) Subtract

func (v Vector3d) Subtract(x Vector3d) Vector3d

type VersionID

type VersionID LocalID32

VersionID is a DVID server-specific identifier for a particular version or node of a repo's DAG. Valid VersionIDs should be greater than 0.

func VersionIDFromBytes

func VersionIDFromBytes(b []byte) VersionID

VersionIDFromBytes returns a VersionID from the start of the slice and the number of bytes used. Note: No error checking is done to ensure byte slice has sufficient bytes for VersionID.

func (VersionID) Bytes

func (id VersionID) Bytes() []byte

Bytes returns a sequence of bytes encoding this VersionID. Binary representation is big-endian to preserve lexicographic order.

type VersionMap

type VersionMap map[VersionID]VersionID

type VertexID

type VertexID uint64

VertexID is a 64 bit label ID for vertices in the graph

type VertexPairID

type VertexPairID struct {
	Vertex1 VertexID
	Vertex2 VertexID
}

smaller ID should be first

Jump to

Keyboard shortcuts

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