Allowing display sets to be sorted by incoming order

This commit is contained in:
Bruno Alves de Faria committed 2017-08-25 12:02:28 -03:00
1 parent 9e0a9c35da
commit 66c8db697f
2 files changed
+15 -5

No files matched your search

@@ -1,5 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { ImageSet } from './classes/ImageSet';
import { isImage } from './isImage';
import { OHIF } from 'meteor/ohif:core';
const isMultiFrame = instance => {
// NumberOfFrames (0028,0008)
@@ -26,11 +28,14 @@ const makeDisplaySet = (series, instances) => {
isMultiFrame: isMultiFrame(instance)
});
// Sort the images in this series
imageSet.sortBy((a, b) => {
// Sort by InstanceNumber (0020,0013)
return (parseInt(a.getRawValue('x00200013', 0)) || 0) - (parseInt(b.getRawValue('x00200013', 0)) || 0);
});
// Sort the images in this series if needed
const shallSort = !OHIF.utils.ObjectPath.get(Meteor, 'settings.public.ui.sortSeriesByIncomingOrder');
if (shallSort) {
imageSet.sortBy((a, b) => {
// Sort by InstanceNumber (0020,0013)
return (parseInt(a.getRawValue('x00200013', 0)) || 0) - (parseInt(b.getRawValue('x00200013', 0)) || 0);
});
}
// Include the first image instance number (after sorted)
imageSet.setAttribute('instanceNumber', imageSet.getImage(0).getRawValue('x00200013'));