Example #1
0
 describe(`random values out of ${numPossibleValues} possible`, () => {
   const dataType = DataType.UINT64;
   for (let volumeSize of [vec4.fromValues(64, 64, 64, 1), vec4.fromValues(36, 36, 36, 1), ]) {
     const numElements = prod4(volumeSize);
     let rawData = makeRandomUint64Array(numElements, numPossibleValues);
     runTest(dataType, volumeSize, rawData, vec888);
   }
 });
 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);
 });
Example #3
0
 describe('random values', () => {
   for (let volumeSize of [vec4.fromValues(64, 64, 64, 1), vec4.fromValues(36, 36, 36, 1), ]) {
     const numElements = prod4(volumeSize);
     let rawData = new Uint32Array(numElements * 2);
     getRandomValues(rawData);
     runTest(DataType.UINT64, volumeSize, rawData, vec888);
   }
   for (let volumeSize of [vec4.fromValues(13, 17, 23, 1), vec4.fromValues(13, 17, 23, 2), ]) {
     const numElements = prod4(volumeSize);
     {
       let rawData = new Uint32Array(numElements * 2);
       getRandomValues(rawData);
       runTest(DataType.UINT64, volumeSize, rawData, vec888);
     }
     {
       let rawData = new Uint32Array(numElements);
       getRandomValues(rawData);
       runTest(DataType.UINT32, volumeSize, rawData, vec888);
     }
   }
 });
Example #4
0
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);
    });
  }
});
Example #5
0
 describe(`sequential values blockSize=${vec3Key(compressedSegmentationBlockSize)}`, () => {
   for (let volumeSize of [vec4.fromValues(13, 17, 23, 1), vec4.fromValues(13, 17, 23, 2), ]) {
     const numElements = prod4(volumeSize);
     {
       let rawData = new Uint32Array(numElements * 2);
       for (let i = 0; i < rawData.length; ++i) {
         rawData[i] = i;
       }
       runTest(DataType.UINT64, volumeSize, rawData, compressedSegmentationBlockSize);
     }
     {
       let rawData = new Uint32Array(numElements);
       for (let i = 0; i < rawData.length; ++i) {
         rawData[i] = i;
       }
       runTest(DataType.UINT32, volumeSize, rawData, compressedSegmentationBlockSize);
     }
   }
 });