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 | import { external } from './externalModules.js';
/**
* creates a cornerstone Image object for the specified custom object
*
* @param imageId - the imageId for this image
* @param customObj - a custom image object
* @returns Cornerstone Image Object
*/
export default function (imageId, customObj) {
// extract the attributes we need
const rows = customObj.rows;
const columns = customObj.columns;
let image;
// Extract the various attributes we need
image = {
imageId,
minPixelValue: customObj.image.minPixelValue,
maxPixelValue: customObj.image.maxPixelValue,
slope: customObj.image.slope,
intercept: customObj.image.intercept,
windowCenter: customObj.image.windowCenter,
windowWidth: customObj.image.windowWidth,
rows,
columns,
height: rows,
width: columns,
color: customObj.image.color,
rgba: customObj.image.rgba,
columnPixelSpacing: customObj.image.columnPixelSpacing,
rowPixelSpacing: customObj.image.rowPixelSpacing,
invert: customObj.image.invert,
sizeInBytes: rows * columns * 4
};
image.getPixelData = () => customObj.pixelData;
image.modalityLUT = customObj.image.modalityLUT;
image.voiLUT = customObj.image.voiLUT;
image.data = customObj.image.data;
return new Promise((resolve, reject) => {
resolve(image);
});
}
|