本文整理匯總了TypeScript中neuroglancer/sliceview/compressed_segmentation/encode_uint64.encodeChannel函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript encodeChannel函數的具體用法?TypeScript encodeChannel怎麽用?TypeScript encodeChannel使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了encodeChannel函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: 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
));
});
示例2: it
it('basic cached 2-bit', () => {
const input = Uint32Array.of(
4, 0, 3, 0, 5, 0, 4, 0, //
1, 0, 3, 0, 3, 0, 3, 0, //
3, 0, 1, 0, 1, 0, 1, 0, //
5, 0, 5, 0, 3, 0, 4, 0 //
);
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, //
16 | (1 << 24), 15, //
16 | (1 << 24), 20, //
9 | (2 << 24), 21, //
0b01100001, 3, 0, 4, 0, 5, 0, //
0b1110, 1, 0, 3, 0, //
0b00000001, //
0b01001010 //
));
});