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


TypeScript postprocess.postProcessRawData函数代码示例

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


在下文中一共展示了postProcessRawData函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: decodeJpegChunk

export function decodeJpegChunk(chunk: VolumeChunk, response: ArrayBuffer) {
  postProcessRawData(chunk, decodeJpegStack(new Uint8Array(response), chunk.chunkDataSize!));
}
开发者ID:funkey,项目名称:neuroglancer,代码行数:3,代码来源:jpeg.ts


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