2015-11-16 17:49:35 +01:00
|
|
|
/**
|
|
|
|
|
* Sorts the series and instances inside a study instance by their series
|
|
|
|
|
* and instance numbers in ascending order.
|
|
|
|
|
*
|
|
|
|
|
* @param {Object} study The study instance
|
|
|
|
|
*/
|
2015-10-13 14:14:50 +02:00
|
|
|
sortStudy = function(study) {
|
2016-07-23 15:56:36 +02:00
|
|
|
if (!study || !study.seriesList) {
|
|
|
|
|
throw "Insufficient study data was provided to sortStudy";
|
2015-10-13 14:14:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|