Skip to content

Commit

Permalink
DICOM Overlays
Browse files Browse the repository at this point in the history
Adds 'overlayPlaneModule' type returning an array of DICOM overlays.
This array is then added the 'overlays' propertry of the image.

This is then read by the overlays tool see - [cornerstonejs/cornerstoneTools#788](cornerstonejs/cornerstoneTools#809)

see issue [cornerstonejs/cornerstoneTools#780](cornerstonejs/cornerstoneTools#780)
see DICOM overlays standard - http://dicom.nema.org/dicom/2013/output/chtml/part03/sect_C.9.html
  • Loading branch information
kofifus authored Feb 7, 2019
1 parent 345926c commit 18eca89
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/imageLoader/wadors/metaData/metaDataProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,47 @@ function metaDataProvider (type, imageId) {
};
}

if (type === 'overlayPlaneModule') {
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 = getValue(metaData[`${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 = metaData.Value[data.dataOffset + i];
pixelData[i * 8 + k] = (byte_as_int >> k) & 0b1; // eslint-disable-line no-bitwise
}
}

overlays.push({
rows: getNumberValue(metaData[`${groupStr}0010`]),
columns: getNumberValue(metaData[`${groupStr}0011`]),
type: getValue(metaData[`${groupStr}0040`]),
x: getNumberValue(metaData[`${groupStr}0050`], 1) - 1,
y: getNumberValue(metaData[`${groupStr}0050`], 0) - 1,
pixelData,
description: getValue(metaData[`${groupStr}0022`]),
label: getValue(metaData[`${groupStr}1500`]),
roiArea: getValue(metaData[`${groupStr}1301`]),
roiMean: getValue(metaData[`${groupStr}1302`]),
roiStandardDeviation: getValue(metaData[`${groupStr}1303`])
});
}

return {
overlays
};
}
}

export default metaDataProvider;

0 comments on commit 18eca89

Please sign in to comment.