From 8b364ce9d08705472da941d8a2c97130f7e363da Mon Sep 17 00:00:00 2001 From: Erik Ziegler Date: Sat, 23 Jul 2016 15:56:36 +0200 Subject: [PATCH] Fixed OHIF Viewer layout / CINE / Hanging Protocol buttons (OHIF-49) --- .../toolbarSection/toolbarSection.html | 3 + .../toolbarSection/toolbarSection.js | 43 ++++ .../client/components/viewer/viewer.html | 1 + OHIFViewer/client/components/viewer/viewer.js | 77 ++----- .../hangingProtocolButtons.html | 20 -- .../hangingProtocolButtons.js | 73 ------- .../matchedProtocols/matchedProtocols.html | 7 +- .../nextPresentationGroupButton.html | 19 ++ .../nextPresentationGroupButton.js | 39 ++++ .../previousPresentationGroupButton.html | 19 ++ .../previousPresentationGroupButton.js | 39 ++++ Packages/hangingprotocols/package.js | 7 +- .../components/lesionTracker/lesionTracker.js | 18 +- .../client/components/viewer/viewer.js | 112 ++++------ .../viewer/cineDialog/cineDialog.html | 48 ++-- .../viewer/cineDialog/cineDialog.js | 14 +- .../viewer/cineDialog/cineDialog.styl | 43 ++-- .../viewer/layoutButton/layoutButton.html | 20 ++ .../viewer/layoutButton/layoutButton.js | 16 ++ .../viewer/layoutChooser/layoutChooser.html | 2 +- .../viewer/layoutChooser/layoutChooser.js | 35 +-- .../viewer/layoutChooser/layoutChooser.styl | 17 +- .../loadingIndicator/loadingIndicator.styl | 2 +- .../viewer/playClipButton/playClipButton.html | 34 ++- .../viewer/playClipButton/playClipButton.js | 49 ----- .../simpleToolbarButton.html | 11 - .../simpleToolbarButton.js | 13 -- .../components/viewer/toolbar/toolbar.html | 37 ---- .../components/viewer/toolbar/toolbar.js | 205 ------------------ .../components/viewer/toolbar/toolbar.styl | 21 -- .../toolbarSectionButton.html | 10 +- .../toolbarSectionButton.js | 2 +- .../toolbarSectionTools.html | 2 + .../viewer/viewerMain/viewerMain.js | 24 +- Packages/viewerbase/lib/sortStudy.js | 4 +- Packages/viewerbase/lib/viewportFunctions.js | 101 +++++++-- Packages/viewerbase/package.js | 18 +- 37 files changed, 496 insertions(+), 709 deletions(-) delete mode 100644 Packages/hangingprotocols/client/components/hangingProtocolButtons/hangingProtocolButtons.html delete mode 100644 Packages/hangingprotocols/client/components/hangingProtocolButtons/hangingProtocolButtons.js create mode 100644 Packages/hangingprotocols/client/components/nextPresentationGroupButton/nextPresentationGroupButton.html create mode 100644 Packages/hangingprotocols/client/components/nextPresentationGroupButton/nextPresentationGroupButton.js create mode 100644 Packages/hangingprotocols/client/components/previousPresentationGroupButton/previousPresentationGroupButton.html create mode 100644 Packages/hangingprotocols/client/components/previousPresentationGroupButton/previousPresentationGroupButton.js create mode 100644 Packages/viewerbase/client/components/viewer/layoutButton/layoutButton.html create mode 100644 Packages/viewerbase/client/components/viewer/layoutButton/layoutButton.js delete mode 100644 Packages/viewerbase/client/components/viewer/simpleToolbarButton/simpleToolbarButton.html delete mode 100644 Packages/viewerbase/client/components/viewer/simpleToolbarButton/simpleToolbarButton.js delete mode 100644 Packages/viewerbase/client/components/viewer/toolbar/toolbar.html delete mode 100644 Packages/viewerbase/client/components/viewer/toolbar/toolbar.js delete mode 100644 Packages/viewerbase/client/components/viewer/toolbar/toolbar.styl diff --git a/OHIFViewer/client/components/toolbarSection/toolbarSection.html b/OHIFViewer/client/components/toolbarSection/toolbarSection.html index 180b0ab27..cb8410ec0 100644 --- a/OHIFViewer/client/components/toolbarSection/toolbarSection.html +++ b/OHIFViewer/client/components/toolbarSection/toolbarSection.html @@ -8,6 +8,9 @@
{{>roundedButtonGroup rightSidebarToggleButtonData}}
+
+ {{> toolbarSectionTools toolbarButtons=hangingProtocolButtons}} +
diff --git a/OHIFViewer/client/components/toolbarSection/toolbarSection.js b/OHIFViewer/client/components/toolbarSection/toolbarSection.js index dacb706d5..eb1a20861 100644 --- a/OHIFViewer/client/components/toolbarSection/toolbarSection.js +++ b/OHIFViewer/client/components/toolbarSection/toolbarSection.js @@ -82,6 +82,27 @@ Template.toolbarSection.helpers({ iconClasses: 'fa fa-undo' }); + buttonData.push({ + id: 'toggleCinePlay', + title: 'Toggle CINE Play', + classes: 'imageViewerCommand', + buttonTemplateName: 'playClipButton' + }); + + buttonData.push({ + id: 'toggleCineDialog', + title: 'CINE', + classes: 'imageViewerCommand', + iconClasses: 'fa fa-youtube-play' + }); + + buttonData.push({ + id: 'layout', + title: 'Layout', + iconClasses: 'fa fa-th-large', + buttonTemplateName: 'layoutButton' + }); + return buttonData; }, @@ -145,6 +166,26 @@ Template.toolbarSection.helpers({ }); return buttonData; + }, + + hangingProtocolButtons() { + let buttonData = []; + + buttonData.push({ + id: 'previousPresentationGroup', + title: 'Prev. Stage', + iconClasses: 'fa fa-step-backward', + buttonTemplateName: 'previousPresentationGroupButton' + }); + + buttonData.push({ + id: 'nextPresentationGroup', + title: 'Next Stage', + iconClasses: 'fa fa-step-forward', + buttonTemplateName: 'nextPresentationGroupButton' + }); + + return buttonData; } }); @@ -152,6 +193,8 @@ Template.toolbarSection.helpers({ Template.toolbarSection.onRendered(function() { const instance = Template.instance(); + instance.$('#layout').dropdown(); + // Set disabled/enabled tool buttons that are set in toolManager const states = toolManager.getToolDefaultStates(); const disabledToolButtons = states.disabledToolButtons; diff --git a/OHIFViewer/client/components/viewer/viewer.html b/OHIFViewer/client/components/viewer/viewer.html index b8086484c..f3bd8537d 100644 --- a/OHIFViewer/client/components/viewer/viewer.html +++ b/OHIFViewer/client/components/viewer/viewer.html @@ -2,6 +2,7 @@ {{#if Template.subscriptionsReady}}
{{> cineDialog}} + {{> layoutChooser }}
{{> toolbarSection (clone this)}} diff --git a/OHIFViewer/client/components/viewer/viewer.js b/OHIFViewer/client/components/viewer/viewer.js index e307d1964..301e97767 100644 --- a/OHIFViewer/client/components/viewer/viewer.js +++ b/OHIFViewer/client/components/viewer/viewer.js @@ -1,5 +1,22 @@ import { OHIF } from 'meteor/ohif:core'; + OHIF.viewer = OHIF.viewer || {}; +OHIF.viewer.loadIndicatorDelay = 500; +OHIF.viewer.defaultTool = 'wwwc'; +OHIF.viewer.refLinesEnabled = true; +OHIF.viewer.isPlaying = {}; +OHIF.viewer.cine = { + framesPerSecond: 24, + loop: true +}; + +OHIF.viewer.functionList = { + toggleCineDialog: toggleCineDialog, + toggleCinePlay: toggleCinePlay, + clearTools: clearTools, + resetViewport: resetViewport, + invert: invert +}; Session.setDefault('activeViewport', false); Session.setDefault('leftSidebar', false); @@ -8,9 +25,6 @@ Session.setDefault('rightSidebar', false); Template.viewer.onCreated(() => { const instance = Template.instance(); - // Attach the Window resize listener - $(window).on('resize', handleResize); - instance.data.state = new ReactiveDict(); instance.data.state.set('leftSidebar', Session.get('leftSidebar')); instance.data.state.set('rightSidebar', Session.get('rightSidebar')); @@ -19,42 +33,6 @@ Template.viewer.onCreated(() => { log.info('viewer onCreated'); - OHIF.viewer.loadIndicatorDelay = 500; - OHIF.viewer.defaultTool = 'wwwc'; - OHIF.viewer.refLinesEnabled = true; - OHIF.viewer.isPlaying = {}; - OHIF.viewer.cine = { - framesPerSecond: 24, - loop: true - }; - - OHIF.viewer.functionList = { - invert: element => { - const viewport = cornerstone.getViewport(element); - viewport.invert = !viewport.invert; - cornerstone.setViewport(element, viewport); - }, - resetViewport: element => { - const enabledElement = cornerstone.getEnabledElement(element); - if (enabledElement.fitToWindow === false) { - const imageId = enabledElement.image.imageId; - const instance = cornerstoneTools.metaData.get('instance', imageId); - - enabledElement.viewport = cornerstone.getDefaultViewport(enabledElement.canvas, enabledElement.image); - - const instanceClassDefaultViewport = getInstanceClassDefaultViewport(instance, enabledElement, imageId); - cornerstone.setViewport(element, instanceClassDefaultViewport); - } else { - cornerstone.reset(element); - } - }, - clearTools: element => { - const toolStateManager = cornerstoneTools.globalImageIdSpecificToolStateManager; - toolStateManager.clear(element); - cornerstone.updateImage(element); - } - }; - if (isTouchDevice()) { OHIF.viewer.tooltipConfig = { trigger: 'manual' @@ -96,27 +74,6 @@ Template.viewer.onCreated(() => { }); }); -Template.viewer.onRendered(() => { - const instance = Template.instance(); - - // Enable hotkeys - enableHotkeys(); - - const parentNode = document.getElementById('layoutManagerTarget'); - const studies = instance.data.studies; - layoutManager = new LayoutManager(parentNode, studies); - - ProtocolEngine = new HP.ProtocolEngine(layoutManager, studies); - HP.setEngine(ProtocolEngine); -}); - -Template.viewer.onDestroyed(() => { - log.info('onDestroyed'); - - // Remove the Window resize listener - $(window).off('resize', handleResize); -}); - Template.viewer.events({ 'click .js-toggle-studies'() { const instance = Template.instance(); diff --git a/Packages/hangingprotocols/client/components/hangingProtocolButtons/hangingProtocolButtons.html b/Packages/hangingprotocols/client/components/hangingProtocolButtons/hangingProtocolButtons.html deleted file mode 100644 index b428626e5..000000000 --- a/Packages/hangingprotocols/client/components/hangingProtocolButtons/hangingProtocolButtons.html +++ /dev/null @@ -1,20 +0,0 @@ - \ No newline at end of file diff --git a/Packages/hangingprotocols/client/components/hangingProtocolButtons/hangingProtocolButtons.js b/Packages/hangingprotocols/client/components/hangingProtocolButtons/hangingProtocolButtons.js deleted file mode 100644 index f389147d5..000000000 --- a/Packages/hangingprotocols/client/components/hangingProtocolButtons/hangingProtocolButtons.js +++ /dev/null @@ -1,73 +0,0 @@ -Template.hangingProtocolButtons.helpers({ - /** - * Check if a later stage exists for the user to switch to - * - * @returns {boolean} Whether or not a later stage exists - */ - isNextAvailable: function() { - // Run this helper whenever the ProtocolEngine / LayoutManager has changed - Session.get('LayoutManagerUpdated'); - - // If no ProtocolEngine has been defined yet, stop here - if (!ProtocolEngine) { - return; - } - - // Return whether or not the current stage is the last stage - return ProtocolEngine.stage < ProtocolEngine.getNumProtocolStages() - 1; - }, - /** - * Check if an earlier stage exists for the user to switch to - * - * @returns {boolean} Whether or not an earlier stage exists - */ - isPreviousAvailable: function() { - // Run this helper whenever the ProtocolEngine / LayoutManager has changed - Session.get('LayoutManagerUpdated'); - - // If no ProtocolEngine has been defined yet, stop here - if (!ProtocolEngine) { - return; - } - - // Return whether or not the current stage is the first stage - return ProtocolEngine.stage > 0; - } -}); - -Template.hangingProtocolButtons.events({ - /** - * Switch to the previous Presentation group - * - * @param event The click event on the button - */ - 'click #previousPresentationGroup': function(event) { - // If no ProtocolEngine has been defined yet, do nothing - if (!ProtocolEngine) { - return; - } - - // Hide the button's Bootstrap tooltip in case it was shown - $(event.currentTarget).tooltip('hide'); - - // Instruct the ProtocolEngine to switch to the next stage - ProtocolEngine.previousProtocolStage(); - }, - /** - * Switch to the next Presentation group - * - * @param event The click event on the button - */ - 'click #nextPresentationGroup': function(event) { - // If no ProtocolEngine has been defined yet, do nothing - if (!ProtocolEngine) { - return; - } - - // Hide the button's Bootstrap tooltip in case it was shown - $(event.currentTarget).tooltip('hide'); - - // Instruct the ProtocolEngine to switch to the next stage - ProtocolEngine.nextProtocolStage(); - } -}); diff --git a/Packages/hangingprotocols/client/components/matchedProtocols/matchedProtocols.html b/Packages/hangingprotocols/client/components/matchedProtocols/matchedProtocols.html index 7981cb062..fe0e65d52 100644 --- a/Packages/hangingprotocols/client/components/matchedProtocols/matchedProtocols.html +++ b/Packages/hangingprotocols/client/components/matchedProtocols/matchedProtocols.html @@ -6,7 +6,8 @@ aria-haspopup="true" aria-expanded="false" title="Select Hanging Protocol"> - + + diff --git a/Packages/hangingprotocols/client/components/nextPresentationGroupButton/nextPresentationGroupButton.html b/Packages/hangingprotocols/client/components/nextPresentationGroupButton/nextPresentationGroupButton.html new file mode 100644 index 000000000..515a483e6 --- /dev/null +++ b/Packages/hangingprotocols/client/components/nextPresentationGroupButton/nextPresentationGroupButton.html @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/Packages/hangingprotocols/client/components/nextPresentationGroupButton/nextPresentationGroupButton.js b/Packages/hangingprotocols/client/components/nextPresentationGroupButton/nextPresentationGroupButton.js new file mode 100644 index 000000000..d8e5cb80e --- /dev/null +++ b/Packages/hangingprotocols/client/components/nextPresentationGroupButton/nextPresentationGroupButton.js @@ -0,0 +1,39 @@ +Template.nextPresentationGroupButton.helpers({ + /** + * Check if a later stage exists for the user to switch to + * + * @returns {boolean} Whether or not a later stage exists + */ + nextNotAvailable() { + // Run this helper whenever the ProtocolEngine / LayoutManager has changed + Session.get('LayoutManagerUpdated'); + + // If no ProtocolEngine has been defined yet, stop here + if (!ProtocolEngine) { + return; + } + + // Return whether or not the current stage is the last stage + return ProtocolEngine.stage === ProtocolEngine.getNumProtocolStages() - 1; + } +}); + +Template.nextPresentationGroupButton.events({ + /** + * Switch to the next Presentation group + * + * @param event The click event on the button + */ + 'click #nextPresentationGroup'(event) { + // If no ProtocolEngine has been defined yet, do nothing + if (!ProtocolEngine) { + return; + } + + // Hide the button's Bootstrap tooltip in case it was shown + $(event.currentTarget).tooltip('hide'); + + // Instruct the ProtocolEngine to switch to the next stage + ProtocolEngine.nextProtocolStage(); + } +}); diff --git a/Packages/hangingprotocols/client/components/previousPresentationGroupButton/previousPresentationGroupButton.html b/Packages/hangingprotocols/client/components/previousPresentationGroupButton/previousPresentationGroupButton.html new file mode 100644 index 000000000..d933b693d --- /dev/null +++ b/Packages/hangingprotocols/client/components/previousPresentationGroupButton/previousPresentationGroupButton.html @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/Packages/hangingprotocols/client/components/previousPresentationGroupButton/previousPresentationGroupButton.js b/Packages/hangingprotocols/client/components/previousPresentationGroupButton/previousPresentationGroupButton.js new file mode 100644 index 000000000..4b626e09b --- /dev/null +++ b/Packages/hangingprotocols/client/components/previousPresentationGroupButton/previousPresentationGroupButton.js @@ -0,0 +1,39 @@ +Template.previousPresentationGroupButton.helpers({ + /** + * Check if an earlier stage exists for the user to switch to + * + * @returns {boolean} Whether or not an earlier stage exists + */ + previousNotAvailable() { + // Run this helper whenever the ProtocolEngine / LayoutManager has changed + Session.get('LayoutManagerUpdated'); + + // If no ProtocolEngine has been defined yet, stop here + if (!ProtocolEngine) { + return; + } + + // Return whether or not the current stage is the first stage + return ProtocolEngine.stage === 0; + } +}); + +Template.previousPresentationGroupButton.events({ + /** + * Switch to the previous Presentation group + * + * @param event The click event on the button + */ + 'click #previousPresentationGroup'(event) { + // If no ProtocolEngine has been defined yet, do nothing + if (!ProtocolEngine) { + return; + } + + // Hide the button's Bootstrap tooltip in case it was shown + $(event.currentTarget).tooltip('hide'); + + // Instruct the ProtocolEngine to switch to the next stage + ProtocolEngine.previousProtocolStage(); + } +}); diff --git a/Packages/hangingprotocols/package.js b/Packages/hangingprotocols/package.js index a15a6cce2..3ad8aae32 100755 --- a/Packages/hangingprotocols/package.js +++ b/Packages/hangingprotocols/package.js @@ -45,8 +45,11 @@ Package.onUse(function(api) { api.addFiles('client/helpers/attributes.js', 'client'); // UI Components - api.addFiles('client/components/hangingProtocolButtons/hangingProtocolButtons.html', 'client'); - api.addFiles('client/components/hangingProtocolButtons/hangingProtocolButtons.js', 'client'); + api.addFiles('client/components/previousPresentationGroupButton/previousPresentationGroupButton.html', 'client'); + api.addFiles('client/components/previousPresentationGroupButton/previousPresentationGroupButton.js', 'client'); + + api.addFiles('client/components/nextPresentationGroupButton/nextPresentationGroupButton.html', 'client'); + api.addFiles('client/components/nextPresentationGroupButton/nextPresentationGroupButton.js', 'client'); api.addFiles('client/components/matchedProtocols/matchedProtocols.html', 'client'); api.addFiles('client/components/matchedProtocols/matchedProtocols.styl', 'client'); diff --git a/Packages/lesiontracker/client/components/lesionTracker/lesionTracker.js b/Packages/lesiontracker/client/components/lesionTracker/lesionTracker.js index 93cc12358..fb6398cf3 100644 --- a/Packages/lesiontracker/client/components/lesionTracker/lesionTracker.js +++ b/Packages/lesiontracker/client/components/lesionTracker/lesionTracker.js @@ -3,20 +3,20 @@ // use this to repopulate the variable ViewerData = Session.get('ViewerData') || {}; -var worklistContentId = 'worklistTab'; -var viewerContentId = 'viewerTab'; +const worklistContentId = 'worklistTab'; +const viewerContentId = 'viewerTab'; Template.lesionTracker.onRendered(function() { - var templateData = Template.currentData(); + const templateData = Template.currentData(); if (templateData && templateData.studyInstanceUid) { - var studyInstanceUid = templateData.studyInstanceUid; + const studyInstanceUid = templateData.studyInstanceUid; openNewTab(studyInstanceUid, studyInstanceUid); } else { // If there is a tab set as active in the Session, // switch to that now. - var contentId = Session.get('activeContentId'); + const contentId = Session.get('activeContentId'); - // TODO: FIx this it seems to be forcing two switches + // TODO: Fix this it seems to be forcing two switches switchToTab(contentId); } @@ -25,7 +25,7 @@ Template.lesionTracker.onRendered(function() { Template.lesionTracker.events({ 'click .js-toggle-studyList': function() { - var contentId = Session.get('activeContentId'); + const contentId = Session.get('activeContentId'); if (contentId !== worklistContentId) { switchToTab(worklistContentId); @@ -39,11 +39,11 @@ Session.set('defaultSignInMessage', 'Tumor tracking in your browser.'); Template.lesionTracker.helpers({ studyListToggleText: function() { - var contentId = Session.get('activeContentId'); + const contentId = Session.get('activeContentId'); // If the Viewer has not been opened yet, 'Back to viewer' should // not be displayed - var viewerContentExists = !!Object.keys(ViewerData).length; + const viewerContentExists = !!Object.keys(ViewerData).length; if (!viewerContentExists) { return; } diff --git a/Packages/lesiontracker/client/components/viewer/viewer.js b/Packages/lesiontracker/client/components/viewer/viewer.js index 0b2c53e64..e1a322f0e 100644 --- a/Packages/lesiontracker/client/components/viewer/viewer.js +++ b/Packages/lesiontracker/client/components/viewer/viewer.js @@ -2,6 +2,14 @@ import { OHIF } from 'meteor/ohif:core'; import { TimepointApi } from 'meteor/lesiontracker/lib/api/timepoint'; OHIF.viewer = OHIF.viewer || {}; +OHIF.viewer.loadIndicatorDelay = 3000; +OHIF.viewer.defaultTool = 'wwwc'; +OHIF.viewer.refLinesEnabled = true; +OHIF.viewer.isPlaying = {}; +OHIF.viewer.cine = { + framesPerSecond: 24, + loop: true +}; Session.setDefault('activeViewport', false); Session.setDefault('leftSidebar', null); @@ -12,9 +20,6 @@ Template.viewer.onCreated(() => { instance.data.timepointApi = new TimepointApi(); - // Attach the Window resize listener - $(window).on('resize', handleResize); - ValidationErrors.remove({}); instance.data.state = new ReactiveDict(); @@ -23,49 +28,20 @@ Template.viewer.onCreated(() => { Session.set('currentTimepointId', instance.data.currentTimepointId); - var contentId = instance.data.contentId; + const contentId = instance.data.contentId; - OHIF.viewer.loadIndicatorDelay = 3000; - OHIF.viewer.defaultTool = 'wwwc'; - OHIF.viewer.refLinesEnabled = true; - OHIF.viewer.isPlaying = {}; - OHIF.viewer.cine = { - framesPerSecond: 24, - loop: true - }; - - OHIF.viewer.functionList = { - invert: function(element) { - var viewport = cornerstone.getViewport(element); - viewport.invert = !viewport.invert; - cornerstone.setViewport(element, viewport); - }, - resetViewport: function(element) { - cornerstone.reset(element); - }, - playClip: function(element) { - var viewportIndex = $('.imageViewerViewport').index(element); - var isPlaying = OHIF.viewer.isPlaying[viewportIndex] || false; - if (isPlaying === true) { - cornerstoneTools.stopClip(element); - } else { - cornerstoneTools.playClip(element); - } - - OHIF.viewer.isPlaying[viewportIndex] = !OHIF.viewer.isPlaying[viewportIndex]; - Session.set('UpdateCINE', Random.id()); - }, + OHIF.viewer.functionList = $.extend(OHIF.viewer.functionList, { toggleLesionTrackerTools: toggleLesionTrackerTools, clearTools: clearTools, - bidirectional: function() { + bidirectional: () => { // Used for hotkeys toolManager.setActiveTool('bidirectional'); }, - nonTarget: function() { + nonTarget: () => { // Used for hotkeys toolManager.setActiveTool('nonTarget'); } - }; + }); // The hotkey can also be an array (e.g. ["NUMPAD0", "0"]) OHIF.viewer.defaultHotkeys = OHIF.viewer.defaultHotkeys || {}; @@ -117,23 +93,23 @@ Template.viewer.onCreated(() => { // Update the ViewerStudies collection with the loaded studies ViewerStudies.remove({}); - instance.data.studies.forEach(function(study) { + instance.data.studies.forEach(study => { study.selected = true; ViewerStudies.insert(study); }); - var patientId = instance.data.studies[0].patientId; + const patientId = instance.data.studies[0].patientId; Session.set('patientId', patientId); - instance.autorun(function() { - var dataContext = Template.currentData(); + instance.autorun(() => { + const dataContext = Template.currentData(); instance.subscribe('singlePatientAssociatedStudies', dataContext.studies[0].patientId); instance.subscribe('singlePatientTimepoints', dataContext.studies[0].patientId); instance.subscribe('singlePatientMeasurements', dataContext.studies[0].patientId); instance.subscribe('singlePatientImageMeasurements', dataContext.studies[0].patientId); instance.subscribe('singlePatientAdditionalFindings', dataContext.studies[0].patientId); - var subscriptionsReady = instance.subscriptionsReady(); + const subscriptionsReady = instance.subscriptionsReady(); log.info('autorun viewer.js. Ready: ' + subscriptionsReady); if (subscriptionsReady) { @@ -143,9 +119,9 @@ Template.viewer.onCreated(() => { TrialResponseCriteria.validateAllDelayed(); ViewerStudies.find().observe({ - added: function(study) { + added: study => { // Find the relevant timepoint given the newly added study - var timepoint = Timepoints.findOne({ + const timepoint = Timepoints.findOne({ studyInstanceUids: { $in: [study.studyInstanceUid] } @@ -166,7 +142,7 @@ Template.viewer.onCreated(() => { }); ImageMeasurements.find().observe({ - added: function(data) { + added: data => { if (data.clientId === ClientId) { return; } @@ -176,7 +152,7 @@ Template.viewer.onCreated(() => { // Update each displayed viewport updateAllViewports(); }, - changed: function(data) { + changed: data => { if (data.clientId === ClientId) { return; } @@ -186,7 +162,7 @@ Template.viewer.onCreated(() => { // Update each displayed viewport updateAllViewports(); }, - removed: function(data) { + removed: data => { if (data.clientId === ClientId) { return; } @@ -199,7 +175,7 @@ Template.viewer.onCreated(() => { }); Measurements.find().observe({ - added: function(data) { + added: data => { if (data.clientId === ClientId) { TrialResponseCriteria.validateAllDelayed(); return; @@ -214,7 +190,7 @@ Template.viewer.onCreated(() => { // Update each displayed viewport updateAllViewports(); }, - changed: function(data) { + changed: data => { if (data.clientId === ClientId) { TrialResponseCriteria.validateAllDelayed(); return; @@ -231,7 +207,7 @@ Template.viewer.onCreated(() => { TrialResponseCriteria.validateAllDelayed(); }, - removed: function(data) { + removed: data => { log.info('Measurement removed'); // Check that this Measurement actually contains timepoint data @@ -241,14 +217,14 @@ Template.viewer.onCreated(() => { // Get the Measurement ID and relevant tool so we can remove // tool data for this Measurement - var measurementId = data._id; - var toolType = data.toolType; + const measurementId = data._id; + const toolType = data.toolType; // Remove the measurement from all the imageIds on which it exists // as toolData - Object.keys(data.timepoints).forEach(function(timepointId) { + Object.keys(data.timepoints).forEach(timepointId => { // Clear the toolData for this timepoint - var imageId = data.timepoints[timepointId].imageId; + const imageId = data.timepoints[timepointId].imageId; removeToolDataWithMeasurementId(imageId, toolType, measurementId); // Set reviewer for this timepoint @@ -264,14 +240,14 @@ Template.viewer.onCreated(() => { // find the Measurements, whereas on the server it's // only "greater than", since inside this callback the // Measurements have already been decremented. - var measurements = Measurements.find({ + const measurements = Measurements.find({ patientId: data.patientId, lesionNumberAbsolute: { $gte: data.lesionNumberAbsolute } }); - measurements.forEach(function(measurement) { + measurements.forEach(measurement => { syncMeasurementAndToolData(measurement); }); @@ -289,26 +265,14 @@ Template.viewer.onCreated(() => { }); }); -Template.viewer.onRendered(function() { - // Enable hotkeys - enableHotkeys(); -}); - -Template.viewer.onDestroyed(function() { - // Remove the Window resize listener - $(window).off('resize', handleResize); - - OHIF.viewer.updateImageSynchronizer.destroy(); -}); - Template.viewer.events({ - 'CornerstoneToolsMeasurementAdded .imageViewerViewport': function(e, template, eventData) { - handleMeasurementAdded(e, eventData); + 'CornerstoneToolsMeasurementAdded .imageViewerViewport'(event, instance, eventData) { + handleMeasurementAdded(event, eventData); }, - 'CornerstoneToolsMeasurementModified .imageViewerViewport': function(e, template, eventData) { - handleMeasurementModified(e, eventData); + 'CornerstoneToolsMeasurementModified .imageViewerViewport'(event, instance, eventData) { + handleMeasurementModified(event, eventData); }, - 'CornerstoneToolsMeasurementRemoved .imageViewerViewport': function(e, template, eventData) { - handleMeasurementRemoved(e, eventData); + 'CornerstoneToolsMeasurementRemoved .imageViewerViewport'(event, instance, eventData) { + handleMeasurementRemoved(event, eventData); } }); diff --git a/Packages/viewerbase/client/components/viewer/cineDialog/cineDialog.html b/Packages/viewerbase/client/components/viewer/cineDialog/cineDialog.html index 562617b8c..ba92ad778 100644 --- a/Packages/viewerbase/client/components/viewer/cineDialog/cineDialog.html +++ b/Packages/viewerbase/client/components/viewer/cineDialog/cineDialog.html @@ -1,41 +1,47 @@