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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | import type { DataSet } from 'dicom-parser'; export default function getOverlayPlaneModule(dataSet: DataSet) { const overlays = []; for (let overlayGroup = 0x00; overlayGroup <= 0x1e; overlayGroup += 0x02) { let groupStr = `x60${overlayGroup.toString(16)}`; if (groupStr.length === 4) { groupStr = `x600${overlayGroup.toString(16)}`; } const data = dataSet.elements[`${groupStr}3000`]; if (!data) { continue; } const pixelData = []; for (let i = 0; i < data.length; i++) { for (let k = 0; k < 8; k++) { const byte_as_int = dataSet.byteArray[data.dataOffset + i]; pixelData[i * 8 + k] = (byte_as_int >> k) & 0b1; // eslint-disable-line no-bitwise } } overlays.push({ rows: dataSet.uint16(`${groupStr}0010`), columns: dataSet.uint16(`${groupStr}0011`), type: dataSet.string(`${groupStr}0040`), x: dataSet.int16(`${groupStr}0050`, 1) - 1, y: dataSet.int16(`${groupStr}0050`, 0) - 1, pixelData, description: dataSet.string(`${groupStr}0022`), label: dataSet.string(`${groupStr}1500`), roiArea: dataSet.string(`${groupStr}1301`), roiMean: dataSet.string(`${groupStr}1302`), roiStandardDeviation: dataSet.string(`${groupStr}1303`), }); } return { overlays, }; } |