Fix hanging protocol bugs

- Convert series number and instance number to integer in imageDetails.sortingInfo to sort the images properly (e.g. 1,2,10 instead of 1,10,2)
- Sort based on firstly instanceNumber, then seriesNumber, to show the first instance of the next series in the next viewport instead of the second instance of the previous series in multiple layout (other than 1x1)
- Do nothing when clicked if the previous and next stage buttons are disabled
- Add forgotten undefined check statements
This commit is contained in:
Evren Ozkan 2016-11-14 13:19:20 -05:00
parent 8320e11830
commit 9544a24ed8
5 changed files with 29 additions and 9 deletions

View File

@ -30,6 +30,11 @@ Template.nextPresentationGroupButton.events({
return;
}
// Stop here if the tool is disabled
if ($(event.currentTarget).hasClass('disabled')) {
return;
}
// Hide the button's Bootstrap tooltip in case it was shown
$(event.currentTarget).tooltip('hide');

View File

@ -30,6 +30,11 @@ Template.previousPresentationGroupButton.events({
return;
}
// Stop here if the tool is disabled
if ($(event.currentTarget).hasClass('disabled')) {
return;
}
// Hide the button's Bootstrap tooltip in case it was shown
$(event.currentTarget).tooltip('hide');

View File

@ -466,8 +466,8 @@ HP.ProtocolEngine = class ProtocolEngine {
sortingInfo: {
score: totalMatchScore,
study: study.studyDate + study.studyTime,
series: series.seriesNumber, // TODO: change for seriesDateTime
instance: instance.instanceNumber // TODO: change for acquisitionTime
series: parseInt(series.seriesNumber), // TODO: change for seriesDateTime
instance: parseInt(instance.instanceNumber) // TODO: change for acquisitionTime
}
};
@ -500,10 +500,10 @@ HP.ProtocolEngine = class ProtocolEngine {
}, {
name: 'study',
reverse: true
}, {
name: 'series'
}, {
name: 'instance'
}, {
name: 'series'
});
matchingScores.sort((a, b) => sortingFunction(a.sortingInfo, b.sortingInfo));

View File

@ -111,7 +111,12 @@ OHIF.viewer.canMoveDisplaySets = isNext => {
sequenceMap.forEach((studyViewports, study) => {
// Get active viewport index if isMultiple is false ortherwise get last
const viewportIndex = studyViewports[activeViewportIndex !== null ? activeViewportIndex : studyViewports.length - 1].displaySetIndex;
const studyViewport = studyViewports[activeViewportIndex !== null ? activeViewportIndex : studyViewports.length - 1];
if (!studyViewport) {
return;
}
const viewportIndex = studyViewport.displaySetIndex;
const layoutViewports = studyViewports.length;
const amount = study.displaySets.length;
const move = !isMultiple ? 1 : ((amount % layoutViewports) || layoutViewports);
@ -137,7 +142,12 @@ OHIF.viewer.canMoveDisplaySets = isNext => {
if(activeViewportIndex >= 0) {
sequenceMap.forEach((studyViewports, study) => {
// Get active viewport index if isMultiple is false ortherwise get first
const viewportIndex = studyViewports[activeViewportIndex !== null ? activeViewportIndex : 0].displaySetIndex;
const studyViewport = studyViewports[activeViewportIndex !== null ? activeViewportIndex : 0];
if (!studyViewport) {
return;
}
const viewportIndex = studyViewport.displaySetIndex;
const layoutViewports = studyViewports.length;
// 9999 for index means empty viewport, see getDisplaySetSequenceMap function
@ -285,10 +295,10 @@ OHIF.viewer.moveMultipleViewportDisplaySets = isNext => {
// Sort the display sets
const sortingFunction = OHIF.utils.sortBy({
name: 'studyInstanceUid'
}, {
name: 'seriesNumber'
}, {
name: 'instanceNumber'
}, {
name: 'seriesNumber'
});
displaySetsToRender.sort((a, b) => sortingFunction(a, b));

View File

@ -177,7 +177,7 @@ hasMultipleFrames = () => {
const activeViewport = getActiveViewportElement();
// No active viewport yet: disable button
if(!activeViewport) {
if(!activeViewport || !$(activeViewport).find('canvas').length) {
return true;
}