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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { metaData } from '@cornerstonejs/core';
import type { Types } from '@cornerstonejs/core';
/**
* It creates a metadata object for a volume given the imageIds that compose it.
* It uses the first imageId to get the metadata.
*
* @param imageIds - array of imageIds
* @returns The volume metadata
*/
export default function makeVolumeMetadata(
imageIds: Array<string>
): Types.Metadata {
const imageId0 = imageIds[0];
const {
pixelRepresentation,
bitsAllocated,
bitsStored,
highBit,
photometricInterpretation,
samplesPerPixel,
} = metaData.get('imagePixelModule', imageId0);
// Add list of VOIs stored on the DICOM.
const voiLut = [];
const voiLutModule = metaData.get('voiLutModule', imageId0);
// voiLutModule is not always present
Eif (voiLutModule) {
const { windowWidth, windowCenter } = voiLutModule;
Iif (Array.isArray(windowWidth)) {
for (let i = 0; i < windowWidth.length; i++) {
voiLut.push({
windowWidth: windowWidth[i],
windowCenter: windowCenter[i],
});
}
} else {
voiLut.push({
windowWidth: windowWidth,
windowCenter: windowCenter,
});
}
} else {
voiLut.push({
windowWidth: undefined,
windowCenter: undefined,
});
}
const { modality, seriesInstanceUID } = metaData.get(
'generalSeriesModule',
imageId0
);
const {
imageOrientationPatient,
pixelSpacing,
frameOfReferenceUID,
columns,
rows,
} = metaData.get('imagePlaneModule', imageId0);
// Map to dcmjs-style keywords. This is becoming the standard and makes it
// Easier to swap out cornerstoneWADOImageLoader at a later date.
return {
BitsAllocated: bitsAllocated,
BitsStored: bitsStored,
SamplesPerPixel: samplesPerPixel,
HighBit: highBit,
PhotometricInterpretation: photometricInterpretation,
PixelRepresentation: pixelRepresentation,
Modality: modality,
ImageOrientationPatient: imageOrientationPatient,
PixelSpacing: pixelSpacing,
FrameOfReferenceUID: frameOfReferenceUID,
Columns: columns,
Rows: rows,
// This is a reshaped object and not a dicom tag:
voiLut,
SeriesInstanceUID: seriesInstanceUID,
};
}
|