feat(thumbnails): Enhance DICOM Thumbnail Rendering with different strategies (#5004)

Co-authored-by: Martin Bellehumeur, M. Eng. <23396581+mbellehumeur@users.noreply.github.com>
This commit is contained in:
Bill WallaceandMartin Bellehumeur, M. Eng. authored and GitHub committed 2025-05-08 12:44:56 -04:00
1 parent dee6909a99
commit 578c3939f0
80 files changed
+371 -284

No files matched your search

@@ -17,6 +17,7 @@ const SOPClassHandlerId =
'@ohif/extension-cornerstone.sopClassHandlerModule.DicomMicroscopySopClassHandler';
function _getDisplaySetsFromSeries(instances, servicesManager, extensionManager) {
const dataSource = extensionManager.getActiveDataSource()[0];
// If the series has no instances, stop here
if (!instances || !instances.length) {
throw new Error('No instances were provided');
@@ -33,22 +34,6 @@ function _getDisplaySetsFromSeries(instances, servicesManager, extensionManager)
currentFrames = framesI;
}
}
let imageIdForThumbnail = null;
const dataSource = extensionManager.getActiveDataSource()[0];
if (singleFrameInstance) {
if (currentFrames == 1) {
// Not all DICOM server implementations support thumbnail service,
// So if we have a single-frame image, we will prefer it.
imageIdForThumbnail = singleFrameInstance.imageId;
}
if (!imageIdForThumbnail) {
// use the thumbnail service provided by DICOM server
imageIdForThumbnail = dataSource.getImageIdsForInstance({
instance: singleFrameInstance,
thumbnail: true,
});
}
}
const {
FrameOfReferenceUID,
@@ -108,11 +93,14 @@ function _getDisplaySetsFromSeries(instances, servicesManager, extensionManager)
instance,
numImageFrames: 0,
numInstances: 1,
imageIdForThumbnail, // thumbnail image
others: instances, // all other level instances in the image Pyramid
instances,
othersFrameOfReferenceUID,
imageIds: instances.map(instance => instance.imageId),
getThumbnailSrc: dataSource.retrieve.getGetThumbnailSrc?.(
singleFrameInstance,
singleFrameInstance.imageId
),
label: SeriesDescription || `${i18n.t('Series')} ${SeriesNumber} - ${i18n.t('SM')}`,
};
// The microscopy viewer directly accesses the metadata already loaded, and