fix: Enhance multiframe instance handling and improve instance valida… (#5956)
fix: Enhance multiframe instance handling and improve instance validation - Updated `getDisplaySetInfo` to ensure local file frame imageIds resolve correctly, falling back to the source multiframe instance when necessary. - Improved instance filtering in `isDisplaySetReconstructable` to handle undefined instances more robustly. - Modified `App` prop types to make `routerBasename` optional and added new props for loading indicators and data sources. - Refactored `CinePlayer` component to replace Button with a div for better accessibility and interaction.
This commit is contained in:
1 parent
3069d33c99
commit
f5a66b9eea
4 files changed
+30
-15
No files matched your search
@@ -11,12 +11,14 @@ const iopTolerance = 0.01;
|
||||
* @param {Object[]} instances An array of `OHIFInstanceMetadata` objects.
|
||||
*/
|
||||
export default function isDisplaySetReconstructable(instances, appConfig) {
|
||||
if (!instances.length) {
|
||||
const definedInstances = instances?.filter(Boolean) || [];
|
||||
|
||||
if (!definedInstances.length) {
|
||||
return { value: false };
|
||||
}
|
||||
const firstInstance = instances[0];
|
||||
const firstInstance = definedInstances[0];
|
||||
|
||||
const isMultiframe = firstInstance.NumberOfFrames > 1;
|
||||
const isMultiframe = (firstInstance.NumberOfFrames || 0) > 1;
|
||||
|
||||
if (appConfig) {
|
||||
const rows = toNumber(firstInstance.Rows);
|
||||
@@ -30,16 +32,16 @@ export default function isDisplaySetReconstructable(instances, appConfig) {
|
||||
// in favor of the calculation by metadata (orientation and positions)
|
||||
|
||||
// Can't reconstruct if we only have one image.
|
||||
if (!isMultiframe && instances.length === 1) {
|
||||
if (!isMultiframe && definedInstances.length === 1) {
|
||||
return { value: false };
|
||||
}
|
||||
|
||||
// Can't reconstruct if all instances don't have the ImagePositionPatient.
|
||||
if (!isMultiframe && !instances.every(instance => instance.ImagePositionPatient)) {
|
||||
if (!isMultiframe && !definedInstances.every(instance => instance.ImagePositionPatient)) {
|
||||
return { value: false };
|
||||
}
|
||||
|
||||
const sortedInstances = sortInstancesByPosition(instances);
|
||||
const sortedInstances = sortInstancesByPosition(definedInstances);
|
||||
|
||||
return isMultiframe ? processMultiframe(sortedInstances[0]) : processSingleframe(sortedInstances);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user