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
- Variables
- func AliasByteToUint16(b []byte) ([]uint16, error)
- func AliasByteToUint32(b []byte) ([]uint32, error)
- func AliasByteToUint64(b []byte) (out []uint64, err error)
- func AliasUint16ToByte(in []uint16) []byte
- func AliasUint32ToByte(in []uint32) []byte
- func AliasUint64ToByte(in []uint64) []byte
- func AllowRequests()
- func BlockAligned(geom Bounder, blockSize Point) bool
- func BlockOnActiveCgo()
- func ByteToUint64(b []byte) (out []uint64, err error)
- func ConvertToAbsolute(relativePath string, anchorDir string) (string, error)
- func Criticalf(format string, args ...interface{})
- func DataFromPost(r *http.Request, key string) ([]byte, error)
- func DataTypeBytes(t DataType) int32
- func Debugf(format string, args ...interface{})
- func DecodeSerializationFormat(s SerializationFormat) (CompressionFormat, Checksum)
- func DenyRequests()
- func Deserialize(s []byte, object interface{}) error
- func EmptyValue() []byte
- func Errorf(format string, args ...interface{})
- func EstimateGoroutines(percentCPUs float64, goroutineMB int32) int
- func GetNumBlocks(geom Geometry, blockSize Point) int
- func GoImageFromData(data []byte, nx, ny int) (image.Image, error)
- func GoImageFromFile(filename string) (image.Image, string, error)
- func ImageData(img image.Image) (data []uint8, bytesPerPixel, stride int32, err error)
- func ImageGrayFromData(data []uint8, nx, ny int) (img *image.Gray)
- func ImageNRGBA64FromData(data []byte, nx, ny int) (img *image.NRGBA64)
- func Infof(format string, args ...interface{})
- func ListDataShapes() (shapes []string)
- func LogImmediately(s string)
- func MakeGzipHandler(fn http.HandlerFunc) http.HandlerFunc
- func MaxInt32(a, b int32) int32
- func MinInt32(a, b int32) int32
- func New8ByteAlignBytes(numBytes uint32) ([]byte, []uint64)
- func NumberActiveCGo() int
- func PendingLogMessages() int
- func PlaceholderImage(shape DataShape, imageSize Point, message string) (image.Image, error)
- func PrintNonZero(message string, value []byte)
- func RandomBytes(numBytes int32) []byte
- func ReadJSONFile(filename string) (value map[string]interface{}, err error)
- func ReportPanic(msg, sendingServer string)
- func RequestsOK() bool
- func SendEmail(subject, message string, recipients []string, periodicTopic string) error
- func SendHTTP(w http.ResponseWriter, r *http.Request, name string, data []byte)
- func Serialize(object interface{}, compress Compression, checksum Checksum) ([]byte, error)
- func SerializeData(data []byte, compress Compression, checksum Checksum) ([]byte, error)
- func SerializePrecompressedData(data []byte, compress Compression, checksum Checksum) ([]byte, error)
- func SetEmailServer(e EmailConfig)
- func SetImageHeader(w http.ResponseWriter, formatStr string) error
- func SetLogMode(newMode ModeFlag)
- func Shutdown()
- func StartCgo()
- func StopCgo()
- func SupportsGzipEncoding(r *http.Request) bool
- func TimeCriticalf(format string, args ...interface{})
- func TimeDebugf(format string, args ...interface{})
- func TimeErrorf(format string, args ...interface{})
- func TimeInfof(format string, args ...interface{})
- func TimeWarningf(format string, args ...interface{})
- func Warningf(format string, args ...interface{})
- func WriteGzip(gzipData []byte, w http.ResponseWriter, r *http.Request) error
- func WriteImageHttp(w http.ResponseWriter, img image.Image, formatStr string) error
- func WriteJSONFile(filename string, value interface{}) error
- type AutoInstanceStore
- type Axis
- type BinaryVolume
- type BlockCounts
- type BlockRLEs
- type Bool
- type Bounder
- type Bounds
- type ByZYX
- type Checksum
- type ChunkExtents3d
- type ChunkIndexer
- type ChunkPoint
- type ChunkPoint2d
- type ChunkPoint3d
- func (c ChunkPoint3d) BoundingVoxels(blockSize Point3d) (minBlockVoxel, maxBlockVoxel Point3d)
- func (c ChunkPoint3d) Equals(c2 ChunkPoint3d) bool
- func (c ChunkPoint3d) MaxPoint(size Point) Point
- func (c ChunkPoint3d) MinPoint(size Point) Point
- func (c ChunkPoint3d) NumDims() uint8
- func (p *ChunkPoint3d) SetMaximum(p2 ChunkPoint3d)
- func (p *ChunkPoint3d) SetMinimum(p2 ChunkPoint3d)
- func (c ChunkPoint3d) String() string
- func (p ChunkPoint3d) ToIZYXString() IZYXString
- func (c ChunkPoint3d) Value(dim uint8) int32
- type ChunkPointNd
- type ChunkSizer
- type Chunkable
- type ClientID
- type Command
- func (cmd Command) Argument(pos int) string
- func (cmd Command) CommandArgs(startPos int, targets ...*string) []string
- func (cmd Command) FilenameArgs(startPos int, targets ...*string) (filenames []string, err error)
- func (cmd Command) Name() string
- func (cmd Command) Setting(key string) (value string, found bool)
- func (cmd Command) Settings() Config
- func (cmd Command) String() string
- func (cmd Command) TypeCommand() string
- type Compression
- func (c Compression) Format() CompressionFormat
- func (c Compression) Level() CompressionLevel
- func (c Compression) MarshalBinary() ([]byte, error)
- func (c Compression) MarshalJSON() ([]byte, error)
- func (c Compression) String() string
- func (c *Compression) UnmarshalBinary(data []byte) error
- func (c *Compression) UnmarshalJSON(b []byte) error
- type CompressionFormat
- type CompressionLevel
- type Config
- func (c *Config) Clear()
- func (c *Config) Get(key string) (interface{}, bool)
- func (c Config) GetAll() map[string]interface{}
- func (c Config) GetBool(key string) (value, found bool, err error)
- func (c Config) GetInt(key string) (i int, found bool, err error)
- func (c Config) GetRange(key, separator string) (*int32, *int32, error)
- func (c Config) GetShapes(key, separator string) ([]DataShape, error)
- func (c Config) GetString(key string) (s string, found bool, err error)
- func (c Config) MarshalJSON() ([]byte, error)
- func (c *Config) Remove(keys ...string)
- func (c *Config) Set(key string, value interface{})
- func (c *Config) SetAll(kv map[string]interface{})
- func (c *Config) SetByJSON(jsonData io.Reader) error
- type Data
- type DataID
- type DataSetter
- type DataShape
- func (s DataShape) AxisName(axis uint8) string
- func (s DataShape) Bytes() []byte
- func (s DataShape) ChunkPoint3d(p, size Point) (ChunkPoint3d, error)
- func (s DataShape) Duplicate() DataShape
- func (s DataShape) Equals(s2 DataShape) bool
- func (s DataShape) GetFloat2D(fslice NdFloat32) (x, y float32, err error)
- func (s DataShape) GetSize2D(size SimplePoint) (width, height int32, err error)
- func (s DataShape) PlaneToChunkPoint3d(x, y int32, offset, size Point) (ChunkPoint3d, error)
- func (s DataShape) ShapeDimension(axis uint8) (uint8, error)
- func (s DataShape) ShapeDimensions() int8
- func (s DataShape) String() string
- func (s DataShape) TotalDimensions() int8
- type DataShapeString
- type DataShapes
- type DataSpecifier
- type DataType
- type DataValue
- type DataValues
- func (values DataValues) AverageData(src, dst []byte, srcW, dstW, dstH, reduceW, reduceH int32)
- func (values DataValues) BytesPerElement() int32
- func (values DataValues) BytesPerValue() (int32, error)
- func (values DataValues) MarshalBinary() ([]byte, error)
- func (values *DataValues) UnmarshalBinary(b []byte) error
- func (values DataValues) ValueBytes(n int) int32
- func (values DataValues) ValueDataType() (DataType, error)
- func (values DataValues) ValuesPerElement() int32
- type Dimension
- type DirtyBlocks
- type ElementProperties
- type EmailConfig
- type Extents
- type Extents3d
- type Filename
- type Geometry
- type GraphEdge
- type GraphElement
- type GraphVertex
- type Hashable
- type IZYXSlice
- func (i *IZYXSlice) Delete(i2 IZYXSlice)
- func (i IZYXSlice) Downres(scale uint8) (IZYXSlice, error)
- func (i IZYXSlice) FitToBounds(bounds *OptionalBounds) (IZYXSlice, error)
- func (i IZYXSlice) GetBounds() (minPt, maxPt Point3d, err error)
- func (i IZYXSlice) Len() int
- func (i IZYXSlice) Less(a, b int) bool
- func (i IZYXSlice) MarshalBinary() ([]byte, error)
- func (i *IZYXSlice) Merge(i2 IZYXSlice)
- func (i IZYXSlice) MergeCopy(i2 IZYXSlice) IZYXSlice
- func (i IZYXSlice) Split(rm IZYXSlice) (IZYXSlice, error)
- func (i IZYXSlice) String() string
- func (i IZYXSlice) Swap(a, b int)
- func (i *IZYXSlice) UnmarshalBinary(b []byte) error
- func (i IZYXSlice) WriteSerializedRLEs(w io.Writer) (spans uint32, err error)
- type IZYXString
- func (i IZYXString) Halfres() (IZYXString, error)
- func (i IZYXString) Hash(n int) int
- func (i IZYXString) IndexZYX() (IndexZYX, error)
- func (i IZYXString) String() string
- func (i IZYXString) ToChunkPoint3d() (ChunkPoint3d, error)
- func (i IZYXString) Unpack() (x, y, z int32, err error)
- func (i IZYXString) VoxelOffset(chunkSize Point3d) (offset Point3d, err error)
- func (i IZYXString) Z() (int32, error)
- type Image
- func (img *Image) Bounds() image.Rectangle
- func (img *Image) Data() []uint8
- func (img *Image) DataPtr(x, y int32) ([]byte, error)
- func (img *Image) Deserialize(b []byte) error
- func (img Image) Get() image.Image
- func (img Image) GetDrawable() draw.Image
- func (img Image) GetJPEG(quality int) ([]byte, error)
- func (img Image) GetPNG() ([]byte, error)
- func (img *Image) InterpolateImage(dstW, dstH int) (image.Image, error)
- func (img *Image) MarshalBinary() ([]byte, error)
- func (img *Image) NumBytes() int32
- func (img *Image) ResizeImage(dstW, dstH int) (image.Image, error)
- func (img *Image) ScaleImage(dstW, dstH int) (*Image, error)
- func (img *Image) Serialize(compress Compression, checksum Checksum) ([]byte, error)
- func (img *Image) SubImage(r image.Rectangle) (*Image, error)
- func (img *Image) UnmarshalBinary(b []byte) error
- type Index
- type IndexBytes
- type IndexCZYX
- type IndexCZYXIterator
- type IndexHilbert
- type IndexIterator
- type IndexMorton
- type IndexRange
- type IndexString
- type IndexUint8
- type IndexZYX
- func (i *IndexZYX) Bytes() []byte
- func (i *IndexZYX) Duplicate() Index
- func (i *IndexZYX) DuplicateChunkIndexer() ChunkIndexer
- func (i *IndexZYX) Hash(n int) int
- func (i *IndexZYX) IndexFromBytes(b []byte) error
- func (i *IndexZYX) MarshalBinary() ([]byte, error)
- func (i *IndexZYX) Max(idx ChunkIndexer) (ChunkIndexer, bool)
- func (i *IndexZYX) MaxPoint(size Point) Point
- func (i *IndexZYX) Min(idx ChunkIndexer) (ChunkIndexer, bool)
- func (i *IndexZYX) MinPoint(size Point) Point
- func (i *IndexZYX) NumDims() uint8
- func (i *IndexZYX) Scheme() string
- func (i *IndexZYX) String() string
- func (i *IndexZYX) ToIZYXString() IZYXString
- func (i IndexZYX) ToVoxelOffset(chunkSize Point3d) Point3d
- func (i *IndexZYX) UnmarshalBinary(b []byte) error
- func (i *IndexZYX) Unpack() (x, y, z int32)
- func (i *IndexZYX) Value(dim uint8) int32
- type IndexZYXIterator
- type InstanceID
- type InstanceMap
- type InstanceName
- type InstanceNames
- type InstanceVersion
- type ListChunkPoint3d
- type LocalID
- type LocalID32
- type LogConfig
- type Logger
- type ModInfo
- type ModeFlag
- type NdFloat32
- type NdString
- type OptionalBounds
- func (b *OptionalBounds) Adjust(minPt, maxPt *Point3d)
- func (b *OptionalBounds) BeyondZ(pt ChunkPoint3d) bool
- func (b *OptionalBounds) BoundedX() bool
- func (b *OptionalBounds) BoundedY() bool
- func (b *OptionalBounds) BoundedZ() bool
- func (b *OptionalBounds) Divide(pt Point3d) *OptionalBounds
- func (b *OptionalBounds) IsSet() bool
- func (b *OptionalBounds) MaxX() (x int32, ok bool)
- func (b *OptionalBounds) MaxY() (y int32, ok bool)
- func (b *OptionalBounds) MaxZ() (z int32, ok bool)
- func (b *OptionalBounds) MinX() (x int32, ok bool)
- func (b *OptionalBounds) MinY() (y int32, ok bool)
- func (b *OptionalBounds) MinZ() (z int32, ok bool)
- func (b *OptionalBounds) Outside(pt ChunkPoint3d) bool
- func (b *OptionalBounds) OutsideX(x int32) bool
- func (b *OptionalBounds) OutsideY(y int32) bool
- func (b *OptionalBounds) OutsideZ(z int32) bool
- func (b *OptionalBounds) SetMaxX(x int32)
- func (b *OptionalBounds) SetMaxY(y int32)
- func (b *OptionalBounds) SetMaxZ(z int32)
- func (b *OptionalBounds) SetMinX(x int32)
- func (b *OptionalBounds) SetMinY(y int32)
- func (b *OptionalBounds) SetMinZ(z int32)
- func (b *OptionalBounds) String() string
- type OrthogSlice
- func (s OrthogSlice) DataShape() DataShape
- func (s OrthogSlice) Duplicate() OrthogSlice
- func (s OrthogSlice) EndPoint() Point
- func (s OrthogSlice) NumVoxels() int64
- func (s *OrthogSlice) SetSize(size Point2d)
- func (s OrthogSlice) Size() Point
- func (s OrthogSlice) StartPoint() Point
- func (s OrthogSlice) String() string
- type Point
- type Point2d
- func (p Point2d) Add(x Point) Point
- func (p Point2d) AddScalar(value int32) Point
- func (p Point2d) CheckedValue(dim uint8) (int32, error)
- func (p Point2d) Chunk(size Point) ChunkPoint
- func (p Point2d) Distance(x Point) int32
- func (p Point2d) Div(x Point) (result Point)
- func (p Point2d) DivScalar(value int32) Point
- func (p Point2d) Duplicate() Point
- func (p Point2d) Max(x Point) (Point, bool)
- func (p Point2d) Min(x Point) (Point, bool)
- func (p Point2d) Mod(x Point) (result Point)
- func (p Point2d) Modify(settings map[uint8]int32) Point
- func (p Point2d) Mult(x Point) (result Point)
- func (p Point2d) NumDims() uint8
- func (p Point2d) PointInChunk(size Point) Point
- func (p Point2d) Prod() int64
- func (pt Point2d) String() string
- func (p Point2d) Sub(x Point) Point
- func (p Point2d) Value(dim uint8) int32
- type Point3d
- func (p Point3d) Add(x Point) Point
- func (p Point3d) Add3d(p2 Point3d) Point3d
- func (p Point3d) AddScalar(value int32) Point
- func (p Point3d) Bytes() []byte
- func (p Point3d) CheckedValue(dim uint8) (int32, error)
- func (p Point3d) Chunk(size Point) ChunkPoint
- func (p Point3d) ChunkIndexer(size Point3d) ChunkIndexer
- func (p Point3d) Distance(x Point) int32
- func (p Point3d) Div(x Point) (result Point)
- func (p Point3d) DivScalar(value int32) Point
- func (p Point3d) Duplicate() Point
- func (p Point3d) Equals(p2 Point3d) bool
- func (p Point3d) Expand2d(plane DataShape, size Point2d) (Point3d, error)
- func (p *Point3d) FromZYXBytes(zyx []byte) error
- func (p Point3d) Less(p2 Point3d) bool
- func (p Point3d) MapKey() string
- func (p Point3d) Max(x Point) (Point, bool)
- func (p Point3d) Min(x Point) (Point, bool)
- func (p Point3d) Mod(x Point) (result Point)
- func (p Point3d) Modify(settings map[uint8]int32) Point
- func (p Point3d) Mult(x Point) (result Point)
- func (p Point3d) NumDims() uint8
- func (p Point3d) Point3dInChunk(size Point3d) Point3d
- func (p Point3d) PointFromBytes(b []byte) (readPt Point3d, err error)
- func (p Point3d) PointInChunk(size Point) Point
- func (p Point3d) Prod() int64
- func (p *Point3d) SetMaximum(p2 Point3d)
- func (p *Point3d) SetMinimum(p2 Point3d)
- func (p Point3d) String() string
- func (p Point3d) Sub(x Point) Point
- func (p Point3d) ToBlockIZYXString(size Point3d) IZYXString
- func (p Point3d) ToZYXBytes() []byte
- func (p Point3d) Value(dim uint8) int32
- type PointNd
- func (p PointNd) Add(x Point) Point
- func (p PointNd) AddScalar(value int32) Point
- func (p PointNd) CheckedValue(dim uint8) (int32, error)
- func (p PointNd) Chunk(size Point) ChunkPoint
- func (p PointNd) Distance(x Point) int32
- func (p PointNd) Div(x Point) Point
- func (p PointNd) DivScalar(value int32) Point
- func (p PointNd) Duplicate() Point
- func (p PointNd) Max(x Point) (Point, bool)
- func (p PointNd) Min(x Point) (Point, bool)
- func (p PointNd) Mod(x Point) Point
- func (p PointNd) Modify(settings map[uint8]int32) Point
- func (p PointNd) Mult(x Point) Point
- func (p PointNd) NumDims() uint8
- func (p PointNd) PointInChunk(size Point) Point
- func (p PointNd) Prod() int64
- func (p PointNd) String() string
- func (p PointNd) Sub(x Point) Point
- func (p PointNd) Value(dim uint8) int32
- type RLE
- func (rle RLE) Excise(rle2 RLE) RLEs
- func (rle *RLE) Extend(n int32)
- func (rle RLE) GetRangeIZYXString() (beg, end IZYXString)
- func (rle RLE) Intersects(rle2 RLE) bool
- func (rle RLE) Length() int32
- func (rle RLE) Less(rle2 RLE) bool
- func (rle RLE) MarshalBinary() ([]byte, error)
- func (rle RLE) StartPt() Point3d
- func (rle RLE) String() string
- func (rle *RLE) UnmarshalBinary(b []byte) error
- func (rle RLE) Within(pt Point3d) bool
- func (rle RLE) WriteTo(w io.Writer) (n int64, err error)
- type RLEs
- func (rles *RLEs) Add(rles2 RLEs) (voxelsAdded int64)
- func (rles RLEs) FitToBounds(bounds *OptionalBounds) RLEs
- func (rles RLEs) Len() int
- func (rles RLEs) Less(i, j int) bool
- func (rles RLEs) MarshalBinary() ([]byte, error)
- func (rles RLEs) Normalize() RLEs
- func (rles RLEs) Offset(offset Point3d) (out RLEs)
- func (rles RLEs) Partition(blockSize Point3d) (BlockRLEs, error)
- func (rles RLEs) Split(splits RLEs) (RLEs, error)
- func (rles RLEs) Stats() (numVoxels uint64, numRuns int32)
- func (rles RLEs) Swap(i, j int)
- func (rles *RLEs) UnmarshalBinary(b []byte) error
- func (rles *RLEs) UnmarshalBinaryReader(r io.Reader, numRLEs uint32) error
- func (rles RLEs) Within(pts []Point3d) (in []int)
- type RepoID
- type Resolution
- type Response
- type SerializationFormat
- type SimplePoint
- type Span
- type Spans
- func (s Spans) Blocks(size Point3d) IZYXSlice
- func (s Spans) Count() uint64
- func (s Spans) Extents() (offset, size Point3d)
- func (s Spans) Len() int
- func (s Spans) Less(i, j int) bool
- func (s Spans) MarshalBinary() ([]byte, error)
- func (s Spans) Normalize() Spans
- func (s Spans) Swap(i, j int)
- func (s *Spans) UnmarshalBinary(b []byte) error
- func (s Spans) VoxelCounts(size Point3d) map[IZYXString]uint32
- type SparseVol
- func (vol *SparseVol) AddRLE(rles RLEs)
- func (vol *SparseVol) AddSerializedRLEs(encoding []byte) error
- func (vol *SparseVol) Clear()
- func (vol *SparseVol) Label() uint64
- func (vol *SparseVol) MaximumPoint3d() Point3d
- func (vol *SparseVol) MinimumPoint3d() Point3d
- func (vol *SparseVol) NumVoxels() uint64
- func (vol *SparseVol) RLEs() RLEs
- func (vol *SparseVol) SetLabel(label uint64)
- func (vol *SparseVol) Size() Point3d
- func (vol *SparseVol) SurfaceSerialization(blockNz int32, res NdFloat32) ([]byte, error)
- type Store
- type StoreCloser
- type StoreConfig
- type StoreIdentifiable
- type Subsetter
- type Subvolume
- func (s *Subvolume) BoundingChunks(chunkSize Point) (minChunk, maxChunk ChunkPoint3d, err error)
- func (s *Subvolume) DataShape() DataShape
- func (s *Subvolume) EndPoint() Point
- func (s *Subvolume) NewIndexZYXIterator(chunkSize Point) (IndexIterator, error)
- func (s *Subvolume) NumVoxels() int64
- func (s *Subvolume) Size() Point
- func (s *Subvolume) StartPoint() Point
- func (s *Subvolume) String() string
- type TimeLog
- func (t TimeLog) Criticalf(format string, args ...interface{})
- func (t TimeLog) Debugf(format string, args ...interface{})
- func (t TimeLog) Errorf(format string, args ...interface{})
- func (t TimeLog) Infof(format string, args ...interface{})
- func (t TimeLog) Shutdown()
- func (t TimeLog) Warningf(format string, args ...interface{})
- type TypeString
- type URLString
- type UUID
- type UUIDSet
- type Vector3d
- type VersionID
- type VersionMap
- type VertexID
- type VertexPairID
Constants ¶
const ( LocalIDSize = 2 LocalID32Size = 4 MaxLocalID = 0xFFFF MaxLocalID32 = 0xFFFFFFFF )
const ( MaxInstanceID = MaxLocalID32 MaxRepoID = MaxLocalID32 MaxVersionID = MaxLocalID32 MaxClientID = MaxLocalID32 InstanceIDSize = 4 RepoIDSize = 4 VersionIDSize = 4 ClientIDSize = 4 )
const ( NoCompression CompressionLevel = 0 BestSpeed = 1 BestCompression = 9 DefaultCompression = -1 )
const ( Uncompressed CompressionFormat = 0 Snappy = 1 Gzip = 2 // Gzip stores length and checksum automatically. LZ4 = 4 JPEG = 5 )
const ( Kilo = 1 << 10 Mega = 1 << 20 Giga = 1 << 30 Tera = 1 << 40 )
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.
const BitsOfInt = 32 << (^uint(0) >> 63)
BitsOfInt is the number of bits used for an int
const ChunkPoint2dSize = 8
const ChunkPoint3dSize = 12
const CoordinateBits = 32
const DataShapeBytes = 7
const DefaultJPEGQuality = 80
DefaultJPEGQuality is the quality of images returned if requesting JPEG images and an explicit Quality amount is omitted.
const IndexZYXSize = ChunkPoint3dSize
const (
MaxNumberConcurrentCgo = 10000
)
const NilUUID = UUID("")
const VertexIDSize = 8
Variables ¶
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}} )
var ( MaxIndexZYX = IndexZYX(MaxChunkPoint3d) MinIndexZYX = IndexZYX(MinChunkPoint3d) )
var ( MaxPoint3d = Point3d{math.MaxInt32, math.MaxInt32, math.MaxInt32} MinPoint3d = Point3d{math.MinInt32, math.MinInt32, math.MinInt32} )
var ( MaxChunkPoint2d = ChunkPoint2d{math.MaxInt32, math.MaxInt32} MinChunkPoint2d = ChunkPoint2d{math.MinInt32, math.MinInt32} )
var ( MaxChunkPoint3d = ChunkPoint3d{math.MaxInt32, math.MaxInt32, math.MaxInt32} MinChunkPoint3d = ChunkPoint3d{math.MinInt32, math.MinInt32, math.MinInt32} )
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.
var (
Font *truetype.Font
)
var ( // NumCPU is the number of cores available to this DVID server. NumCPU int )
Functions ¶
func AliasByteToUint16 ¶
AliasByteToUint16 returns a uint16 slice that reuses the passed byte slice. NOTE: The passed byte slice must be aligned for uint16.
func AliasByteToUint32 ¶
AliasByteToUint32 returns a uint32 slice that reuses the passed byte slice. NOTE: The passed byte slice must be aligned for uint32.
func AliasByteToUint64 ¶
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 ¶
AliasUint16ToByte returns the underlying byte slice for a uint16 slice.
func AliasUint32ToByte ¶
AliasUint32ToByte returns the underlying byte slice for a uint32 slice.
func AliasUint64ToByte ¶
AliasUint64ToByte returns the underlying byte slice for a uint64 slice.
func BlockAligned ¶
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 cgo routines have been finished or queued for starting. This requires cgo routines to be bracketed by:
dvid.StartCgo() /* Some cgo code */ dvid.StopCgo()
func ByteToUint64 ¶
ByteToUint64 copies a properly aligned byte slice into a []uint64.
func ConvertToAbsolute ¶
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 DataFromPost ¶
DataFromPost returns data submitted in the given key of a POST request.
func DataTypeBytes ¶
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 DecodeSerializationFormat ¶
func DecodeSerializationFormat(s SerializationFormat) (CompressionFormat, Checksum)
func Deserialize ¶
Deserialize a Go object using Gob encoding
func EmptyValue ¶
func EmptyValue() []byte
func EstimateGoroutines ¶
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 ¶
GetNumBlocks returns the number of n-d blocks necessary to cover the given geometry.
func GoImageFromData ¶
GoImageFromData returns a go Image given pixel data.
func GoImageFromFile ¶
GoImageFromFile returns an image and its format name given a file name.
func ImageData ¶
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 ¶
ImageGrayFromData returns a Gray image given data and image size.
func ImageNRGBA64FromData ¶
ImageNRGBA64FromData returns a NRGBA64 image given 64-bit data and image size.
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 New8ByteAlignBytes ¶
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() int
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 ¶
PlaceholderImage returns an solid image with a message and text describing the shape.
func PrintNonZero ¶
PrintNonZero prints the number of non-zero bytes in a slice of bytes.
func RandomBytes ¶
RandomBytes returns a slices of random bytes.
func ReadJSONFile ¶
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 SendEmail ¶
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 ¶
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 SupportsGzipEncoding ¶
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 TimeWarningf ¶
func TimeWarningf(format string, args ...interface{})
func WriteGzip ¶
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 ¶
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 ¶
WriteJSONFile writes an arbitrary but exportable Go object to a JSON file.
Types ¶
type AutoInstanceStore ¶
type AutoInstanceStore interface {
AutoInstances() (name string, n int) // name is empty string if none requested
}
AutoInstanceStore is a store that can request automatic temporary instances to be created.
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 ¶
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 ¶
NumVoxels is the number of voxels contained within a label's block RLEs.
func (BlockRLEs) SortedKeys ¶
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.
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
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 )
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
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 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.
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 ¶
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.
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 ¶
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 ¶
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 ¶
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 ¶
Name returns the first argument of the command (in lower case) which is assumed to be the name of the command.
func (Command) Setting ¶
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 ¶
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) TypeCommand ¶
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 (Config) GetBool ¶
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 ¶
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) GetRange ¶
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 ¶
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 ¶
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 ¶
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 ¶
BytesToDataShape recovers a DataShape from a series of bytes.
func (DataShape) AxisName ¶
AxisName returns common axis descriptions like X, Y, and Z for a shapes dimensions.
func (DataShape) Bytes ¶
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) GetFloat2D ¶
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 ¶
ShapeDimension returns the axis number for a shape dimension.
func (DataShape) ShapeDimensions ¶
ShapeDimensions returns the number of dimensions for this shape.
func (DataShape) TotalDimensions ¶
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 DataSpecifier ¶
type DataSpecifier string
DataSpecifier is either a TypeString or a (InstanceName, UUID) tuple, allowing an immutable specification of a datatype or 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 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.
type DataValue ¶
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 ¶
MarshalJSON implements the json.Marshaler interface.
func (*DataValue) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (DataValue) ValueBytes ¶
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 DirtyBlocks ¶
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 ¶
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 ¶
AdjustPoints modifies extents based on new voxel coordinates in concurrency-safe manner.
func (*Extents) StartPoint ¶
StartPoint returns the offset to first point of data.
type Extents3d ¶
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 ¶
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) VoxelWithin ¶
VoxelWithin returns true if given point is within the extents.
type Filename ¶
type Filename string
Filename has a base name + extension.
func (Filename) HasExtensionPrefix ¶
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 ¶
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 ¶
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) Downres ¶
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) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface
func (IZYXSlice) MergeCopy ¶
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 ¶
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) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
type IZYXString ¶
type IZYXString string
IZYXString is the stringified version of IndexZYX.Bytes(), optimized for lexicographic ordering.
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 ¶
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 ¶
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 ¶
Bounds returns the size of the image. If an image is not set, it returns the zero recatnagle (image.ZR)
func (*Image) DataPtr ¶
DataPtr returns a slice of bytes corresponding to the value at point (x,y) in image.
func (*Image) Deserialize ¶
Deserialze deserializes an Image from a possibly compressioned, checksummed byte slice.
func (Image) GetDrawable ¶
Get returns an image.Image from the union struct.
func (Image) GetJPEG ¶
GetJPEG returns bytes in JPEG format where quality is 1-100, higher is better, and quality 0 is DefaultJPEGQuality.
func (*Image) InterpolateImage ¶
InterpolateImage returns an image scaled to the given geometry using simple nearest-neighbor interpolation.
func (*Image) MarshalBinary ¶
MarshalBinary fulfills the encoding.BinaryMarshaler interface.
func (*Image) ResizeImage ¶
ResizeImage returns an image scaled to the given geometry without doing interpolation.
func (*Image) ScaleImage ¶
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 ¶
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 ¶
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 ¶
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) IndexFromBytes ¶
IndexFromBytes returns an index from bytes. The passed Index is used just to choose the appropriate byte decoding scheme.
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 ¶
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) 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 ¶
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) DuplicateChunkIndexer ¶
func (i *IndexZYX) DuplicateChunkIndexer() ChunkIndexer
DuplicateChunkIndexer returns a duplicate that can act as a ChunkIndexer.
func (*IndexZYX) Hash ¶
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 ¶
IndexFromBytes returns an index from key bytes. The passed Index is used just to choose the appropriate byte decoding scheme.
func (*IndexZYX) MarshalBinary ¶
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) 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) ToIZYXString ¶
func (i *IndexZYX) ToIZYXString() IZYXString
func (IndexZYX) ToVoxelOffset ¶
func (*IndexZYX) UnmarshalBinary ¶
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.
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 ¶
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 ¶
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.
type LocalID32 ¶
type LocalID32 uint32
LocalID32 is a 32-bit unique id within this DVID instance.
func LocalID32FromBytes ¶
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.
type LogConfig ¶
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 ¶
ModInfo gives a user, app and time for a modification
func GetModInfo ¶
GetModInfo sets and returns a ModInfo using "u" query string.
type NdFloat32 ¶
type NdFloat32 []float32
NdFloat32 is an N-dimensional slice of float32
func StringToNdFloat32 ¶
Parse a string of format "%f,%f,%f,..." into a slice of float32.
func (NdFloat32) MultScalar ¶
MultScalar multiples a N-dimensional float by a float32
type NdString ¶
type NdString []string
NdString is an N-dimensional slice of strings
func StringToNdString ¶
Parse a string of format "%f,%f,%f,..." into a slice of float32.
func (NdString) ChunkPoint3d ¶
func (n NdString) ChunkPoint3d() (p ChunkPoint3d, err 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 ¶
NewPoint returns an appropriate Point implementation for the number of dimensions passed in.
func SliceToPoint ¶
Convert a slice of int32 into an appropriate Point implementation.
func StringToPoint ¶
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 StringToPoint2d ¶
StringToPoint2d parses a string of format "%d<sep>%d,..." into a Point2d
func (Point2d) CheckedValue ¶
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) Max ¶
Max returns a Point where each of its elements are the maximum of two points' elements.
func (Point2d) Min ¶
Min returns a Point where each of its elements are the minimum of two points' elements.
func (Point2d) Mod ¶
Mod returns a point where each component is the receiver modulo the passed point's components.
func (Point2d) Modify ¶
Modify returns a copy of the point with the given (dim, value) components modified.
func (Point2d) PointInChunk ¶
PointInChunk returns a point in containing block (chunk) space for the given point.
type Point3d ¶
type Point3d [3]int32
Point3d is an ordered list of three 32-bit signed integers that implements the Point interface.
func GetPoint3dFrom2d ¶
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 ¶
StringToPoint3d parses a string of format "%d<sep>%d<sep>%d,..." into a Point3d
func (Point3d) CheckedValue ¶
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) FromZYXBytes ¶
FromZYXBytes sets a point from an encoded slice.
func (Point3d) Max ¶
Max returns a Point where each of its elements are the maximum of two points' elements.
func (Point3d) Min ¶
Min returns a Point where each of its elements are the minimum of two points' elements.
func (Point3d) Mod ¶
Mod returns a point where each component is the receiver modulo the passed point's components.
func (Point3d) Modify ¶
Modify returns a copy of the point with the given (dim, value) components modified.
func (Point3d) Point3dInChunk ¶
Point3dInChunk returns a point in containing block (chunk) space for the given point.
func (Point3d) PointFromBytes ¶
PointFromBytes returns a Point3d from bytes. The passed point is used just to choose the appropriate byte decoding scheme.
func (Point3d) PointInChunk ¶
PointInChunk returns a point in containing block (chunk) space for the given point.
func (*Point3d) SetMaximum ¶
SetMaximum sets the point to the maximum elements of current and passed points.
func (*Point3d) SetMinimum ¶
SetMinimum sets the point to the minimum elements of current and passed points.
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 ¶
ToZYXBytes returns the point in a byte slice format suitable for use as a map index, etc.
type PointNd ¶
type PointNd []int32
PointNd is a slice of N 32-bit signed integers that implements the Point interface.
func StringToPointNd ¶
StringToPointNd parses a string of format "%d,%d,%d,..." into a slice of int32.
func (PointNd) CheckedValue ¶
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) Max ¶
Max returns a Point where each of its elements are the maximum of two points' elements.
func (PointNd) Min ¶
Min returns a Point where each of its elements are the minimum of two points' elements.
func (PointNd) Mod ¶
Mod returns a point where each component is the receiver modulo the passed point's components.
func (PointNd) Modify ¶
Modify returns a copy of the point with the given (dim, value) components modified.
func (PointNd) PointInChunk ¶
PointInChunk returns a point in containing block (chunk) space for the given point.
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 (RLE) Excise ¶
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) GetRangeIZYXString ¶
func (rle RLE) GetRangeIZYXString() (beg, end IZYXString)
func (RLE) Intersects ¶
func (RLE) MarshalBinary ¶
MarshalBinary fulfills the encoding.BinaryMarshaler interface.
func (*RLE) UnmarshalBinary ¶
UnmarshalBinary fulfills the encoding.BinaryUnmarshaler 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 (*RLEs) Add ¶
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) MarshalBinary ¶
MarshalBinary fulfills the encoding.BinaryMarshaler interface.
func (RLEs) Normalize ¶
Normalize returns a sorted slice of RLEs where there are no directly adjacent RLEs along X.
func (RLEs) Partition ¶
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 ¶
Split removes RLEs, which must be a subset of current RLEs, from the receiver and returns the remainder.
func (*RLEs) UnmarshalBinary ¶
UnmarshalBinary fulfills the encoding.BinaryUnmarshaler interface.
func (*RLEs) UnmarshalBinaryReader ¶
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.
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 ¶
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.
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
type Response ¶
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 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 ¶
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) LessChunkPoint3d ¶
func (s Span) LessChunkPoint3d(block ChunkPoint3d) bool
type Spans ¶
type Spans []Span
Spans is a slice of Span
func (Spans) Extents ¶
Extents returns the offset and size of the bounding box traversed by the receiver Spans.
func (Spans) MarshalBinary ¶
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 ¶
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) UnmarshalBinary ¶
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) AddSerializedRLEs ¶
AddSerializedRLEs adds binary encoding of RLEs to SparseVol.
func (*SparseVol) MaximumPoint3d ¶
func (*SparseVol) MinimumPoint3d ¶
func (*SparseVol) SurfaceSerialization ¶
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 }
Store allows polyglot persistence of data. The Store implementation could be an ordered key-value database, graph store, etc.
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 ¶
NewSubvolume returns a Subvolume given a subvolume's origin and size.
func NewSubvolumeFromStrings ¶
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) NewIndexZYXIterator ¶
func (s *Subvolume) NewIndexZYXIterator(chunkSize Point) (IndexIterator, error)
NewIndexZYXIterator returns an iterator that can move across subvolume.
func (*Subvolume) StartPoint ¶
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
type TypeString ¶
type TypeString string
TypeString is a string that is the name of a DVID data type.
type UUID ¶
type UUID string
UUID is a 32 character hexidecimal string ("" if invalid) 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
func StringToUUID ¶
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.
type Vector3d ¶
type Vector3d [3]float64
Vector3d is a 3D vector of 64-bit floats, a recommended type for math operations.
func StringToVector3d ¶
func (Vector3d) DivideScalar ¶
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 ¶
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.
type VersionMap ¶
type VertexPairID ¶
smaller ID should be first