ohif-viewer/Packages/viewerbase/lib/sortStudy.js

21 lines
520 B
JavaScript

/**
* Sorts the series and instances inside a study instance by their series
* and instance numbers in ascending order.
*
* @param {Object} study The study instance
*/
sortStudy = function(study) {
if (!study) {
return;
}
study.seriesList.sort(function(a, b) {
return a.seriesNumber - b.seriesNumber;
});
study.seriesList.forEach(function(series){
series.instances.sort(function(a, b) {
return a.instanceNumber - b.instanceNumber;
});
});
};