當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。