ohif-viewer/OHIFViewer/client/components/toolbarSection/toolbarSection.js
Egor Lezhnin 9486522552 feat(google-cloud): Add support for Google Cloud Healthcare API DICOM Store Switch (#325)
* NOTASK: PoC for loading data from Healthcare API

* NOTASK: PoC for loading data from Healthcare API fix

* Add sample dialog for loading test dicom-picker

* Fix incorrect promise resolving

* NOTASK: PoC for loading dicom store

* Add web-components as git submodules. (Probably will be changed later)

* Add rough dicomStore picker

* Add dataset selector

* NOTASK: QIDO metadata first draft

* NOTASK: Not Implemented error for color images

* NOTASK: clean-up

* Dicom files uploader intermediate version

* NOTASK: Accept header

* NOTASK: docker configs

* NOTASK: fix

* NOTASK: howTo

* Add draft of DICOM uploader

* Add missing files

* Fix error with missing clientId

* Update submodule

* NOTASK: HowTo

* NOTASK: config for dev

* NOTASK: new docker file

* clean-up

* Update GCP web-components

* Add integration with async web components

* Fix errors in nginx.conf

* Structured reports views basic implementation

* NOTASK: qido -> wado

* NOTASK: config fix

* NOTASK: dirty copy-paste implementation

* Add "Change dicom store" button.
Add an ability to clear date.
Fix bug, when OAuth dosn't work if URL is not /

* Fix studylist filtering

* Fix dockerfile

* NOTASK: meteor update

* NOTASK: fix of package structure

* NOTASK: merge fix

* improvements

Move check for now SR into SR modal
Use simple button to open SR modal
Remove button styling
cleanup

* copy SR data retrieval to wado

* make search of SR simpler

* Codestyle fix

* NOTASK: palette color error message

* Fix date filter.
Fix server settings on first loading.
Add SR and PS buttons

* NOTASK: PS is now hidden by default

* NOTASK: dirty solution

* NOTASK:  new wadoimage lib version

* Fix PS and SR buttons

* Make modal dialogs vertically centered

* Update web components. Quick UI fixes

* Add missing files to the previous commit

* NOTASK:  show-hide for PS

* NOTASK:  show-hide for PS

* NOTASK:  fix of min-max PixelValue bug

* Add "sign out" functionality for Google OAuth. Update web-components.

* intermediate commit

* Add demo signin page

* Beautifying demo sign in page

* NOTASK:  merge

* NOTASK:  clean-up

* Use npm for getting healthcare-api-adapter instead of git submodule.

* NOTASK:  clean-up

* meteor update

* clean-up

* clean-up

* Clean up code

* Update healthcare-api-adapter version. Add location to dicom store path. Fix buttons style.

* Downgrade meteor and packages to master version. Use meteor-build-client-fixed2
2019-03-22 16:42:26 +01:00

337 lines
9.7 KiB
JavaScript

import { Template } from 'meteor/templating';
import { $ } from 'meteor/jquery';
import { OHIF } from 'meteor/ohif:core';
import 'meteor/ohif:viewerbase';
function isThereSeries(studies) {
if (studies.length === 1) {
const study = studies[0];
if (study.seriesList && study.seriesList.length > 1) {
return true;
}
if (study.displaySets && study.displaySets.length > 1) {
return true;
}
}
return false;
}
Template.toolbarSection.onCreated(() => {
const instance = Template.instance();
if (OHIF.uiSettings.leftSidebarOpen && isThereSeries(instance.data.studies)) {
instance.data.state.set('leftSidebar', 'studies');
}
});
Template.toolbarSection.helpers({
leftSidebarToggleButtonData() {
const instance = Template.instance();
return {
toggleable: true,
key: 'leftSidebar',
value: instance.data.state,
options: [{
value: 'studies',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-studies',
svgWidth: 15,
svgHeight: 13,
bottomLabel: 'Series'
}]
};
},
rightSidebarToggleButtonData() {
const instance = Template.instance();
// TODO: Figured out a way to handle both right panel contents
// return {
// toggleable: true,
// key: 'rightSidebar',
// value: instance.data.state,
// options: [{
// value: 'hangingprotocols',
// iconClasses: 'fa fa-cog',
// bottomLabel: 'Hanging'
// }]
// };
return {
toggleable: true,
key: 'rightSidebar',
value: instance.data.state,
options: [{
value: 'measurements',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-measurements-lesions',
svgWidth: 18,
svgHeight: 10,
bottomLabel: 'Measurements'
}]
};
},
toolbarButtons() {
const extraTools = [];
extraTools.push({
id: 'crosshairs',
title: 'Crosshairs',
classes: 'imageViewerTool',
iconClasses: 'fa fa-crosshairs'
});
extraTools.push({
id: 'magnify',
title: 'Magnify',
classes: 'imageViewerTool toolbarSectionButton',
iconClasses: 'fa fa-circle'
});
extraTools.push({
id: 'wwwcRegion',
title: 'ROI Window',
classes: 'imageViewerTool',
iconClasses: 'fa fa-square'
});
extraTools.push({
id: 'dragProbe',
title: 'Probe',
classes: 'imageViewerTool',
iconClasses: 'fa fa-dot-circle-o'
});
extraTools.push({
id: 'ellipticalRoi',
title: 'Ellipse',
classes: 'imageViewerTool',
iconClasses: 'fa fa-circle-o'
});
extraTools.push({
id: 'rectangleRoi',
title: 'Rectangle',
classes: 'imageViewerTool',
iconClasses: 'fa fa-square-o'
});
extraTools.push({
id: 'toggleDownloadDialog',
title: 'Download',
classes: 'imageViewerCommand',
iconClasses: 'fa fa-camera',
active: () => $('#downloadDialog').is(':visible')
});
extraTools.push({
id: 'invert',
title: 'Invert',
classes: 'imageViewerCommand',
iconClasses: 'fa fa-adjust'
});
extraTools.push({
id: 'rotateR',
title: 'Rotate Right',
classes: 'imageViewerCommand',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-rotate-right'
});
extraTools.push({
id: 'flipH',
title: 'Flip H',
classes: 'imageViewerCommand',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-flip-horizontal'
});
extraTools.push({
id: 'flipV',
title: 'Flip V',
classes: 'imageViewerCommand',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-flip-vertical'
});
extraTools.push({
id: 'clearTools',
title: 'Clear',
classes: 'imageViewerCommand',
iconClasses: 'fa fa-trash'
});
const buttonData = [];
buttonData.push({
id: 'stackScroll',
title: 'Stack Scroll',
classes: 'imageViewerTool',
iconClasses: 'fa fa-bars'
});
buttonData.push({
id: 'zoom',
title: 'Zoom',
classes: 'imageViewerTool',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-zoom'
});
buttonData.push({
id: 'wwwc',
title: 'Levels',
classes: 'imageViewerTool',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-levels'
});
buttonData.push({
id: 'pan',
title: 'Pan',
classes: 'imageViewerTool',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-pan'
});
buttonData.push({
id: 'length',
title: 'Length',
classes: 'imageViewerTool toolbarSectionButton',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-temp'
});
buttonData.push({
id: 'annotate',
title: 'Annotate',
classes: 'imageViewerTool',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-non-target'
});
buttonData.push({
id: 'angle',
title: 'Angle',
classes: 'imageViewerTool',
iconClasses: 'fa fa-angle-left'
});
buttonData.push({
id: 'resetViewport',
title: 'Reset',
classes: 'imageViewerCommand',
iconClasses: 'fa fa-undo'
});
if (!OHIF.uiSettings.displayEchoUltrasoundWorkflow) {
buttonData.push({
id: 'previousDisplaySet',
title: 'Previous',
classes: 'imageViewerCommand',
iconClasses: 'fa fa-toggle-up fa-fw'
});
buttonData.push({
id: 'nextDisplaySet',
title: 'Next',
classes: 'imageViewerCommand',
iconClasses: 'fa fa-toggle-down fa-fw'
});
const { isPlaying } = OHIF.viewerbase.viewportUtils;
buttonData.push({
id: 'toggleCinePlay',
title: () => isPlaying() ? 'Stop' : 'Play',
classes: 'imageViewerCommand',
iconClasses: () => ('fa fa-fw ' + (isPlaying() ? 'fa-stop' : 'fa-play')),
active: isPlaying
});
buttonData.push({
id: 'toggleCineDialog',
title: 'CINE',
classes: 'imageViewerCommand',
iconClasses: 'fa fa-youtube-play',
active: () => $('#cineDialog').is(':visible')
});
}
buttonData.push({
id: 'layout',
title: 'Layout',
iconClasses: 'fa fa-th-large',
buttonTemplateName: 'layoutButton'
});
buttonData.push({
id: 'sr',
title: 'SR',
classes: 'imageViewerTool',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-sr'
});
buttonData.push({
id: 'ps',
title: 'PS',
iconClasses: 'fa fa-th-large',
classes: 'imageViewerTool',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-ps'
});
buttonData.push({
id: 'toggleMore',
title: 'More',
classes: 'rp-x-1 rm-l-3',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-more',
subTools: extraTools
});
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;
}
});
Template.toolbarSection.onRendered(function() {
const instance = Template.instance();
instance.$('#layout').dropdown();
if (OHIF.uiSettings.displayEchoUltrasoundWorkflow) {
OHIF.viewerbase.viewportUtils.toggleCineDialog();
}
// Set disabled/enabled tool buttons that are set in toolManager
const states = OHIF.viewerbase.toolManager.getToolDefaultStates();
const disabledToolButtons = states.disabledToolButtons;
const allToolbarButtons = $('#toolbar').find('button');
if (disabledToolButtons && disabledToolButtons.length > 0) {
for (let i = 0; i < allToolbarButtons.length; i++) {
const toolbarButton = allToolbarButtons[i];
$(toolbarButton).prop('disabled', false);
const index = disabledToolButtons.indexOf($(toolbarButton).attr('id'));
if (index !== -1) {
$(toolbarButton).prop('disabled', true);
}
}
}
});