fix: add back dicom tag browser SQ items (#4869)

This commit is contained in:
Pedro Köhler 2025-03-18 11:52:19 -03:00 committed by GitHub
parent a0a3a30361
commit fb93ef9219
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -203,7 +203,7 @@ function getFormattedRowsFromTags({ tags, metadata }) {
for (let i = index; i < tags.length; i++) { for (let i = index; i < tags.length; i++) {
const tagInfo = tags[i]; const tagInfo = tags[i];
const uid = generateRowId(); const uid = tagInfo.uid ?? generateRowId();
if (parents?.length > 0) { if (parents?.length > 0) {
parents.forEach(parent => { parents.forEach(parent => {
@ -212,7 +212,7 @@ function getFormattedRowsFromTags({ tags, metadata }) {
} }
if (tagInfo.vr === 'SQ') { if (tagInfo.vr === 'SQ') {
const row = { const row: Row = {
uid, uid,
tag: tagInfo.tag, tag: tagInfo.tag,
valueRepresentation: tagInfo.vr, valueRepresentation: tagInfo.vr,
@ -231,13 +231,37 @@ function getFormattedRowsFromTags({ tags, metadata }) {
if (tagInfo.values.length > 0) { if (tagInfo.values.length > 0) {
stack.push({ tags, depth, parents, index: i + 1, children }); stack.push({ tags, depth, parents, index: i + 1, children });
stack.push({ for (
tags: tagInfo.values.flat(), let j = tagInfo.values.length - 1, values = tagInfo.values[j];
depth: depth + 1, j >= 0;
parents: newParents, values = tagInfo.values[--j]
index: 0, ) {
children: [], const itemUid = generateRowId();
}); stack.push({
tags: values,
depth: depth + 2,
parents: [...newParents, itemUid],
index: 0,
children: [],
});
const itemTagInfo = {
tags: [
{
tag: '(FFFE,E000)',
vr: '',
keyword: `Item #${j}`,
value: '',
uid: itemUid,
},
],
depth: depth + 1,
parents: newParents,
index: 0,
children: [],
};
stack.push(itemTagInfo);
parentChildMap.set(itemUid, itemTagInfo.children);
}
break; break;
} }
} else { } else {
@ -250,7 +274,7 @@ function getFormattedRowsFromTags({ tags, metadata }) {
console.warn(`Failed to parse value representation for tag '${tagInfo.keyword}'`); console.warn(`Failed to parse value representation for tag '${tagInfo.keyword}'`);
} }
} }
const row = { const row: Row = {
uid, uid,
tag: tagInfo.tag, tag: tagInfo.tag,
valueRepresentation: tagInfo.vr, valueRepresentation: tagInfo.vr,
@ -261,6 +285,10 @@ function getFormattedRowsFromTags({ tags, metadata }) {
parents, parents,
}; };
rows.push(row); rows.push(row);
if (row.tag === '(FFFE,E000)') {
row.areChildrenVisible = true;
row.children = [];
}
} }
} }
} }