From fbd36aef20c0ceaf05dbdba835ff1e0e31c897f0 Mon Sep 17 00:00:00 2001 From: Jorge Date: Wed, 5 Jun 2024 11:15:54 +0100 Subject: [PATCH] add sort instance number --- utils/demo/helpers/createImageIdsAndCacheMetaData.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/utils/demo/helpers/createImageIdsAndCacheMetaData.js b/utils/demo/helpers/createImageIdsAndCacheMetaData.js index fe8cb3758d..de6c5a46a5 100644 --- a/utils/demo/helpers/createImageIdsAndCacheMetaData.js +++ b/utils/demo/helpers/createImageIdsAndCacheMetaData.js @@ -34,6 +34,7 @@ export default async function createImageIdsAndCacheMetaData({ const SOP_INSTANCE_UID = '00080018'; const SERIES_INSTANCE_UID = '0020000E'; const MODALITY = '00080060'; + const INSTANCE_NUMBER = '00200013'; const studySearchOptions = { studyInstanceUID: StudyInstanceUID, @@ -51,7 +52,12 @@ export default async function createImageIdsAndCacheMetaData({ } const modality = instances[0][MODALITY].Value[0]; - let imageIds = instances.map((instanceMetaData) => { + + const sortedInstances = Object.values(instances).sort( + (a, b) => a[INSTANCE_NUMBER].Value[0] - b[INSTANCE_NUMBER].Value[0] + ); + + let imageIds = sortedInstances.map((instanceMetaData) => { const SeriesInstanceUID = instanceMetaData[SERIES_INSTANCE_UID].Value[0]; const SOPInstanceUIDToUse = SOPInstanceUID || instanceMetaData[SOP_INSTANCE_UID].Value[0];