本文整理汇总了Golang中github.com/janelia-flyem/dvid/dvid.IndexZYX.IndexFromBytes方法的典型用法代码示例。如果您正苦于以下问题:Golang IndexZYX.IndexFromBytes方法的具体用法?Golang IndexZYX.IndexFromBytes怎么用?Golang IndexZYX.IndexFromBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/janelia-flyem/dvid/dvid.IndexZYX
的用法示例。
在下文中一共展示了IndexZYX.IndexFromBytes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: DecodeTKey
// DecodeTKey returns a spatial index from a image block key.
// TODO: Extend this when necessary to allow any form of spatial indexing like CZYX.
func DecodeTKey(tk storage.TKey) (*dvid.IndexZYX, error) {
ibytes, err := tk.ClassBytes(keyImageBlock)
if err != nil {
return nil, err
}
var zyx dvid.IndexZYX
if err = zyx.IndexFromBytes(ibytes); err != nil {
return nil, fmt.Errorf("Cannot recover ZYX index from image block key %v: %v\n", tk, err)
}
return &zyx, nil
}
示例2: DecodeBlockTKey
func DecodeBlockTKey(tk storage.TKey) (pt dvid.ChunkPoint3d, err error) {
ibytes, err := tk.ClassBytes(keyBlock)
if err != nil {
return
}
var idx dvid.IndexZYX
if err = idx.IndexFromBytes(ibytes); err != nil {
return
}
pt = dvid.ChunkPoint3d(idx)
return
}
示例3: DecodeTKey
// DecodeTKey returns the components of a tile request based on an imagetile-specific key component.
func DecodeTKey(tk storage.TKey) (tile dvid.ChunkPoint3d, plane dvid.DataShape, scale Scaling, err error) {
if len(tk) < 21 {
err = fmt.Errorf("imagetile-specific key component has too few bytes (%d)", len(tk))
return
}
plane, err = dvid.BytesToDataShape(tk[0:dvid.DataShapeBytes])
if err != nil {
return
}
scale = Scaling(tk[dvid.DataShapeBytes])
var idx dvid.IndexZYX
if err = idx.IndexFromBytes(tk[dvid.DataShapeBytes+2:]); err != nil {
return
}
tile = dvid.ChunkPoint3d(idx)
return
}