当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript VolumeChunkSpecification.make方法代码示例

本文整理汇总了TypeScript中neuroglancer/sliceview/volume/base.VolumeChunkSpecification.make方法的典型用法代码示例。如果您正苦于以下问题:TypeScript VolumeChunkSpecification.make方法的具体用法?TypeScript VolumeChunkSpecification.make怎么用?TypeScript VolumeChunkSpecification.make使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在neuroglancer/sliceview/volume/base.VolumeChunkSpecification的用法示例。


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

示例1: getSources

  getSources(volumeSourceOptions: VolumeSourceOptions) {
    let sources: VolumeChunkSource[][] = [];

    let numLevels = this.numLevels;
    if (numLevels === undefined) {
      numLevels = computeStackHierarchy(this.stackInfo, this.dims[0]);
    }

    let lowerClipBound = vec3.create(), upperClipBound = vec3.create();
    // Generate and set the clip bounds based on the highest resolution (lowest scale) data in
    // render. Otherwise, rounding errors can cause inconsistencies in clip bounds between scaling
    // levels.
    for (let i = 0; i < 3; i++) {
      lowerClipBound[i] = this.stackInfo.lowerVoxelBound[i] * this.stackInfo.voxelResolution[i];
      upperClipBound[i] = this.stackInfo.upperVoxelBound[i] * this.stackInfo.voxelResolution[i];
    }

    for (let level = 0; level < numLevels; level++) {
      let voxelSize = vec3.clone(this.stackInfo.voxelResolution);
      let chunkDataSize = vec3.fromValues(1, 1, 1);
      // tiles are NxMx1
      for (let i = 0; i < 2; ++i) {
        voxelSize[i] = voxelSize[i] * Math.pow(2, level);
        chunkDataSize[i] = this.dims[i];
      }

      let lowerVoxelBound = vec3.create(), upperVoxelBound = vec3.create();

      for (let i = 0; i < 3; i++) {
        lowerVoxelBound[i] = Math.floor(
            this.stackInfo.lowerVoxelBound[i] * (this.stackInfo.voxelResolution[i] / voxelSize[i]));
        upperVoxelBound[i] = Math.ceil(
            this.stackInfo.upperVoxelBound[i] * (this.stackInfo.voxelResolution[i] / voxelSize[i]));
      }

      let spec = VolumeChunkSpecification.make({
        voxelSize,
        chunkDataSize,
        numChannels: this.numChannels,
        dataType: this.dataType,
        lowerClipBound,
        upperClipBound,
        lowerVoxelBound,
        upperVoxelBound,
        volumeSourceOptions,
      });

      let source = this.chunkManager.getChunkSource(TileChunkSource, {
        spec,
        parameters: {
          'baseUrls': this.baseUrls,
          'owner': this.ownerInfo.owner,
          'project': this.stackInfo.project,
          'stack': this.stack,
          'channel': this.channel,
          'minIntensity': this.minIntensity,
          'maxIntensity': this.maxIntensity,
          'maxTileSpecsToRender': this.maxTileSpecsToRender,
          'filter': this.filter,
          'dims': `${this.dims[0]}_${this.dims[1]}`,
          'level': level,
          'encoding': this.encoding,
        }
      });

      sources.push([source]);
    }
    return sources;
  }
开发者ID:google,项目名称:neuroglancer,代码行数:69,代码来源:frontend.ts


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