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

TypeScript geom.prod3函数代码示例

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

本文整理汇总了TypeScript中neuroglancer/util/geom.prod3函数的典型用法代码示例。如果您正苦于以下问题:TypeScript prod3函数的具体用法?TypeScript prod3怎么用?TypeScript prod3使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: decodeRawChunk

export function decodeRawChunk(chunk: VolumeChunk, response: ArrayBuffer) {
  let {spec} = chunk.source!;
  let {dataType} = spec;
  let numElements = prod3(chunk.chunkDataSize!);
  let bytesPerElement = DATA_TYPE_BYTES[dataType];
  let expectedBytes = numElements * bytesPerElement * spec.numChannels;
  if (expectedBytes !== response.byteLength) {
    throw new Error(
        `Raw-format chunk is ${response.byteLength} bytes, but ${numElements} * ${bytesPerElement} = ${expectedBytes} bytes are expected.`);
  }
  let data: ArrayBufferView;
  switch (dataType) {
    case DataType.UINT8:
      data = new Uint8Array(response);
      break;
    case DataType.UINT16:
      data = new Uint16Array(response);
      break;
    case DataType.UINT32:
    case DataType.UINT64:
      data = new Uint32Array(response);
      break;
    case DataType.FLOAT32:
      data = new Float32Array(response);
      break;
    default:
      throw new Error(`Unexpected data type: ${dataType}.`);
  }
  postProcessRawData(chunk, data);
}
开发者ID:funkey,项目名称:neuroglancer,代码行数:30,代码来源:raw.ts


示例2: constructor

  constructor(options: VolumeChunkSpecificationOptions) {
    let {
      lowerVoxelBound = kZeroVec,
      upperVoxelBound,
      chunkDataSize,
      voxelSize,
      transform,
      baseVoxelOffset = kZeroVec
    } = options;
    let {
      lowerClipBound = vec3.multiply(vec3.create(), voxelSize, lowerVoxelBound),
      upperClipBound = vec3.multiply(vec3.create(), voxelSize, upperVoxelBound)
    } = options;
    const chunkSize = vec3.multiply(vec3.create(), chunkDataSize, voxelSize);
    let lowerChunkBound = vec3.create();
    let upperChunkBound = vec3.create();
    for (let i = 0; i < 3; ++i) {
      lowerChunkBound[i] = Math.floor(lowerVoxelBound[i] / chunkDataSize[i]);
      upperChunkBound[i] = Math.floor((upperVoxelBound[i] - 1) / chunkDataSize[i] + 1);
    }
    super({voxelSize, transform, lowerChunkBound, upperChunkBound, chunkSize});
    this.baseVoxelOffset = baseVoxelOffset;
    this.lowerClipBound = lowerClipBound;
    this.upperClipBound = upperClipBound;
    this.lowerVoxelBound = lowerVoxelBound;
    this.upperVoxelBound = upperVoxelBound;
    this.chunkDataSize = chunkDataSize;

    let dataType = this.dataType = options.dataType;
    let numChannels = this.numChannels = options.numChannels;

    this.chunkBytes = prod3(chunkDataSize) * DATA_TYPE_BYTES[dataType] * numChannels;

    this.compressedSegmentationBlockSize = options.compressedSegmentationBlockSize;
  }
开发者ID:google,项目名称:neuroglancer,代码行数:35,代码来源:base.ts


示例3: it

 it(`round trip ${volumeSize.join(',')}`, () => {
   const numPossibleValues = 15;
   const input = makeRandomUint32Array(prod3(volumeSize), numPossibleValues);
   const blockSize = [2, 2, 2];
   const output = new Uint32ArrayBuilder();
   encodeChannel(output, blockSize, input, volumeSize);
   const decoded = new Uint32Array(input.length);
   decodeChannel(decoded, output.view, 0, volumeSize, blockSize);
   expect(decoded).toEqual(input);
 });
开发者ID:j6k4m8,项目名称:neuroglancer,代码行数:10,代码来源:encode_uint32.spec.ts


示例4: formatBoundingBoxVolume

export function formatBoundingBoxVolume(pointA: vec3, pointB: vec3, transform: mat4) {
  let dimensionText = '';
  const vector = vec3.create();
  for (let axis = 0; axis < 3; ++axis) {
    vec3.set(vector, 0, 0, 0);
    vector[axis] = pointB[axis] - pointA[axis];
    const spatialVector = transformVectorByMat4(vector, vector, transform);
    const length = vec3.length(spatialVector);
    if (axis !== 0) {
      dimensionText += ' × ';
    }
    dimensionText += formatLength(length);
  }

  const preTransformVolume = Math.abs(prod3(vec3.subtract(vector, pointB, pointA)));
  const det = mat3.determinant(mat3.fromMat4(mat3.create(), transform));
  const postTransformVolume = det * preTransformVolume;

  return `${dimensionText}  [${formatVolume(postTransformVolume)}]`;
}
开发者ID:google,项目名称:neuroglancer,代码行数:20,代码来源:spatial_units.ts



注:本文中的neuroglancer/util/geom.prod3函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript geom.prod4函数代码示例发布时间:2022-05-25
下一篇:
TypeScript event_action_map.EventActionMap类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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