fix: Temporarily sort SEG files to the end of the display set list as a workaround for several metadata issues (#987)

This commit is contained in:
Erik Ziegler 2019-10-02 09:39:38 +02:00 committed by GitHub
parent 855020d730
commit b3b4c10e4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -197,6 +197,7 @@ export class StudyMetadata extends Metadata {
// TODO
displaySets.sort(_sortBySeriesNumber);
displaySets.sort(_sortSegToEndOfList);
return displaySets;
}
@ -660,3 +661,24 @@ function _sortBySeriesNumber(a, b) {
return seriesNumberAIsGreaterOrUndefined ? 1 : -1;
}
/**
* Move Segmentation modality files to the end of the list of
* display sets. This is a workaround to prevent issues when
* the referenced dataset's metadata is not yet available.
*
* It will be removed once proper SEG ingestion is added.
*
* @param {*} a - DisplaySet
* @param {*} b - DisplaySet
*/
function _sortSegToEndOfList(a, b) {
const displaySetAIsSeg = a.modality === 'SEG';
const displaySetBIsSeg = b.modality === 'SEG';
if (displaySetAIsSeg && displaySetBIsSeg) {
return 0;
}
return displaySetAIsSeg ? 1 : -1;
}