support MRI custom overlay data for OHIF through fetchMeta because it couldn't retrieved from C-FIND / FINDSCU

This commit is contained in:
AlfandiMario
2025-11-03 16:05:34 +07:00
parent b316c5c7f6
commit ae53d7faa3
2 changed files with 67 additions and 5 deletions

View File

@@ -58,6 +58,32 @@ function parseFile(filename: string): Promise<ElementType> {
const sliceThickness = dataset.string('x00180050');
const sliceLocation = dataset.string('x00201041');
// MR-specific tags for overlay
// TODO: buat ini dynamic berdasarkan includefields atau modality
const spacingBetweenSlices = dataset.string('x00180088');
const percentPhaseFieldOfView = dataset.string('x00180094');
const acquisitionMatrixElement = dataset.elements.x00181310;
const acquisitionMatrix = acquisitionMatrixElement
? [
dataset.uint16('x00181310', 0),
dataset.uint16('x00181310', 1),
dataset.uint16('x00181310', 2),
dataset.uint16('x00181310', 3),
]
: null;
const scanningSequence = dataset.string('x00180020');
const repetitionTime = dataset.string('x00180080');
const echoTime = dataset.string('x00180081');
const inversionTime = dataset.string('x00180082');
const receiveCoilName = dataset.string('x00181250');
const mrAcquisitionType = dataset.string('x00180023');
const phaseEncodingDirection = dataset.string('x00181312');
const echoTrainLength = dataset.string('x00180091');
const flipAngle = dataset.string('x00181314');
const pixelBandwidth = dataset.string('x00180095');
const acquisitionTime = dataset.string('x00080032');
const parallelAcquisitionTechnique = dataset.string('x00181316');
// append to all results
const result: ElementType = {
'00100010': { Value: [{ Alphabetic: patientName }], vr: 'PN' },
@@ -88,7 +114,23 @@ function parseFile(filename: string): Promise<ElementType> {
'00200013': { Value: [instanceNumber], vr: 'IS' },
'00180050': { Value: [sliceThickness], vr: 'DS' },
'00201041': { Value: [sliceLocation], vr: 'DS' },
'00180088': { Value: [spacingBetweenSlices], vr: 'DS' },
'00180094': { Value: [percentPhaseFieldOfView], vr: 'DS' },
...(acquisitionMatrix && { '00181310': { Value: acquisitionMatrix, vr: 'US' } }),
'00180020': { Value: [scanningSequence], vr: 'CS' },
'00180080': { Value: [repetitionTime], vr: 'DS' },
'00180081': { Value: [echoTime], vr: 'DS' },
'00180082': { Value: [inversionTime], vr: 'DS' },
'00181250': { Value: [receiveCoilName], vr: 'SH' },
'00180023': { Value: [mrAcquisitionType], vr: 'CS' },
'00181312': { Value: [phaseEncodingDirection], vr: 'CS' },
'00180091': { Value: [echoTrainLength], vr: 'IS' },
'00181314': { Value: [flipAngle], vr: 'DS' },
'00180095': { Value: [pixelBandwidth], vr: 'DS' },
'00080032': { Value: [acquisitionTime], vr: 'TM' },
'00181316': { Value: [parallelAcquisitionTechnique], vr: 'CS' },
};
resolve(result);
});
});
@@ -105,7 +147,7 @@ export function parseMeta(json: object, studyInstanceUID: string, seriesInstance
const sopInstanceUid = json[key]['00080018'].Value[0];
const pathname = path.join(storagePath, studyInstanceUID, sopInstanceUid);
parsing.push(parseFile(pathname));
}
return Promise.all(parsing);
}