feat: Multiframe metadata provider (#2938)

* fix(volume):Support volume viewing

* fix(multiframe):Display multiframe US, and multiframe PR fixes

* fix(metadataProvider):Don't call combine if frame not defined
This commit is contained in:
Bill Wallace authored and GitHub committed 2022-09-20 14:47:18 -04:00
1 parent 3900e62641
commit ff24b57a4b
5 files changed
+62 -136

No files matched your search

@@ -0,0 +1,33 @@
/**
* Combine the Per instance frame data, the shared frame data
* and the root data objects.
* The data is combined by taking nested sequence objects within
* the functional group sequences. Data that is directly contained
* within the functional group sequences, such as private creators
* will be ignored.
* This can be safely called with an undefined frame in order to handle
* single frame data. (eg frame is undefined is the same as frame===1).
*/
const combineFrameInstance = (frame, instance) => {
const {
PerFrameFunctionalGroupsSequence,
SharedFunctionalGroupsSequence,
} = instance;
if (!PerFrameFunctionalGroupsSequence) return instance;
const shared = Object.values(SharedFunctionalGroupsSequence[0])
.map(it => it[0])
.filter(it => it !== undefined && typeof it === 'object');
const perFrame = Object.values(
PerFrameFunctionalGroupsSequence[(frame || 1) - 1]
)
.map(it => it[0])
.filter(it => it !== undefined && typeof it === 'object');
return Object.assign(
{},
instance,
...Object.values(shared),
...Object.values(perFrame)
);
};
export default combineFrameInstance;