feat(dicomJSON): Add Loading Other Display Sets and JSON Metadata Generation script (#3777)
This commit is contained in:
1 parent
5b513fd30e
commit
43b1c17209
9 files changed
+390
-3
No files matched your search
@@ -25,6 +25,23 @@ let _store = {
|
||||
// }
|
||||
};
|
||||
|
||||
function wrapSequences(obj) {
|
||||
return Object.keys(obj).reduce(
|
||||
(acc, key) => {
|
||||
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
||||
// Recursively wrap sequences for nested objects
|
||||
acc[key] = wrapSequences(obj[key]);
|
||||
} else {
|
||||
acc[key] = obj[key];
|
||||
}
|
||||
if (key.endsWith('Sequence')) {
|
||||
acc[key] = OHIF.utils.addAccessors(acc[key]);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
Array.isArray(obj) ? [] : {}
|
||||
);
|
||||
}
|
||||
const getMetaDataByURL = url => {
|
||||
return _store.urls.find(metaData => metaData.url === url);
|
||||
};
|
||||
@@ -190,8 +207,14 @@ function createDicomJSONApi(dicomJsonConfig) {
|
||||
const numberOfSeries = series.length;
|
||||
series.forEach((series, index) => {
|
||||
const instances = series.instances.map(instance => {
|
||||
// for instance.metadata if the key ends with sequence then
|
||||
// we need to add a proxy to the first item in the sequence
|
||||
// so that we can access the value of the sequence
|
||||
// by using sequenceName.value
|
||||
const modifiedMetadata = wrapSequences(instance.metadata);
|
||||
|
||||
const obj = {
|
||||
...instance.metadata,
|
||||
...modifiedMetadata,
|
||||
url: instance.url,
|
||||
imageId: instance.url,
|
||||
...series,
|
||||
|
||||
Reference in new issue
Block a user