Implementing saving behavior per active viewport
This commit is contained in:
parent
98480d134b
commit
5dc2f8dc9c
@ -21,7 +21,7 @@ Meteor.startup(() => {
|
||||
name: 'UN Target'
|
||||
}];
|
||||
customTools.forEach(tool => {
|
||||
_.defaults(OHIF.hotkeys.defaults.viewer, { [tool.id]: '' });
|
||||
_.defaults(OHIF.hotkeys.defaults[contextName], { [tool.id]: '' });
|
||||
OHIF.commands.register(contextName, tool.id, {
|
||||
name: tool.name,
|
||||
action: tool.action || (() => toolManager.setActiveTool(tool.id))
|
||||
@ -35,10 +35,36 @@ Meteor.startup(() => {
|
||||
action: OHIF.viewerbase.viewportUtils.linkStackScroll
|
||||
}];
|
||||
customCommands.forEach(command => {
|
||||
_.defaults(OHIF.hotkeys.defaults.viewer, { [command.id]: '' });
|
||||
_.defaults(OHIF.hotkeys.defaults[contextName], { [command.id]: '' });
|
||||
OHIF.commands.register(contextName, command.id, {
|
||||
name: command.name,
|
||||
action: command.action || (() => toolManager.setActiveTool(command.id))
|
||||
});
|
||||
});
|
||||
|
||||
// Add the save command
|
||||
OHIF.commands.register(contextName, 'storeMeasurements', () => {
|
||||
// Register the hotkey default
|
||||
_.defaults(OHIF.hotkeys.defaults[contextName], { storeMeasurements: '' });
|
||||
|
||||
// Clear signaled unsaved changes...
|
||||
const successHandler = () => {
|
||||
OHIF.ui.unsavedChanges.clear(`${instance.path}.*`);
|
||||
instance.saveObserver.changed();
|
||||
};
|
||||
|
||||
// Display the error messages
|
||||
const errorHandler = data => {
|
||||
OHIF.ui.showDialog('dialogInfo', Object.assign({ class: 'themed' }, data));
|
||||
};
|
||||
|
||||
const promise = OHIF.viewer.measurementApi.storeMeasurements();
|
||||
promise.then(successHandler).catch(errorHandler);
|
||||
OHIF.ui.showDialog('dialogLoading', {
|
||||
promise,
|
||||
text: 'Saving measurement data'
|
||||
});
|
||||
|
||||
return promise;
|
||||
});
|
||||
});
|
||||
|
||||
@ -3,6 +3,7 @@ import './longitudinalStudyListStudy/longitudinalStudyListStudy.html';
|
||||
import './longitudinalStudyListStudy/longitudinalStudyListStudy.styl';
|
||||
import './longitudinalStudyListStudy/longitudinalStudyListStudy.js';
|
||||
|
||||
import './longitudinalViewportOverlay/imageViewportIcons.html';
|
||||
import './longitudinalViewportOverlay/longitudinalViewportOverlay.html';
|
||||
import './longitudinalViewportOverlay/longitudinalViewportOverlay.js';
|
||||
|
||||
|
||||
@ -0,0 +1 @@
|
||||
<template name="imageViewportIcons"></template>
|
||||
@ -9,13 +9,14 @@
|
||||
<div class="topright dicomTag">
|
||||
<div>{{studyDescription}}</div>
|
||||
<div>{{formatDA studyDate}} {{formatTM studyTime}}</div>
|
||||
{{#if linked}}
|
||||
<div class="link-icon">
|
||||
<div class="icons-section">
|
||||
{{>imageViewportIcons this}}
|
||||
{{#if linked}}
|
||||
<svg>
|
||||
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href={{absoluteUrl "packages/ohif_viewerbase/assets/icons.svg#icon-viewport-link"}}></use>
|
||||
</svg>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottomright dicomTag">
|
||||
<div>{{#if zoom}}Zoom: {{formatNumberPrecision zoom 0}}%{{/if}}</div>
|
||||
|
||||
@ -94,7 +94,10 @@ Template.measurementTableRow.events({
|
||||
_.each($('.imageViewerViewport'), element => cornerstone.updateImage(element));
|
||||
|
||||
// Notify that viewer suffered changes
|
||||
OHIF.ui.unsavedChanges.set('viewer.studyViewer.measurements.deleted');
|
||||
const { timepointId } = measurement;
|
||||
const basePath = 'viewer.studyViewer.measurements';
|
||||
const timepointPath = timepointId ? `.${timepointId}` : '';
|
||||
OHIF.ui.unsavedChanges.set(`${basePath}${timepointPath}.deleted`);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -90,5 +90,8 @@ export default function ({ instance, eventData, tool, toolGroupId, toolGroup })
|
||||
}
|
||||
|
||||
// Signal unsaved changes
|
||||
OHIF.ui.unsavedChanges.set('viewer.studyViewer.measurements.' + eventData.toolType);
|
||||
const { timepointId } = Collection.findOne(measurementData._id);
|
||||
const basePath = 'viewer.studyViewer.measurements';
|
||||
const timepointPath = timepointId ? `.${timepointId}` : '';
|
||||
OHIF.ui.unsavedChanges.set(`${basePath}${timepointPath}.${eventData.toolType}`);
|
||||
}
|
||||
|
||||
@ -36,5 +36,8 @@ export default function ({ instance, eventData, tool, toolGroupId, toolGroup })
|
||||
Collection.update(measurement._id, { $set: { [tool.attribute]: childMeasurement } });
|
||||
|
||||
// Signal unsaved changes
|
||||
OHIF.ui.unsavedChanges.set('viewer.studyViewer.measurements.' + eventData.toolType);
|
||||
const { timepointId } = Collection.findOne(measurementData._id);
|
||||
const basePath = 'viewer.studyViewer.measurements';
|
||||
const timepointPath = timepointId ? `.${timepointId}` : '';
|
||||
OHIF.ui.unsavedChanges.set(`${basePath}${timepointPath}.${eventData.toolType}`);
|
||||
}
|
||||
|
||||
@ -36,5 +36,8 @@ export default function ({ instance, eventData, tool, toolGroupId, toolGroup })
|
||||
_.each($('.imageViewerViewport'), element => cornerstone.updateImage(element));
|
||||
|
||||
// Signal unsaved changes
|
||||
OHIF.ui.unsavedChanges.set('viewer.studyViewer.measurements.' + eventData.toolType);
|
||||
const { timepointId } = Collection.findOne(measurementData._id);
|
||||
const basePath = 'viewer.studyViewer.measurements';
|
||||
const timepointPath = timepointId ? `.${timepointId}` : '';
|
||||
OHIF.ui.unsavedChanges.set(`${basePath}${timepointPath}.${eventData.toolType}`);
|
||||
}
|
||||
|
||||
@ -49,5 +49,8 @@ export default function ({ instance, eventData, tool }) {
|
||||
});
|
||||
|
||||
// Signal unsaved changes
|
||||
OHIF.ui.unsavedChanges.set('viewer.studyViewer.measurements.' + eventData.toolType);
|
||||
const { timepointId } = Collection.findOne(measurementData._id);
|
||||
const basePath = 'viewer.studyViewer.measurements';
|
||||
const timepointPath = timepointId ? `.${timepointId}` : '';
|
||||
OHIF.ui.unsavedChanges.set(`${basePath}${timepointPath}.${eventData.toolType}`);
|
||||
}
|
||||
|
||||
@ -38,5 +38,8 @@ export default function ({ instance, eventData, tool, toolGroupId, toolGroup })
|
||||
Collection.update(measurementId, { $set: measurement });
|
||||
|
||||
// Signal unsaved changes
|
||||
OHIF.ui.unsavedChanges.set('viewer.studyViewer.measurements.' + eventData.toolType);
|
||||
const { timepointId } = Collection.findOne(measurementData._id);
|
||||
const basePath = 'viewer.studyViewer.measurements';
|
||||
const timepointPath = timepointId ? `.${timepointId}` : '';
|
||||
OHIF.ui.unsavedChanges.set(`${basePath}${timepointPath}.${eventData.toolType}`);
|
||||
}
|
||||
|
||||
@ -33,5 +33,7 @@ export default function({ instance, eventData, tool, toolGroupId, toolGroup }) {
|
||||
_.each($('.imageViewerViewport'), element => cornerstone.updateImage(element));
|
||||
|
||||
// Signal unsaved changes
|
||||
OHIF.ui.unsavedChanges.set('viewer.studyViewer.measurements.' + eventData.toolType);
|
||||
const basePath = 'viewer.studyViewer.measurements';
|
||||
const timepointPath = timepointId ? `.${timepointId}` : '';
|
||||
OHIF.ui.unsavedChanges.set(`${basePath}${timepointPath}.${eventData.toolType}`);
|
||||
}
|
||||
|
||||
@ -60,7 +60,10 @@ OHIF.measurements.toggleLabelButton = options => {
|
||||
options.measurement.description = description;
|
||||
|
||||
// Notify that viewer suffered changes
|
||||
OHIF.ui.unsavedChanges.set('viewer.studyViewer.measurements.renamed');
|
||||
const { timepointId } = measurement;
|
||||
const basePath = 'viewer.studyViewer.measurements';
|
||||
const timepointPath = timepointId ? `.${timepointId}` : '';
|
||||
OHIF.ui.unsavedChanges.set(`${basePath}${timepointPath}.renamed`);
|
||||
}
|
||||
};
|
||||
buttonView = Blaze.renderWithData(Template.measureFlow, data, document.body);
|
||||
|
||||
@ -48,4 +48,3 @@ $viewportTagPadding = 20px
|
||||
margin: 2px
|
||||
width: 18px
|
||||
height: 18px
|
||||
|
||||
Loading…
Reference in New Issue
Block a user