AWV-1: Adding navigation of display sets

This commit is contained in:
Bruno Alves de Faria committed 2016-08-23 18:00:06 -03:00
1 parent 2cc06e454a
commit 0ec797a79c
9 files changed
+129 -32

No files matched your search

+1
View File
@@ -2,3 +2,4 @@ import './blaze.js';
import './string.js';
import './ui.js';
import './user.js';
import './viewer.js';
+45
View File
@@ -0,0 +1,45 @@
import { OHIF } from 'meteor/ohif:core';
OHIF.viewer = {};
// Move display sets forward or backward in the selected viewport
OHIF.viewer.moveDisplaySet = isNext => {
// Get the selected viewport index
const viewportIndex = Session.get('activeViewport');
// Get the selected viewport data
const viewportData = window.layoutManager.viewportData[viewportIndex];
// Get the current study
const currentStudy = _.findWhere(window.layoutManager.studies, {
studyInstanceUid: viewportData.studyInstanceUid
}) || window.layoutManager.studies[0];
// Get the display sets
const displaySets = currentStudy.displaySets;
// Get the current display set
const currentDisplaySet = _.findWhere(displaySets, {
displaySetInstanceUid: viewportData.displaySetInstanceUid
});
// Get the new index and ensure that it will exists in display sets
let newIndex = _.indexOf(displaySets, currentDisplaySet);
if (isNext) {
newIndex++;
if (newIndex >= displaySets.length) {
newIndex = 0;
}
} else {
newIndex--;
if (newIndex < 0) {
newIndex = displaySets.length - 1;
}
}
// Get the display set data for the new index
const newDisplaySetData = displaySets[newIndex];
// Rerender the viewport using the new display set data
window.layoutManager.rerenderViewportWithNewDisplaySet(viewportIndex, newDisplaySetData);
};