From 710d7c9a024df67d5a0fa8152fc34162f319ad8d Mon Sep 17 00:00:00 2001 From: Bruno Alves de Faria Date: Thu, 23 Feb 2017 14:01:16 -0300 Subject: [PATCH] Allowing follow-up number to be controlled by configuration --- .../client/protocolEngine.js | 2 +- .../both/configuration/timepoints.js | 2 ++ .../both/schema/timepoints.js | 5 +++ .../client/lib/getTimepointName.js | 2 ++ .../client/lib/classes/LayoutManager.js | 33 +++++++++---------- 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/Packages/ohif-hanging-protocols/client/protocolEngine.js b/Packages/ohif-hanging-protocols/client/protocolEngine.js index e031da570..47c646455 100644 --- a/Packages/ohif-hanging-protocols/client/protocolEngine.js +++ b/Packages/ohif-hanging-protocols/client/protocolEngine.js @@ -642,7 +642,7 @@ HP.ProtocolEngine = class ProtocolEngine { } if (!currentViewportData.displaySetInstanceUid) { - throw 'No matching display set found?'; + throw new Meteor.Error('No matching display set found?'); } viewportData.push(currentViewportData); diff --git a/Packages/ohif-measurements/both/configuration/timepoints.js b/Packages/ohif-measurements/both/configuration/timepoints.js index 8dd63c752..fe4610316 100644 --- a/Packages/ohif-measurements/both/configuration/timepoints.js +++ b/Packages/ohif-measurements/both/configuration/timepoints.js @@ -220,6 +220,8 @@ class TimepointApi { // Check if this is a Baseline timepoint, if it is, return 'Baseline' if (timepoint.timepointType === 'baseline') { return 'Baseline'; + } else if (timepoint.visitNumber) { + return 'Follow-up ' + timepoint.visitNumber; } // Retrieve all of the relevant follow-up timepoints for this patient diff --git a/Packages/ohif-measurements/both/schema/timepoints.js b/Packages/ohif-measurements/both/schema/timepoints.js index 11fe73173..3b52c5064 100644 --- a/Packages/ohif-measurements/both/schema/timepoints.js +++ b/Packages/ohif-measurements/both/schema/timepoints.js @@ -27,5 +27,10 @@ export const schema = new SimpleSchema({ latestDate: { type: Date, label: 'Most recent Study Date from associated studies', + }, + visitNumber: { + type: Number, + label: 'Number of patient\'s visit', + optional: true } }); diff --git a/Packages/ohif-measurements/client/lib/getTimepointName.js b/Packages/ohif-measurements/client/lib/getTimepointName.js index 9911a0d4e..9a61651d9 100644 --- a/Packages/ohif-measurements/client/lib/getTimepointName.js +++ b/Packages/ohif-measurements/client/lib/getTimepointName.js @@ -12,6 +12,8 @@ OHIF.measurements.getTimepointName = timepoint => { // Check if this is a Baseline timepoint, if it is, return 'Baseline' if (timepoint.timepointType === 'baseline') { return 'Baseline'; + } else if (timepoint.visitNumber) { + return 'Follow-up ' + timepoint.visitNumber; } // Retrieve all of the relevant follow-up timepoints for this patient diff --git a/Packages/ohif-viewerbase/client/lib/classes/LayoutManager.js b/Packages/ohif-viewerbase/client/lib/classes/LayoutManager.js index a181af2fb..3daf6253d 100644 --- a/Packages/ohif-viewerbase/client/lib/classes/LayoutManager.js +++ b/Packages/ohif-viewerbase/client/lib/classes/LayoutManager.js @@ -12,8 +12,8 @@ import { OHIF } from 'meteor/ohif:core'; export class LayoutManager { /** * Constructor: initializes a Layout Manager object. - * @param {DOM element} parentNode DOM element representing the parent node, which wraps the Layout Manager content - * @param {Array} studies Array of studies objects that will be rendered in the Viewer. Each object will be rendered in a div.imageViewerViewport + * @param {DOM element} parentNode DOM element representing the parent node, which wraps the Layout Manager content + * @param {Array} studies Array of studies objects that will be rendered in the Viewer. Each object will be rendered in a div.imageViewerViewport */ constructor(parentNode, studies) { OHIF.log.info('LayoutManager constructor'); @@ -80,9 +80,7 @@ export class LayoutManager { // Get all the display sets for the viewer studies let displaySets = []; this.studies.forEach(study => { - study.displaySets.forEach(displaySet => { - displaySet.images.length && displaySets.push(displaySet); - }); + study.displaySets.forEach(dSet => dSet.images.length && displaySets.push(dSet)); }); // Get the display sets that will be appended to the current ones @@ -143,7 +141,7 @@ export class LayoutManager { */ updateLayoutClass() { const newLayoutClass = this.getLayoutClass(); - + // If layout has changed, change its class if (this.layoutClassName !== newLayoutClass) { this.parentNode.classList.remove(this.layoutClassName); @@ -155,9 +153,9 @@ export class LayoutManager { } /** - * Updates the grid with the new layout props. + * Updates the grid with the new layout props. * It iterates over all viewportData to render the studies - * in the viewports. + * in the viewports. * If no viewportData or no viewports defined, it renders the default viewport data. */ updateViewports() { @@ -176,7 +174,7 @@ export class LayoutManager { viewportData: [] }, layoutProps); - this.viewportData.forEach( viewportData => { + this.viewportData.forEach(viewportData => { const viewportDataAndLayoutProps = $.extend(viewportData, layoutProps); data.viewportData.push(viewportDataAndLayoutProps); }); @@ -266,7 +264,7 @@ export class LayoutManager { columns: 1 }; - const layoutTemplate = Template['gridLayout']; + const layoutTemplate = Template.gridLayout; $(this.parentNode).html(''); Blaze.renderWithData(layoutTemplate, data, this.parentNode); @@ -279,7 +277,7 @@ export class LayoutManager { } /** - * Resets to the previous layout configuration. + * Resets to the previous layout configuration. * Useful after enlarging a single viewport. */ resetPreviousLayout() { @@ -305,8 +303,7 @@ export class LayoutManager { if (this.isZoomed) { this.resetPreviousLayout(); - } - else { + } else { // Don't enlarge the viewport if we only have one Viewport // to begin with if (this.getNumberOfViewports() > 1) { @@ -416,7 +413,7 @@ export class LayoutManager { // Get the setting that defines if the display set navigation is multiple const isMultiple = OHIF.uiSettings.displaySetNavigationMultipleViewports; - + // Get the setting that allow display set navigation looping over series const allowLooping = OHIF.uiSettings.displaySetNavigationLoopOverSeries; @@ -446,7 +443,7 @@ export class LayoutManager { const amount = study.displaySets.length; const move = !isMultiple ? 1 : ((amount % layoutViewports) || layoutViewports); const lastStepIndex = amount - move; - + // 9999 for index means empty viewport, see getDisplaySetSequenceMap function if (viewportIndex !== 9999 && viewportIndex !== lastStepIndex) { endReached = false; @@ -464,7 +461,7 @@ export class LayoutManager { // Check if the begin was reached let beginReached = true; - if(activeViewportIndex >= 0) { + if (activeViewportIndex >= 0) { sequenceMap.forEach((studyViewports, study) => { // Get active viewport index if isMultiple is false ortherwise get first const studyViewport = studyViewports[activeViewportIndex !== null ? activeViewportIndex : 0]; @@ -650,7 +647,7 @@ export class LayoutManager { */ moveDisplaySets(isNext) { OHIF.log.info('LayoutManager moveDisplaySets'); - + //Check if navigation is on a single or multiple viewports if (OHIF.uiSettings.displaySetNavigationMultipleViewports) { // Move display sets on multiple viewports @@ -682,4 +679,4 @@ export class LayoutManager { return this.layoutProps.row !== 1 && this.layoutProps.columns !== 1; } -}; +}