• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang dvid.ChunkPoint3d类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/janelia-flyem/dvid/dvid.ChunkPoint3d的典型用法代码示例。如果您正苦于以下问题:Golang ChunkPoint3d类的具体用法?Golang ChunkPoint3d怎么用?Golang ChunkPoint3d使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ChunkPoint3d类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: ImmutableBySpec

// ImmutableBySpec returns an Immutable ROI (or nil if not available) given
// a name and uuid using string format "<roiname>,<uuid>"
func ImmutableBySpec(spec string) (*Immutable, error) {
	d, v, found, err := DataBySpec(spec)
	if err != nil {
		return nil, err
	}
	if !found {
		return nil, nil
	}

	// Read the ROI from this version.
	spans, err := d.GetSpans(v)
	if err != nil {
		return nil, err
	}

	// Setup the immutable.
	im := Immutable{
		version:   v,
		blockSize: d.BlockSize,
		blocks:    make(map[dvid.IZYXString]struct{}),
	}
	for _, span := range spans {
		z, y, x0, x1 := span[0], span[1], span[2], span[3]
		for x := x0; x <= x1; x++ {
			c := dvid.ChunkPoint3d{x, y, z}
			izyx := c.ToIZYXString()
			im.blocks[izyx] = struct{}{}
		}
	}
	return &im, nil
}
开发者ID:tartavull,项目名称:dvid,代码行数:33,代码来源:roi.go


示例2: 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
		}
	}
}
开发者ID:jwohlwend,项目名称:dvid,代码行数:61,代码来源:roi.go


示例3: 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
	}
}
开发者ID:jwohlwend,项目名称:dvid,代码行数:82,代码来源:roi.go



注:本文中的github.com/janelia-flyem/dvid/dvid.ChunkPoint3d类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang dvid.Command类代码示例发布时间:2022-05-23
下一篇:
Golang dvid.UUID函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap