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 BlockOnActiveCgo()
- func DataFromPost(r *http.Request, key string) ([]byte, error)
- func DataTypeBytes(t DataType) int32
- func DecodeSerializationFormat(s SerializationFormat) (CompressionFormat, Checksum)
- func Deserialize(s []byte, object interface{}) error
- func ElapsedTime(mode ModeFlag, startTime time.Time, p ...interface{})
- func EmptyValue() []byte
- func Error(p ...interface{})
- func EstimateGoroutines(percentCPUs float64, goroutineMB int32) int
- func Fmt(mode ModeFlag, p ...interface{})
- func GetNumBlocks(geom Geometry, blockSize Point) int
- func ImageData(img image.Image) (data []uint8, bytesPerPixel, stride int32, err error)
- func ImageFromFile(filename string) (img image.Image, format string, err error)
- func ImageFromForm(r *http.Request, key string) (img image.Image, format string, err error)
- func ImageFromPOST(r *http.Request) (img image.Image, format string, err error)
- func ImageGrayFromData(data []uint8, nx, ny int) (img *image.Gray)
- func ListDataShapes() (shapes []string)
- func Log(mode ModeFlag, p ...interface{})
- func PlaceholderImage(shape DataShape, imageSize Point, message string) (image.Image, error)
- func PrintNonZero(message string, value []byte)
- func ReadJSONFile(filename string) (value map[string]interface{}, err 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 SetErrorLoggingFile(out io.Writer)
- func StartCgo()
- func StopCgo()
- func SupportsGzipEncoding(r *http.Request) bool
- func UnblockCgo()
- func WaitToComplete(wg *sync.WaitGroup, mode ModeFlag, startTime time.Time, p ...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 BinaryVolume
- type Bool
- type Checksum
- type ChunkIndexer
- type ChunkPoint
- type ChunkPoint2d
- type ChunkPoint3d
- 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 (c ChunkPoint3d) Value(dim uint8) int32
- type ChunkPointNd
- type Chunkable
- 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) GetBool(key string) (value, found bool, err error)
- func (c Config) GetInt(key string) (i int, found bool, err 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) IsVersioned() (versioned bool, err error)
- func (c *Config) Set(key, value string)
- func (c *Config) SetByJSON(jsonData io.Reader) error
- func (c *Config) SetVersioned(versioned bool)
- type DataLocalID
- 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 DataString
- 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 DatasetLocalID
- type Dimension
- type Filename
- type Geometry
- type Image
- func (img *Image) Data() []uint8
- 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) 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) Set(src image.Image, format DataValues, interpolable bool) 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) Hash(n int) int
- func (i IndexZYX) IndexFromBytes(b []byte) (Index, 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) Value(dim uint8) int32
- type IndexZYXIterator
- type LocalID
- type LocalID32
- type ModeFlag
- type NdFloat32
- type NdString
- 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) 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) 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) 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) 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) 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
- type RLEs
- type Response
- type SerializationFormat
- type SimplePoint
- type SparseVol
- func (vol *SparseVol) AddRLEs(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) SetLabel(label uint64)
- func (vol *SparseVol) Size() Point3d
- func (vol *SparseVol) SurfaceSerialization(blockNz int32, res NdFloat32) ([]byte, error)
- type Subvolume
- type TypeString
- type UUID
- type VersionLocalID
Constants ¶
const ( LocalIDSize = 2 LocalID32Size = 4 MaxLocalID = 0xFFFF MaxLocalID32 = 0xFFFFFFFF )
const ( NoCompression CompressionLevel = 0 BestSpeed = 1 BestCompression = 9 DefaultCompression = -1 )
const ( Uncompressed CompressionFormat = 0 Snappy = 1 << (iota - 1) Gzip // Gzip stores length and checksum automatically. LZ4 )
const ( Kilo = 1 << 10 Mega = 1 << 20 Giga = 1 << 30 Tera = 1 << 40 )
const ( EncodingBinary byte = 0x00 EncodingGrayscale8 = 0x01 EncodingGrayscale16 = 0x02 EncodingNormal16 = 0x04 )
Sparse Volume binary encoding payload descriptors.
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
)
Variables ¶
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 ( // 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{/* contains filtered or unexported fields */} // Vol3d describes a 3d volume of voxels Vol3d = DataShape{3, []uint8{0, 1, 2}} )
var ( MaxIndexZYX = IndexZYX(MaxChunkPoint3d) MinIndexZYX = IndexZYX(MinChunkPoint3d) )
var ( // NumCPU is the number of cores available to this DVID server. NumCPU int // Mode is a global variable set to the run modes of this DVID process. Mode ModeFlag )
var (
Font *truetype.Font
)
Functions ¶
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 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 ¶
Deserializes a Go object using Gob encoding
func ElapsedTime ¶
ElapsedTime prints the time elapsed from the start time with Printf arguments afterwards. Example: ElapsedTime(dvid.Debug, startTime, "Time since launch of %s", funcName)
func EmptyValue ¶
func EmptyValue() []byte
func Error ¶
func Error(p ...interface{})
Error prints a message to the Error Log File, which is useful to mark potential issues but not ones that should crash the DVID server. Basically, you should opt to crash the server if a mistake can propagate and corrupt data. If not, you can use this function. Note that Error logging to a file only occurs if DVID is running as a server, otherwise this function will print to stdout.
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 Fmt ¶
func Fmt(mode ModeFlag, p ...interface{})
Fmt prints a message via fmt.Print() depending on the Mode of DVID.
func GetNumBlocks ¶
GetNumBlocks returns the number of n-d blocks necessary to cover the given geometry.
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 ImageFromFile ¶
ImageFromFile returns an image and its format name given a file name.
func ImageFromForm ¶
ImageFromForm returns an image and its format name given a key to a POST request. The image should be the first file in a POSTed form.
func ImageFromPOST ¶
ImageFromPOST returns an image and its format name given a POST request.
func ImageGrayFromData ¶
ImageGrayFromData returns a Gray image given data and image size.
func ListDataShapes ¶
func ListDataShapes() (shapes []string)
ListDataShapes returns a slice of shape names
func Log ¶
func Log(mode ModeFlag, p ...interface{})
Log prints a message via log.Print() depending on the Mode of DVID.
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 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 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)
Serializes 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)
Serialize a slice of bytes using optional compression, checksum. Checksum will be ignored if the underlying compression already employs checksums, e.g., Gzip.
func SetErrorLoggingFile ¶
SetErrorLoggingFile creates an error logger to the given file for this DVID process.
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 UnblockCgo ¶
func UnblockCgo()
UnblockCgo allows cgo routines to start if they have been previously blocked using a BlockOnActiveCgo() call.
func WaitToComplete ¶
Wait for WaitGroup then print message including time for operation. The last arguments are fmt.Printf arguments and should not include the newline since one is added in this function.
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 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 Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
Bool is a concurrency-safe bool.
type Checksum ¶
type Checksum uint8
Checksum is the type of checksum employed for error checking stored data. NOTE: Should be no more than 4 (2 bits) of checksum types.
var DefaultChecksum Checksum = 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.
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) }
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 (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) 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 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 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 ("grayscale8"). 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.
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. 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. If setting of key is not parseable as an int, returns an error.
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.
func (Config) IsVersioned ¶
IsVersioned returns true if we want this data versioned.
func (*Config) SetByJSON ¶
Sets a configuration using valid JSON. Since Config is case-insensitive, JSON object names are converted to lower case.
func (*Config) SetVersioned ¶
type DataLocalID ¶
type DataLocalID LocalID
DataLocalID is a DVID server-specific ID that is more compact than a (UUID, Data URL).
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 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 DatasetLocalID ¶
type DatasetLocalID LocalID32
DatasetLocalID is a DVID server-specific ID that is more compact than a UUID.
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 { // 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 // StartPoint returns the offset to first point of data. StartPoint() Point // EndPoint returns the last point. EndPoint() Point String() string }
Geometry describes the shape, size, and position of data in the DVID volume.
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 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 (*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 default (50)
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) Set ¶
Set initializes 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) 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 // BytesToIndex returns an Index from a byte representation IndexFromBytes(b []byte) (Index, error) // Hash provides a consistent mapping from an Index to an integer (0,n] Hash(n int) int // Scheme returns a string describing the indexing scheme. Scheme() string // String returns a hexadecimal string representation String() string }
Index is a one-dimensional index, typically constructed using a space-filling curve that serves as a spatiotemporal indexing scheme. For example, Z-curves map n-D space to a 1-D index.
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) (Index, 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 a function that returns a sequence of indices and ends with nil.
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) (Index, 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) (Index, error)
IndexFromBytes returns an index from bytes. The passed Index is used just to choose the appropriate byte decoding scheme.
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) 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.
func (IndexZYX) IndexFromBytes ¶
IndexFromBytes returns an index from bytes. The passed Index is used just to choose the appropriate byte decoding scheme.
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.
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 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 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.
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.
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 ¶
Parse a string of format "%d<sep>%d<sep>%d,..." into a Point
type Point2d ¶
type Point2d [2]int32
Point2d is a 2d point.
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 (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) 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) 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.
type PointNd ¶
type PointNd []int32
PointNd is a slice of N 32-bit signed integers that implements the Point interface.
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).
type RLEs ¶
type RLEs []RLE
RLEs are simply a slice of RLE.
func (RLEs) MarshalBinary ¶
MarshalBinary fulfills the encoding.BinaryMarshaler interface.
func (*RLEs) UnmarshalBinary ¶
UnmarshalBinary fulfills the encoding.BinaryUnmarshaler interface.
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.
func EncodeSerializationFormat ¶
func EncodeSerializationFormat(compress Compression, checksum Checksum) SerializationFormat
type SimplePoint ¶
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) 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 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) StartPoint ¶
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
type VersionLocalID ¶
type VersionLocalID LocalID
VersionalLocalID is a DVID server-specific ID that is more compact than a UUID. We assume we do not need more than 16-bits to represent the number of nodes in a version DAG.