本文整理汇总了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;未经允许,请勿转载。 |
请发表评论