本文整理汇总了TypeScript中neuroglancer/util/uint32array_builder.ts.Uint32ArrayBuilder.appendArray方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ts.Uint32ArrayBuilder.appendArray方法的具体用法?TypeScript ts.Uint32ArrayBuilder.appendArray怎么用?TypeScript ts.Uint32ArrayBuilder.appendArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neuroglancer/util/uint32array_builder.ts.Uint32ArrayBuilder
的用法示例。
在下文中一共展示了ts.Uint32ArrayBuilder.appendArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('basic cached 2-bit', () => {
const input = Uint32Array.of(
4, 3, 5, 4, //
1, 3, 3, 3, //
3, 1, 1, 1, //
5, 5, 3, 4 //
);
const volumeSize = [2, 2, 4];
const blockSize = [2, 2, 1];
const output = new Uint32ArrayBuilder();
output.appendArray([1, 2, 3]);
encodeChannel(output, blockSize, input, volumeSize);
expect(output.view)
.toEqual(Uint32Array.of(
1, 2, 3, //
9 | (2 << 24), 8, //
13 | (1 << 24), 12, //
13 | (1 << 24), 15, //
9 | (2 << 24), 16, //
0b01100001, 3, 4, 5, //
0b1110, 1, 3, //
0b00000001, //
0b01001010 //
));
});
示例2: it
it('map data with 0-bit encoded data', () => {
const input = Uint32Array.of(
4, 0, 4, 0, 4, 0, 4, 0, // block 1
3, 0, 3, 0, 3, 0, 3, 0, // block 2
3, 0, 3, 0, 3, 0, 3, 0, // block 3
4, 0, 4, 0, 4, 0, 4, 0 // block 4
);
const volumeSize = [2, 2, 4];
const blockSize = [2, 2, 1];
const output = new Uint32ArrayBuilder();
output.appendArray([1, 2, 3]);
encodeChannel(output, blockSize, input, volumeSize);
const dataMap = new Map([['4,0', new Uint64(10, 0)]]);
updateLookupTableData(output.view, dataMap, 3, blockSize, volumeSize);
expect(output.view)
.toEqual(Uint32Array.of(
1, 2, 3, // junk padding
8 | (0 << 24),
8, // header block 1(#encoding bits |(lookuptableoffset), encData offset)
10 | (0 << 24), 10, // header block 2
10 | (0 << 24), 12, // header block 3
8 | (0 << 24), 12, // header block 4
10, 0, // enc & table data for blocks 1, 4
0, 0 // enc & table data for blocks 2, 3
));
});
示例3: it
it('size mismatch 1-bit', () => {
const input = Uint32Array.of(4, 0, 3, 0, 4, 0, 3, 0);
const inputStrides = [2, 4, 8];
const blockSize = [3, 2, 1];
const actualSize = [2, 2, 1];
const output = new Uint32ArrayBuilder();
output.appendArray([1, 2, 3]);
const cache = newCache();
let [encodedBits, tableOffset] =
encodeBlock(input, 0, inputStrides, blockSize, actualSize, 3, cache, output);
expect(encodedBits).toBe(1);
expect(tableOffset).toBe(1);
expect(output.view).toEqual(Uint32Array.of(1, 2, 3, 0b001001, 3, 0, 4, 0));
expect(Array.from(cache)).toEqual([['3,0,4,0', 1]]);
});