pydicom.pixels.concatenate_packed_frames#
- pydicom.pixels.concatenate_packed_frames(frames: Sequence[bytes | bytearray], frame_length: int, pad: bool = True) bytes [source]#
Concatenate individual bit-packed frames.
Added in version 3.1.
This should only be used for natively-encoded single bit data (Bits Allocated = 1) in a “bit-packed” representation (one byte containing 8 pixels). Concatenating such frames may require combining pixels from multiple frames within a single byte.
See Chapter 5, 8.1.1, particularly the note about multi-frame images with Bits Allocated = 1.
- Parameters:
- Returns:
Bit-packed representation of all frames combined.
- Return type:
Note
In certain situations, this function will run faster and use less memory if NumPy is installed. Otherwise, it will fall back to a slower method using native Python functions.