All files / dicomImageLoader/src/shared/decoders decodeEncapsulatedUncompressed.ts

0% Statements 0/1
100% Branches 0/0
0% Functions 0/1
0% Lines 0/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29                                                         
import type { ByteArray } from 'dicom-parser';
import type { Types } from '@cornerstonejs/core';
 
import decodeLittleEndian from './decodeLittleEndian';
import { trimToNativeFrame } from './nativeFrameBytes';
 
/**
 * Decodes one frame of Encapsulated Uncompressed Explicit VR Little Endian
 * (1.2.840.10008.1.2.1.98).
 *
 * Nothing is compressed here: the syntax exists so that uncompressed pixel
 * data can use the encapsulated format, one frame per fragment, which makes a
 * single frame addressable without reading the whole Pixel Data element
 * (PS3.5 A.4.11). Each fragment holds that frame's native little endian pixel
 * data, padded to an even length, so the only work is dropping the padding and
 * interpreting the rest as Explicit VR Little Endian.
 */
async function decodeEncapsulatedUncompressed(
  imageFrame: Types.IImageFrame,
  pixelData: ByteArray
): Promise<Types.IImageFrame> {
  return decodeLittleEndian(
    imageFrame,
    trimToNativeFrame(imageFrame, pixelData, 'decodeEncapsulatedUncompressed')
  );
}
 
export default decodeEncapsulatedUncompressed;