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

TypeScript geom.vec3Key函数代码示例

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

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



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

示例1: checkPosition

 // Position within chunk in floating point range [0, chunkDataSize].
 function checkPosition(positionInChunk: vec3) {
   gl.uniform3fv(shader.uniform('vChunkPosition'), positionInChunk);
   chunkFormat.beginDrawing(gl, shader);
   chunkFormat.beginSource(gl, shader);
   chunkFormat.setupTextureLayout(gl, shader, textureLayout);
   gl.bindTexture(textureTarget, texture);
   tester.execute();
   chunkFormat.endDrawing(gl, shader);
   let offset = 0;
   for (let i = 0; i < 3; ++i) {
     offset += Math.floor(Math.max(0, Math.min(positionInChunk[i], volumeSize[i] - 1))) *
         strides[i];
   }
   const values = tester.values;
   for (let channel = 0; channel < numChannels; ++channel) {
     const curOffset = offset + channel * strides[3];
     const msg = `volumeSize = ${vec3Key(volumeSize)}, ` +
         `positionInChunk = ${vec3Key(positionInChunk)}, ` +
         `channel = ${channel}, offset = ${curOffset}`;
     switch (dataType) {
       case DataType.UINT64: {
         let low = values[`output${channel}Low`];
         let high = values[`output${channel}High`];
         expect(low).toBe(rawData[curOffset * 2], `${msg} (low)`);
         expect(high).toEqual(rawData[curOffset * 2 + 1], `${msg} (high)`);
         break;
       }
       default: {
         let result = values[`output${channel}`];
         expect(result).toBe(rawData[curOffset], msg);
         break;
       }
     }
   }
 }
开发者ID:google,项目名称:neuroglancer,代码行数:36,代码来源:chunk_format_testing.ts


示例2: download

 download(chunk: VolumeChunk) {
   let path: string;
   {
     // chunkPosition must not be captured, since it will be invalidated by the next call to
     // computeChunkBounds.
     let chunkPosition = this.computeChunkBounds(chunk);
     let {chunkDataSize} = chunk;
     path = `/v1beta2/volumes/${this.key}/binary/subvolume/corner=${vec3Key(chunkPosition)}/size=${vec3Key(chunkDataSize)}/scale=${this.scaleIndex}/changeStackId=/${this.encodingParams}?alt=media`;
   }
   handleChunkDownloadPromise(
       chunk, makeRequest(this.instance, 'GET', path, 'arraybuffer'), this.chunkDecoder);
 }
开发者ID:j6k4m8,项目名称:neuroglancer,代码行数:12,代码来源:backend.ts


示例3: setTimeout

 setTimeout(() => {
   try{
     chunk.data = this.getColor(vec3Key(chunk.chunkGridPosition));
     resolve(chunk); // Yay! Everything went well!
   }
   catch(e){
     reject(e);
   }
 }, 0);
开发者ID:janelia-flyem,项目名称:neuroglancer,代码行数:9,代码来源:backend.ts


示例4: checkPosition

 // Position within chunk in floating point range [0, chunkDataSize].
 function checkPosition(positionInChunk: vec3) {
   gl.uniform3fv(shader.uniform('vChunkPosition'), positionInChunk);
   chunkFormat.beginDrawing(gl, shader);
   chunkFormat.beginSource(gl, shader);
   chunkFormat.setupTextureLayout(gl, shader, textureLayout);
   gl.bindTexture(gl.TEXTURE_2D, texture);
   tester.execute();
   chunkFormat.endDrawing(gl, shader);
   let offset = 0;
   for (let i = 0; i < 3; ++i) {
     offset += Math.floor(Math.max(0, Math.min(positionInChunk[i], volumeSize[i] - 1))) *
         strides[i];
   }
   let outputChannel = 0;
   for (let channel = 0; channel < numChannels; ++channel) {
     const curOffset = offset + channel * strides[3];
     const msg = `volumeSize = ${vec3Key(volumeSize)}, ` +
         `positionInChunk = ${vec3Key(positionInChunk)}, ` +
         `channel = ${channel}, offset = ${curOffset}`;
     switch (dataType) {
       case DataType.UINT64: {
         let low = tester.readUint32(outputChannel++);
         let high = tester.readUint32(outputChannel++);
         expect(low).toBe(rawData[curOffset * 2], `${msg} (low)`);
         expect(high).toEqual(rawData[curOffset * 2 + 1], `${msg} (high)`);
         break;
       }
       case DataType.FLOAT32: {
         let result = tester.readFloat(outputChannel++);
         expect(result).toBe(rawData[curOffset], msg);
         break;
       }
       default: {
         // uint8, uint16, and uint32 values can all be read as uint32.
         let result = tester.readUint32(outputChannel++);
         expect(result).toEqual(rawData[curOffset], msg);
         break;
       }
     }
   }
 }
开发者ID:stephenplaza,项目名称:neuroglancer,代码行数:42,代码来源:chunk_format_testing.ts


示例5: suite

suite('compressed_segmentation', () => {
  const blockSize = [8, 8, 8];
  const output = new Uint32ArrayBuilder(1000000);
  for (let volumeSize of [   //
           [16, 16, 16, 1],  //
                             // [64, 64, 64, 1],  //
  ]) {
    const numPossibleValues = 15;
    const input = makeRandomUint64Array(prod4(volumeSize), numPossibleValues);
    benchmark(`encode_uint64 ${vec3Key(volumeSize)}`, () => {
      output.clear();
      encodeChannelsUint64(output, blockSize, input, volumeSize);
    });
  }
});
开发者ID:google,项目名称:neuroglancer,代码行数:15,代码来源:encode.benchmark.ts


示例6: decodeBossNpzChunk

export function decodeBossNpzChunk(chunk: VolumeChunk, response: ArrayBuffer) {
  let parseResult = parseNpy(inflate(new Uint8Array(response)));
  let chunkDataSize = chunk.chunkDataSize!;
  let source = chunk.source!;
  let {shape} = parseResult;
  if (shape.length !== 3 || shape[0] !== chunkDataSize[2] ||
      shape[1] !== chunkDataSize[1] || shape[2] !== chunkDataSize[0]) {
    throw new Error(
        `Shape ${JSON.stringify(shape)} does not match chunkDataSize ${vec3Key(chunkDataSize)}`);
  }
  let parsedDataType = parseResult.dataType.dataType;
  let {spec} = source;
  if (parsedDataType !== spec.dataType) {
    throw new Error(
        `Data type ${DataType[parsedDataType]} does not match expected data type ${DataType[spec.dataType]}`);
  }
  postProcessRawData(chunk, parseResult.data);
}
开发者ID:google,项目名称:neuroglancer,代码行数:18,代码来源:bossNpz.ts


示例7: describe

  describe('encodeChannels', () => {

    it('basic 1-channel 1-block', () => {
      const blockSize = [2, 2, 1];
      const input = Uint32Array.of(
          4, 4, 4, 4  //
      );
      const volumeSize = [2, 2, 1, 1];
      const output = new Uint32ArrayBuilder();
      encodeChannels(output, blockSize, input, volumeSize);
      expect(output.view)
          .toEqual(Uint32Array.of(
              1,       //
              2, 2, 4  //
          ));
    });

    for (let blockSize of [vec3.fromValues(2, 2, 2), vec3.fromValues(8, 4, 1), ]) {
      for (let volumeSize of [  //
               [1, 2, 1, 1],    //
               [1, 2, 1, 3],    //
               [2, 2, 2, 1],    //
               [2, 2, 2, 3],    //
               [4, 4, 5, 3],    //
      ]) {
        it(`round trip ${volumeSize.join(',')} with blockSize ${vec3Key(blockSize)}`, () => {
          const numPossibleValues = 15;
          const input = makeRandomUint32Array(prod4(volumeSize), numPossibleValues);
          const output = new Uint32ArrayBuilder();
          encodeChannels(output, blockSize, input, volumeSize);
          const decoded = new Uint32Array(input.length);
          decodeChannels(decoded, output.view, 0, volumeSize, blockSize);
          expect(decoded).toEqual(input);
        });
      }
    }
  });
开发者ID:google,项目名称:neuroglancer,代码行数:37,代码来源:encode_uint32.spec.ts


示例8: get

 static get(gl: GL, dataType: DataType, subchunkSize: Vec3, numChannels: number) {
   let shaderKey = `sliceview.CompressedSegmentationChunkFormat:${dataType}:${numChannels}`;
   let cacheKey = `${shaderKey}:${vec3Key(subchunkSize)}`;
   return gl.memoize.get(
       cacheKey, () => new ChunkFormat(dataType, subchunkSize, numChannels, shaderKey));
 }
开发者ID:funkey,项目名称:neuroglancer,代码行数:6,代码来源:chunk_format.ts


示例9: getFortranOrderStrides

export function chunkFormatTest<TextureLayout extends Disposable>(
    dataType: DataType, volumeSize: Vec4,
    getChunkFormatAndTextureLayout:
        (gl: GL) => [SingleTextureChunkFormat<TextureLayout>, TextureLayout],
    rawData: TypedArray, encodedData: TypedArray) {
  const numChannels = volumeSize[3];
  let strides = getFortranOrderStrides(volumeSize);
  let outputChannelsPerChannel = dataType === DataType.UINT64 ? 2 : 1;
  it(`volumeSize = ${vec3Key(volumeSize)}, numChannels = ${volumeSize[3]}, dataType = ${DataType[dataType]}`,
     () => {
       fragmentShaderTest(outputChannelsPerChannel * numChannels, tester => {
         let {gl, builder} = tester;
         let [chunkFormat, textureLayout] = getChunkFormatAndTextureLayout(gl);
         builder.addUniform('vec3', 'vChunkPosition');
         builder.addUniform('vec3', 'uChunkDataSize');
         builder.addFragmentCode(glsl_getPositionWithinChunk);
         chunkFormat.defineShader(builder);
         {
           let fragmentMain = '';
           let outputChannel = 0;
           for (let channel = 0; channel < numChannels; ++channel) {
             switch (dataType) {
               case DataType.UINT64:
                 fragmentMain += `
{
  uint64_t value = getDataValue(${channel});
  gl_FragData[${outputChannel++}] = value.low;
  gl_FragData[${outputChannel++}] = value.high;
}
`;
                 break;
               case DataType.UINT8:
                 fragmentMain += `
gl_FragData[${outputChannel++}] = vec4(getDataValue(${channel}).value, 0, 0, 0);
`;
                 break;
               case DataType.FLOAT32:
                 fragmentMain += `
gl_FragData[${outputChannel++}] = packFloatIntoVec4(getDataValue(${channel}));
`;
                 break;
               case DataType.UINT16:
                 fragmentMain += `
gl_FragData[${outputChannel++}] = vec4(getDataValue(${channel}).value, 0, 0);
`;
                 break;
               case DataType.UINT32:
                 fragmentMain += `
gl_FragData[${outputChannel++}] = getDataValue(${channel}).value;
`;
                 break;
             }
           }
           builder.setFragmentMain(fragmentMain);
         }
         tester.build();
         let {shader} = tester;
         shader.bind();
         gl.uniform3fv(shader.uniform('uChunkDataSize'), volumeSize.subarray(0, 3));

         let texture = gl.createTexture();
         tester.registerDisposer(() => { gl.deleteTexture(texture); });

         chunkFormat.beginDrawing(gl, shader);
         gl.bindTexture(gl.TEXTURE_2D, texture);
         gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);
         setRawTextureParameters(gl);
         chunkFormat.setTextureData(gl, textureLayout, encodedData);
         chunkFormat.setupTextureLayout(gl, shader, textureLayout);


         // Position within chunk in floating point range [0, chunkDataSize].
         function checkPosition(positionInChunk: Vec3) {
           gl.uniform3fv(shader.uniform('vChunkPosition'), positionInChunk);
           chunkFormat.beginDrawing(gl, shader);
           chunkFormat.beginSource(gl, shader);
           chunkFormat.setupTextureLayout(gl, shader, textureLayout);
           gl.bindTexture(gl.TEXTURE_2D, texture);
           tester.execute();
           chunkFormat.endDrawing(gl, shader);
           let offset = 0;
           for (let i = 0; i < 3; ++i) {
             offset += Math.floor(Math.max(0, Math.min(positionInChunk[i], volumeSize[i] - 1))) *
                 strides[i];
           }
           let outputChannel = 0;
           for (let channel = 0; channel < numChannels; ++channel) {
             const curOffset = offset + channel * strides[3];
             const msg =
                 `volumeSize = ${vec3Key(volumeSize)}, positionInChunk = ${vec3Key(positionInChunk)}, channel = ${channel}, offset = ${curOffset}`;
             switch (dataType) {
               case DataType.UINT64: {
                 let low = tester.readUint32(outputChannel++);
                 let high = tester.readUint32(outputChannel++);
                 expect(low).toEqual(rawData[curOffset * 2], `${msg} (low)`);
                 expect(high).toEqual(rawData[curOffset * 2 + 1], `${msg} (high)`);
                 break;
               }
               case DataType.FLOAT32: {
                 let result = tester.readFloat(outputChannel++);
//.........这里部分代码省略.........
开发者ID:funkey,项目名称:neuroglancer,代码行数:101,代码来源:chunk_format_testing.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript geom.mat4类代码示例发布时间:2022-05-25
下一篇:
TypeScript geom.prod4函数代码示例发布时间: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