本文整理汇总了Golang中github.com/janelia-flyem/dvid/dvid.ChunkPoint3d.MinPoint方法的典型用法代码示例。如果您正苦于以下问题:Golang ChunkPoint3d.MinPoint方法的具体用法?Golang ChunkPoint3d.MinPoint怎么用?Golang ChunkPoint3d.MinPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/janelia-flyem/dvid/dvid.ChunkPoint3d
的用法示例。
在下文中一共展示了ChunkPoint3d.MinPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: addSubvolumesGrid
// Adds subvolumes using simple algorithm centers fixed-sized subvolumes across active blocks.
func (d *Data) addSubvolumesGrid(layer *layerT, subvolumes *subvolumesT, batchsize int32) {
minY, maxY, found := getYRange(layer.activeBlocks)
if !found {
return
}
subvolumes.ROI.ExtendDim(1, minY)
subvolumes.ROI.ExtendDim(1, maxY)
dy := maxY - minY + 1
yleft := dy % batchsize
addYtoBeg := yleft / 2
addYtoEnd := yleft - addYtoBeg
begY := minY - addYtoBeg
endY := maxY + addYtoEnd
// Iterate through Y, block by block, and determine the X range. Then center subvolumes
// along that X.
for y0 := begY; y0 <= endY; y0 += batchsize {
y1 := y0 + batchsize - 1
minX, maxX, actives := getXRange(layer.activeBlocks, y0, y1)
if len(actives) == 0 {
continue
}
subvolumes.ROI.ExtendDim(0, minX)
subvolumes.ROI.ExtendDim(0, maxX)
// For this row of subvolumes along X, position them to encompass the X range.
dx := maxX - minX + 1
xleft := dx % batchsize
addXtoBeg := xleft / 2
addXtoEnd := xleft - addXtoBeg
begX := minX - addXtoBeg
endX := maxX + addXtoEnd
// Create the subvolumes along X
for x0 := begX; x0 <= endX; x0 += batchsize {
x1 := x0 + batchsize - 1
minCorner := dvid.ChunkPoint3d{x0, y0, layer.minZ}
maxCorner := dvid.ChunkPoint3d{x1, y1, layer.maxZ}
numTotal := totalBlocks(minCorner, maxCorner)
numActive := findActives(actives, x0, x1)
if numActive > 0 {
subvolume := subvolumeT{
Extents3d: dvid.Extents3d{
minCorner.MinPoint(d.BlockSize).(dvid.Point3d),
maxCorner.MaxPoint(d.BlockSize).(dvid.Point3d),
},
ChunkExtents3d: dvid.ChunkExtents3d{minCorner, maxCorner},
TotalBlocks: numTotal,
ActiveBlocks: numActive,
}
subvolumes.Subvolumes = append(subvolumes.Subvolumes, subvolume)
}
subvolumes.NumActiveBlocks += numActive
subvolumes.NumTotalBlocks += numTotal
}
}
}
示例2: addSubvolumes
// Adds subvolumes based on given extents for a layer.
func (d *Data) addSubvolumes(layer *layerT, subvolumes *subvolumesT, batchsize int32, merge bool) {
// mergeThreshold := batchsize * batchsize * batchsize / 10
minY, maxY, found := getYRange(layer.activeBlocks)
if !found {
return
}
subvolumes.ROI.ExtendDim(1, minY)
subvolumes.ROI.ExtendDim(1, maxY)
dy := maxY - minY + 1
yleft := dy % batchsize
begY := minY
for {
if begY > maxY {
break
}
endY := begY + batchsize - 1
if yleft > 0 {
endY++
yleft--
}
minX, maxX, actives := getXRange(layer.activeBlocks, begY, endY)
if len(actives) > 0 {
subvolumes.ROI.ExtendDim(0, minX)
subvolumes.ROI.ExtendDim(0, maxX)
dx := maxX - minX + 1
xleft := dx % batchsize
// Create subvolumes along this row.
begX := minX
for {
if begX > maxX {
break
}
endX := begX + batchsize - 1
if xleft > 0 {
endX++
xleft--
}
minCorner := dvid.ChunkPoint3d{begX, begY, layer.minZ}
maxCorner := dvid.ChunkPoint3d{endX, endY, layer.maxZ}
holeBeg, holeEnd, found := findXHoles(actives, begX, endX)
var numActive, numTotal int32
if found && merge {
// MinCorner stays same since we are extended in X
if holeBeg-1 >= begX {
lastI := len(subvolumes.Subvolumes) - 1
subvolume := subvolumes.Subvolumes[lastI]
lastCorner := dvid.ChunkPoint3d{holeBeg - 1, endY, layer.maxZ}
subvolume.MaxPoint = lastCorner.MinPoint(d.BlockSize).(dvid.Point3d)
subvolume.MaxChunk = lastCorner
numTotal = totalBlocks(minCorner, lastCorner)
numActive = findActives(actives, begX, holeBeg-1)
subvolume.TotalBlocks += numTotal
subvolume.ActiveBlocks += numActive
subvolumes.Subvolumes[lastI] = subvolume
}
begX = holeEnd + 1
} else {
numTotal = totalBlocks(minCorner, maxCorner)
numActive = findActives(actives, begX, endX)
subvolume := subvolumeT{
Extents3d: dvid.Extents3d{
minCorner.MinPoint(d.BlockSize).(dvid.Point3d),
maxCorner.MaxPoint(d.BlockSize).(dvid.Point3d),
},
ChunkExtents3d: dvid.ChunkExtents3d{minCorner, maxCorner},
TotalBlocks: numTotal,
ActiveBlocks: numActive,
}
subvolumes.Subvolumes = append(subvolumes.Subvolumes, subvolume)
begX = endX + 1
}
subvolumes.NumActiveBlocks += numActive
subvolumes.NumTotalBlocks += numTotal
}
}
begY = endY + 1
}
}