extensions/xnat/src/utils/IO/classes/_tempDCMJSFork/Segmentation_4X_fork.js
/**
 * unpackPixelData - Unpacks bitpacked pixelData if the Segmentation is BINARY.
 *
 * @param  {Object} multiframe The multiframe dataset.
 * @return {Uint8Array}      The unpacked pixelData.
 */
Unpacks bitpacked pixelData if the Segmentation is BINARY.
@param  {Object} multiframe The multiframe dataset.
@return {Uint8Array}      The unpacked pixelData.
Unpacks bitpacked pixelData if the Segmentation is BINARY . @param { Object } multiframe The multiframe dataset . @return { Uint8Array } The unpacked pixelData .
function unpackPixelData(multiframe) {
  const segType = multiframe.SegmentationType;
  if (segType === 'BINARY') {
    return {
      pixelData: BitArray.unpack(multiframe.PixelData),
      isFractional: false,
    };
  }
  const pixelData = new Uint8Array(multiframe.PixelData);
  const max = multiframe.MaximumFractionalValue;
  const onlyMaxAndZero =
    pixelData.find(element => element !== 0 && element !== max) === undefined;
  if (!onlyMaxAndZero) {
    log.warn(
      'This segmentation object is actually binary... processing as such.'
    );
  }
  return { pixelData, isFractional: !onlyMaxAndZero };
}
function unpackPixelData ( multiframe ) { const segType = multiframe . SegmentationType ; if ( segType === 'BINARY' ) { return { pixelData : BitArray . unpack ( multiframe . PixelData ) , isFractional : false , } ; } const pixelData = new Uint8Array ( multiframe . PixelData ) ; const max = multiframe . MaximumFractionalValue ; const onlyMaxAndZero = pixelData . find ( element => element !== 0 && element !== max ) === undefined ; if ( ! onlyMaxAndZero ) { log . warn ( 'This segmentation object is actually binary... processing as such.' ) ; } return { pixelData , isFractional : ! onlyMaxAndZero } ; }
unpackPixelData - Unpacks bitpacked pixelData if the Segmentation is BINARY.
unpackPixelData - Unpacks bitpacked pixelData if the Segmentation is BINARY .