Skip to content

Commit

Permalink
add sort instance number
Browse files Browse the repository at this point in the history
  • Loading branch information
jlopes90 committed Jun 5, 2024
1 parent 584c4c7 commit fbd36ae
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion utils/demo/helpers/createImageIdsAndCacheMetaData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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];
Expand Down

0 comments on commit fbd36ae

Please sign in to comment.