wip, very broken as I moved stuff to ohif-core

This commit is contained in:
Erik Ziegler committed 2018-12-14 14:38:36 +01:00
1 parent 7b66dec163
commit d541c23117
418 files changed
+402 -19154

No files matched your search

@@ -1,4 +1,4 @@
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
Template.aboutModal.helpers({
githubUrl() {
@@ -1,3 +0,0 @@
<template name="layout">
{{>yield }}
</template>
@@ -3,7 +3,7 @@ import { ReactiveVar } from 'meteor/reactive-var';
import { Tracker } from 'meteor/tracker';
import $ from 'jquery';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
Template.studyBrowserItem.onCreated(() => {
const instance = Template.instance();
@@ -1,7 +1,7 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { Tracker } from 'meteor/tracker';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
Template.studyBrowserQuickSwitch.onCreated(() => {
const instance = Template.instance();
@@ -1,7 +1,7 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { Tracker } from 'meteor/tracker';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
Template.studyBrowserSeries.onCreated(() => {
const instance = Template.instance();
@@ -1,10 +1,9 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Blaze } from 'meteor/blaze';
import moment from 'moment';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
Template.dialogStudyAssociation.onCreated(() => {
@@ -1,6 +1,6 @@
import { Template } from 'meteor/templating';
import moment from 'moment';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
/**
* Finds related studies within defined time window of =/- 14 days of selected studies
@@ -1,6 +1,6 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
Template.caseProgress.onCreated(() => {
const instance = Template.instance();
@@ -1,5 +1,5 @@
import { Template } from 'meteor/templating';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
Template.measurementEditDescription.onRendered(() => {
@@ -1,7 +1,7 @@
import { Template } from 'meteor/templating';
import _ from 'underscore';
import $ from 'jquery';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
import { cornerstone } from 'meteor/ohif:cornerstone';
const getPosition = event => {
@@ -1,6 +1,6 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
Template.measurementLightTableView.onCreated(() => {
const instance = Template.instance();
@@ -7,10 +7,6 @@ import './measurementTableView/measurementTableView.html';
import './measurementTableView/measurementTableView.styl';
import './measurementTableView/measurementTableView.js';
import './measurementTableHUD/measurementTableHUD.html';
import './measurementTableHUD/measurementTableHUD.styl';
import './measurementTableHUD/measurementTableHUD.js';
import './measurementTableRow/measurementTableRow.html';
import './measurementTableRow/measurementTableRow.styl';
import './measurementTableRow/measurementTableRow.js';
@@ -1,7 +1,7 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
Template.measurementTable.onCreated(() => {
const instance = Template.instance();
@@ -1,20 +0,0 @@
<template name="measurementTableHUD">
<div id="measurementTableHUD" class="{{hudHidden}}">
<div class="flex-v full-height">
<div class="header">
<span>Measurements</span>
<svg class="buttonClose">
<use xlink:href={{absoluteUrl "packages/ohif_viewerbase/assets/icons.svg#icon-ui-close"}}></use>
</svg>
</div>
{{#scrollArea class='measurementTableView flex-grow fit' scrollStep=63}}
{{>measurementTableView (clone this isHud=true)}}
{{/scrollArea}}
<div class="footer">
{{#each toolbarButton in toolbarButtons}}
{{>toolbarSectionButton toolbarButton}}
{{/each}}
</div>
</div>
</div>
</template>
@@ -1,72 +0,0 @@
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { ReactiveVar } from 'meteor/reactive-var';
Template.measurementTableHUD.onCreated(() => {
const instance = Template.instance();
const timepointApi = instance.data.timepointApi;
instance.isRemoved = true;
if (timepointApi) {
instance.data.timepoints = new ReactiveVar(timepointApi.currentAndPrior());
}
});
Template.measurementTableHUD.onDestroyed(() => {
const instance = Template.instance();
instance.isRemoved = true;
Session.set('measurementTableHudOpen', false);
});
Template.measurementTableHUD.onRendered(() => {
const instance = Template.instance();
instance.$('#measurementTableHUD').resizable().draggable().bounded();
});
Template.measurementTableHUD.events({
'click .buttonClose'(event, instance) {
Session.set('measurementTableHudOpen', false);
}
});
Template.measurementTableHUD.helpers({
hudHidden() {
let instance = Template.instance(),
isOpen = Session.get('measurementTableHudOpen');
if (isOpen) {
instance.isRemoved = false;
return 'dialog-animated dialog-open';
}
return instance.isRemoved !== true ? 'dialog-animated dialog-closed' : 'hidden';
},
toolbarButtons() {
let buttonData = [];
buttonData.push({
id: 'bidirectional',
title: 'Target',
classes: 'imageViewerTool toolbarSectionButton',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-target'
});
buttonData.push({
id: 'nonTarget',
title: 'Non-Target',
classes: 'imageViewerTool toolbarSectionButton',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-non-target'
});
buttonData.push({
id: 'length',
title: 'Temp',
classes: 'imageViewerTool toolbarSectionButton',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-temp'
});
return buttonData;
}
});
@@ -1,95 +0,0 @@
@require '{ohif:viewerbase}/app'
$borderColor = rgba(77, 99, 110, 0.81)
#measurementTableHUD
background: rgba(0, 0, 0, 0.95)
border-radius: 8px
border: solid 1px $borderColor;
bottom: 3px
height: 326px
left: auto
overflow: hidden
position: absolute
right: 3px
top: auto
width: 318px
z-index: 1
.measurementTableView .scrollable
margin-left: 0
padding-left: 0
.header
theme('background', '$uiGrayDarkest')
theme('color', '$textSecondaryColor')
border-bottom: $uiBorderThickness solid $borderColor
font-weight: 300
font-size: 20px
height: 55px
line-height: 55px
position: relative
text-align: center
width: 100%
svg.buttonClose
theme('color', '$defaultColor')
cursor: pointer
height: 14px
position: absolute
right: 14px
theme('stroke', '$defaultColor')
top: 20px
width: 14px
.measurementTableView
height: calc(100% - 55px - 70px)
padding-bottom: 20px
.footer
theme('background', '$uiGrayDarkest')
border-top: $uiBorderThickness solid $borderColor
height: 70px
padding: 10px
.toolbarSectionButton
display: inline-block
theme('color', '$defaultColor')
theme('fill', '$defaultColor')
theme('stroke', '$defaultColor')
padding: 0 10px
height: $toolbarHeight
min-width: 30px
cursor: pointer
text-align: center
&.disabled
opacity: 0.5
cursor: not-allowed
.buttonLabel
font-size: 12px
.svgContainer
margin: 0 auto
text-align: center
svg
background-color: transparent
margin: 2px
width: 21px
height: 21px
&:active, &.active
theme('color', '$activeColor')
svg
theme('fill', '$activeColor')
theme('stroke', '$activeColor')
&:hover
theme('color', '$hoverColor')
svg
theme('fill', '$hoverColor')
theme('stroke', '$hoverColor')
@@ -1,5 +1,5 @@
import { Template } from 'meteor/templating';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
import { Viewerbase } from 'meteor/ohif:viewerbase';
Template.measurementTableHeaderRow.helpers({
@@ -1,7 +1,7 @@
import { Template } from 'meteor/templating';
import _ from 'underscore';
import $ from 'jquery';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
import { cornerstone } from 'meteor/ohif:cornerstone';
Template.measurementTableRow.onCreated(() => {
@@ -1,7 +1,7 @@
import { Template } from 'meteor/templating';
import _ from 'underscore';
import $ from 'jquery';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
import { cornerstone } from 'meteor/ohif:cornerstone';
Template.measurementTableTimepointCell.helpers({
@@ -2,7 +2,7 @@ import { Template } from 'meteor/templating';
import { Tracker } from 'meteor/tracker';
import { ReactiveVar } from 'meteor/reactive-var';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
Template.measurementTableView.onCreated(() => {
const instance = Template.instance();
@@ -1,4 +1,4 @@
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import _ from 'underscore';
@@ -1,4 +1,4 @@
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Tracker } from 'meteor/tracker';
@@ -7,7 +7,7 @@ import _ from 'underscore';
import $ from 'jquery';
// TODO: use npm dependency
import transition from 'meteor/ohif:core/client/lib/third-party/transition-to-from-auto';
import transition from 'ohif-core/client/lib/third-party/transition-to-from-auto';
Template.selectTree.onCreated(() => {
const instance = Template.instance();
@@ -10,6 +10,6 @@ import './serverInformationForm/serverInformationForm.js';
import './serverInformationList/serverInformationList.html';
import './serverInformationList/serverInformationList.js';
import './serverInformationModal/serverInformationModal.html';
/*import './serverInformationModal/serverInformationModal.html';
import './serverInformationModal/serverInformationModal.styl';
import './serverInformationModal/serverInformationModal.js';
import './serverInformationModal/serverInformationModal.js';*/
@@ -1,7 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
import { DICOMWebServer as dicomSchema } from 'meteor/ohif:servers/both/schema/servers.js';
import { DIMSEServer as dimseSchema } from 'meteor/ohif:servers/both/schema/servers.js';
@@ -1,7 +1,7 @@
import { Component } from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone';
import ConnectedCornerstoneViewport from '../ConnectedCornerstoneViewport.js';
import './GridLayout.styl';
@@ -1,5 +1,5 @@
import { Template } from 'meteor/templating';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone';
import { toolManager } from '../../../lib/toolManager';
@@ -1,37 +1,54 @@
import { Meteor } from 'meteor/meteor';
import { Session } from 'meteor/session';
import { OHIF } from 'meteor/ohif:core';
import { Component } from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { LayoutManager } from 'react-viewerbase';
import { OHIF } from 'ohif-core';
// Local Modules
import { unloadHandlers } from '../../../lib/unloadHandlers';
import { LayoutManager } from '../../../lib/classes/LayoutManager';
import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone';
import ConnectedCornerstoneViewport from '../ConnectedCornerstoneViewport.js';
import StackManager from '../../../lib/StackManager.js';
const { StudyLoadingListener, StudyPrefetcher, ResizeViewportManager } = OHIF.classes;
import './ViewerMain.styl';
import { Component } from 'react';
import React from 'react';
import PropTypes from 'prop-types';
window.ResizeViewportManager = window.ResizeViewportManager || new ResizeViewportManager();
Meteor.startup(() => {
window.ResizeViewportManager = window.ResizeViewportManager || new ResizeViewportManager();
function getCornerstoneStack(viewportData) {
const {
displaySetInstanceUid,
studyInstanceUid,
} = viewportData;
// Set initial value for OHIFViewerMainRendered
// session variable. This can used in viewer main template
Session.set('OHIFViewerMainRendered', false);
});
// Create shortcut to displaySet
const study = OHIF.viewer.Studies.findBy({
studyInstanceUid,
});
import { connect } from 'react-redux';
const displaySet = study.displaySets.find((set) => {
return set.displaySetInstanceUid === displaySetInstanceUid;
});
// Get stack from Stack Manager
const stack = StackManager.findOrCreateStack(study, displaySet);
stack.currentImageIdIndex = 0;
return stack;
}
class ViewerMain extends Component {
constructor(props) {
super(props);
this.state = {
contents: ''
displaySets: []
};
this.setContents = this.setContents.bind(this);
this.getCornerstoneViewport = this.getCornerstoneViewport.bind(this);
}
componentDidMount() {
@@ -46,9 +63,6 @@ class ViewerMain extends Component {
// Add beforeUnload event handler to check for unsaved changes
window.addEventListener('beforeunload', unloadHandlers.beforeUnload);
// Set the current context
OHIF.context.set('viewer');
const { studies } = this.props;
this.studyPrefetcher = StudyPrefetcher.getInstance();
this.studyPrefetcher.setStudies(studies);
@@ -56,42 +70,47 @@ class ViewerMain extends Component {
this.studyLoadingListener.clear();
this.studyLoadingListener.addStudies(studies);
OHIF.viewerbase.layoutManager = new LayoutManager(this.setContents, studies);
Session.set('OHIFViewerMainRendered', Math.random());
}
setContents(Component, props) {
// TODO[react] Not sure I like this piece much
const mapStateToProps = state => {
return {
activeViewportIndex: state.viewports.activeViewportIndex,
};
};
const ConnectedComponent = connect(
mapStateToProps,
null
)(Component);
const contents = (<ConnectedComponent {...props}/>);
// Get all the display sets for the viewer studies
const displaySets = [];
studies.forEach((study) => {
study.displaySets.forEach(dSet => dSet.images.length && displaySets.push(dSet));
});
this.setState({
contents
displaySets
});
}
getCornerstoneViewport(data, index) {
const stack = getCornerstoneStack(data)
const viewportData = {
stack,
...data
};
return (<ConnectedCornerstoneViewport
key={index}
viewportData={viewportData}
cornerstone={cornerstone}
cornerstoneTools={cornerstoneTools}
/>);
};
render() {
// TODO: re-add plugins back in
const viewportData = this.state.displaySets.map((dSet, index) => {
return this.getCornerstoneViewport(dSet, index);
})
// TODO: Connect LayoutManager to redux
return (
<div className="viewerMain">
{this.state.contents}
</div>
<div className="ViewerMain">
<LayoutManager viewportData={viewportData}/>
</div>
);
}
componentWillUnmount() {
OHIF.log.info('viewerMain onDestroyed');
// Remove the Window resize listener
window.removeEventListener('resize', window.ResizeViewportManager.getResizeHandler());
@@ -101,11 +120,8 @@ class ViewerMain extends Component {
// Destroy the synchronizer used to update reference lines
OHIF.viewer.updateImageSynchronizer.destroy();
delete OHIF.viewerbase.layoutManager;
ProtocolEngine = null;
Session.set('OHIFViewerMainRendered', false);
// Stop prefetching when we close the viewer
this.studyPrefetcher.destroy();
@@ -122,9 +138,6 @@ class ViewerMain extends Component {
// @TypeSafeStudies
// Clears OHIF.viewer.StudyMetadataList collection
OHIF.viewer.StudyMetadataList.removeAll();
// Reset the current context
OHIF.context.set(null);
}
}
@@ -9,7 +9,7 @@
height: 100%
line-height: "calc(100% - %s)" % $topBarHeight
.viewerMain
.ViewerMain
width: 100%
height: 100%
transition(all 0.3s ease)
@@ -1,50 +0,0 @@
<template name="cineDialog">
<dialog id="cineDialog">
{{#form id='cineDialogForm' class=(getClassNames 'dialog-animated noselect') schema=instance.schema api=instance.api}}
{{>inputHidden key='intervalId'}}
<div class="button-close-container">
<div class="button-close"><span aria-hidden="true">x</span></div>
</div>
<div class="cine-controls">
<div class="btn-group">
{{#button class='btn' action='cineFirst' title='Skip to first image' disabled=(buttonDisabled)}}
<i class="fa fa-fast-backward"></i>
{{/button}}
{{#button class='btn' action='cinePrevious' title='Previous image' disabled=(buttonDisabled)}}
<i class="fa fa-step-backward"></i>
{{/button}}
{{#button class='btn' action='cineToggle' title='Play / Stop' class=(concat 'btn ' (valueIf isPlaying 'active' '')) disabled=(buttonDisabled)}}
{{#if isPlaying}}
<i class="fa fa-fw fa-stop"></i>
{{else}}
<i class="fa fa-fw fa-play"></i>
{{/if}}
{{/button}}
{{#button class='btn' action='cineNext' title='Next image' disabled=(buttonDisabled)}}
<i class="fa fa-step-forward"></i>
{{/button}}
{{#button class='btn' action='cineLast' title='Skip to last image' disabled=(buttonDisabled)}}
<i class="fa fa-fast-forward"></i>
{{/button}}
</div>
</div>
<div class="cine-options">
<div class="fps-section">
{{#inputRange key='framesPerSecond' class='p-a-0' labelClass='form-group m-a-0' labelAsDiv=true}}
{{/inputRange}}
</div>
<span id="fps">{{framerate}} fps</span>
</div>
<div class="cine-navigation">
<div class="btn-group">
{{#button class='btn' disabled=(displaySetDisabled false) action='displaySetPrevious' title='Previous display set'}}
<i class="fa fa-toggle-up"></i>
{{/button}}
{{#button class='btn' disabled=(displaySetDisabled true) action='displaySetNext' title='Next display set'}}
<i class="fa fa-toggle-down"></i>
{{/button}}
</div>
</div>
{{/form}}
</dialog>
</template>
@@ -1,310 +0,0 @@
import { Template } from 'meteor/templating';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { Session } from 'meteor/session';
import { Tracker } from 'meteor/tracker';
import _ from 'underscore';
import $ from 'jquery';
import { OHIF } from 'meteor/ohif:core';
import { cornerstoneTools } from 'meteor/ohif:cornerstone';
import { viewportUtils } from '../../../lib/viewportUtils';
import { switchToImageRelative } from '../../../lib/switchToImageRelative';
import { switchToImageByIndex } from '../../../lib/switchToImageByIndex';
Template.cineDialog.onCreated(() => {
const instance = Template.instance();
// Create the data schema for CINE controls
instance.schema = new SimpleSchema({
intervalId: {
type: Number,
optional: true
},
loop: {
type: Boolean,
label: 'Loop',
defaultValue: true
},
framesPerSecond: {
type: Number,
label: '',
defaultValue: 24,
min: 1,
max: 90,
optional: true
}
});
// Update the current viewport frame rate
instance.updateFramerate = rate => {
OHIF.viewer.cine.framesPerSecond = rate;
// Update playClip toolData for this imageId
const element = viewportUtils.getActiveViewportElement();
if (!element) {
return;
}
let playClipData = cornerstoneTools.getToolState(element, 'playClip');
if (!playClipData || !playClipData.data || !playClipData.data.length) {
return;
}
// A valid playClip data object is available.
playClipData = playClipData.data[0];
// If the movie is playing, stop/start to update the framerate
if (playClipData.intervalId !== void 0) {
cornerstoneTools.stopClip(element);
cornerstoneTools.playClip(element, OHIF.viewer.cine.framesPerSecond);
} else {
playClipData.framesPerSecond = OHIF.viewer.cine.framesPerSecond;
}
Session.set('UpdateCINE', Math.random());
};
// Define the actions API
instance.api = {
displaySetPrevious: () => OHIF.viewerbase.layoutManager.moveDisplaySets(false),
displaySetNext: () => OHIF.viewerbase.layoutManager.moveDisplaySets(true),
cineToggle: () => viewportUtils.toggleCinePlay(),
cineFirst: () => switchToImageByIndex(0),
cineLast: () => switchToImageByIndex(-1),
cinePrevious: () => switchToImageRelative(-1),
cineNext: () => switchToImageRelative(1),
cineSlowDown: () => {
const newValue = OHIF.viewer.cine.framesPerSecond - 1;
if (newValue > 0) {
instance.updateFramerate(newValue);
}
},
cineSpeedUp: () => {
const newValue = OHIF.viewer.cine.framesPerSecond + 1;
if (newValue <= 90) {
instance.updateFramerate(newValue);
}
}
};
// Run this computation every time the active viewport is changed
instance.autorun(() => {
window.store.getState().viewports.activeViewport;
Tracker.afterFlush(() => {
// Get the active viewportElement
const element = viewportUtils.getActiveViewportElement();
if (!element) {
return;
}
// check if playClip tool has been initialized...
const playClipData = cornerstoneTools.getToolState(element, 'playClip');
if (!playClipData) {
return;
}
// Get the cornerstone playClip tool data
const toolData = playClipData.data[0];
// Get the cine object
const cine = OHIF.viewer.cine;
// replace the cine values with the tool data
_.extend(cine, toolData);
// Set the defaults
cine.framesPerSecond = cine.framesPerSecond || 24;
cine.loop = _.isUndefined(cine.loop) ? true : cine.loop;
// Set the updated data on the form inputs
const elementComponent = instance.$('form:first').data('component');
if (elementComponent) {
elementComponent.value(cine);
}
// Update the session to refresh the framerate text
Session.set('UpdateCINE', Math.random());
});
});
/**
* Set/Reset Window resize handler. This function is a replacement for
* ... jQuery's on('resize', func) version which, for some unkown reason
* ... is currently not working for this portion of code.
* ... Further investigation is necessary.
*
* This happens because when an event is attached using jQuery's
* you can't get it using vanilla JavaScript, it returns null.
* You need to use jQuery for that. So, either you use vanilla JS or jQuery
* to get an element's event handler. See viewerMain for more details.
*/
instance.setResizeHandler = handler => {
if (typeof handler === 'function') {
const origHandler = window.onresize;
instance.origWindowResizeHandler = typeof origHandler === 'function' ? origHandler : null;
window.onresize = event => {
if (typeof origHandler === 'function') {
origHandler.call(window, event);
}
handler.call(window, event);
};
} else {
window.onresize = instance.origWindowResizeHandler || null;
window.origWindowResizeHandler = null;
}
};
/**
* Set optimal position for Cine dialog.
*/
instance.setOptimalPosition = (event, options) => {
const $viewer = $('#viewer');
const $toolbarElement = $('.toolbarSection .toolbarSectionTools:first');
const $cineDialog = $('#cineDialog');
$cineDialog.width($('#cineDialogForm').outerWidth());
if ($toolbarElement.length < 1 || $cineDialog.length < 1) {
return;
}
if ($cineDialog.data('wasDragged') || $cineDialog.data('wasBounded')) {
// restore original handler...
instance.setResizeHandler(null);
return;
}
const cineDialogSize = {
width: $cineDialog.outerWidth() || 0,
height: $cineDialog.outerHeight() || 0
};
const topLeftCoords = {
top: 0,
left: 0
};
const toolbarRect = {
offset: $toolbarElement.offset() || topLeftCoords,
width: $toolbarElement.outerWidth() || 0,
height: $toolbarElement.outerHeight() || 0
};
const cineDialogCoords = {
left: toolbarRect.offset.left + toolbarRect.width + 20,
top: toolbarRect.offset.top + toolbarRect.height - cineDialogSize.height
};
if (options) {
if (options.left) {
cineDialogCoords.left = options.left;
}
if (options.top) {
cineDialogCoords.top = options.top;
}
}
// Check if it is out of screen
if (cineDialogCoords.top < 0) {
cineDialogCoords.top = 0;
} else if (cineDialogCoords.top + cineDialogSize.height > $viewer.height()) {
cineDialogCoords.top -= (cineDialogCoords.top + cineDialogSize.height) - $viewer.height();
}
if (cineDialogCoords.left < 0) {
cineDialogCoords.left = 0;
} else if (cineDialogCoords.left + cineDialogSize.width > $viewer.width()) {
cineDialogCoords.left -= (cineDialogCoords.left + cineDialogSize.width) - $viewer.width();
}
$cineDialog.css(cineDialogCoords);
};
});
Template.cineDialog.onRendered(() => {
const instance = Template.instance();
const $dialog = instance.$('#cineDialog');
const singleRowLayout = OHIF.uiSettings.displayEchoUltrasoundWorkflow;
// set dialog in optimal position and make sure it continues in a optimal position...
// ... when the window has been resized
instance.setOptimalPosition(null, { top: singleRowLayout ? 47 : 26 });
// The jQuery method does not seem to be working...
// ... $(window).resize(instance.setOptimalPosition)
// This requires additional investigation.
instance.setResizeHandler(instance.setOptimalPosition);
// Make the CINE dialog bounded and draggable
$dialog.draggable({ defaultElementCursor: 'move' }).bounded();
// Polyfill for older browsers
window.dialogPolyfill.registerDialog($dialog.get(0));
// Prevent dialog from being dragged when user clicks any button
const $controls = $dialog.find('.cine-navigation, .cine-controls, .cine-options');
$controls.on('mousedown touchstart', event => event.stopPropagation());
});
Template.cineDialog.onDestroyed(() => {
const instance = Template.instance();
// remove resize handler...
instance.setResizeHandler(null);
});
Template.cineDialog.events({
'change [data-key=loop] input'(event, instance) {
const element = viewportUtils.getActiveViewportElement();
OHIF.viewer.cine.loop = $(event.currentTarget).is(':checked');
// Update playClip tool data if available.
let playClipData = cornerstoneTools.getToolState(element, 'playClip');
if (playClipData && playClipData.data && playClipData.data.length > 0) {
playClipData.data[0].loop = OHIF.viewer.cine.loop;
}
},
'input [data-key=framesPerSecond] input, change [data-key=framesPerSecond] input'(event, instance) {
// Update the FPS text onscreen
const rate = parseFloat($(event.currentTarget).val());
instance.updateFramerate(rate);
},
'click .button-close'(event, instance) {
OHIF.commands.run('toggleCineDialog');
}
});
Template.cineDialog.helpers({
isPlaying() {
return viewportUtils.isPlaying();
},
framerate() {
Session.get('UpdateCINE');
return OHIF.viewer.cine.framesPerSecond.toFixed(1);
},
displaySetDisabled(isNext) {
Session.get('LayoutManagerUpdated');
// @TODO: Investigate why this is running while OHIF.viewerbase.layoutManager is undefined
if (!OHIF.viewerbase.layoutManager) {
return;
}
return !OHIF.viewerbase.layoutManager.canMoveDisplaySets(isNext) ? 'disabled' : '';
},
buttonDisabled() {
return viewportUtils.hasMultipleFrames();
},
getClassNames(baseClass) {
const style = OHIF.uiSettings.displayEchoUltrasoundWorkflow ? 'single' : 'double';
return `${baseClass} ${style}-row-style`;
}
});
@@ -1,162 +0,0 @@
@require '{ohif:viewerbase}/app'
#cineDialog
theme('background', '$uiGrayDarkest', 0.85)
theme('color', '$textSecondaryColor')
filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.85))
border: none
border-radius: 8px
cursor: move
padding: 0
position: absolute
z-index: 1000
.button-close-container
theme('background', '$uiGrayDarkest')
border-radius(16px)
cursor: pointer
height: 32px
position: absolute
right: -8px
top: -10px
width: 32px
.button-close
left: 50%
position: absolute
top: 50%
transform(translateX(-50%) translateY(-50%))
h5
font-size: 20px
line-height: 35px
margin: 0
h5, label
font-weight: 400
.btn
theme('color', '$textSecondaryColor')
background-color: transparent
&:hover
theme('color', '$hoverColor')
&:active, &.active
theme('color', '$activeColor')
&[disabled]
&:hover
color: inherit
&:active
theme('color', '$textSecondaryColor')
.cine-navigation, .cine-controls, .cine-options
cursor: default
.fps-section
input[type="range"]
background-color: transparent
border: 0 none
outline: 0 none
&::-ms-tooltip
display: none
.double-row-style
box-sizing: border-box
width: 290px
height: 80px
padding: 10px
top: 2%
left: 35%
.cine-navigation
position: absolute
right: 16px
top: 10px
.btn
padding: 0 4px
i
font-size: 32px
line-height: 32px
.cine-controls
left: 0px
.cine-options
padding: 0px 0
.fps-section
width: 175px
float: left
#fps
float: right
margin: 5px 20px 0 0
.single-row-style
box-sizing: content-box
width: 425px
height: 45px
padding: 4px 8px
top: 2%
left: 35%
.cine-navigation
float: right
overflow: hidden
padding-right: 12px
position: relative
.btn
padding: 0 2px
margin: 0 0 0 2px
border: 0 none
&:first-of-type
margin-left: 0
i
font-size: 32px
line-height: 45px
.cine-controls
position: relative
float: left
overflow: hidden
.btn
font-size: 22px
line-height: 45px
min-width: 28px
padding: 0 0px
margin: 0 4px
border: 0 none
.cine-options
display: block
position: relative
width: 150px
float: left
overflow: hidden
padding: 0
margin: 0 0 0 10px
.fps-section
display: block
float: left
width: 80px
input[type="range"]
line-height: 45px
height: 45px
#fps
display: block
width: 68px
float: left
padding: 0
margin: 0 0 0 2px
text-align: center
line-height: 45px
@@ -3,8 +3,8 @@ import { Tracker } from 'meteor/tracker';
import { ReactiveVar } from 'meteor/reactive-var';
import { Session } from 'meteor/session';
import $ from 'jquery';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { OHIF } from 'meteor/ohif:core';
//import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { OHIF } from 'ohif-core';
import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone';
OHIF.viewerbase.getImageDownloadDialogAnnotationTools = () => {
@@ -1,6 +1,6 @@
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
import 'meteor/ohif:viewerbase';
import { viewportUtils } from '../../../lib/viewportUtils';
@@ -41,12 +41,12 @@ Template.layoutChooser.onRendered(() => {
// Refresh layout chooser highlighting based on current viewports state
instance.refreshHighlights = () => {
// Stop here if layoutManager is not defined yet
if (!OHIF.viewerbase.layoutManager) {
if (!OHIF.viewer.layoutManager) {
return;
}
// Get the layout rows and columns amount
const info = OHIF.viewerbase.layoutManager.layoutProps;
const info = OHIF.viewer.layoutManager.layoutProps;
// get the limiter cell
const cell = instance.$('tr').eq(info.rows - 1).children().eq(info.columns - 1);
@@ -57,8 +57,7 @@ Template.layoutChooser.onRendered(() => {
instance.autorun(() => {
// Run this computation every time the viewer layout is changed
Session.get('LayoutManagerUpdated');
instance.refreshHighlights();
});
});
@@ -83,9 +82,9 @@ Template.layoutChooser.events({
columns: columnIndex + 1
};
OHIF.viewerbase.layoutManager.layoutTemplateName = 'gridLayout';
OHIF.viewerbase.layoutManager.layoutProps = layoutProps;
OHIF.viewerbase.layoutManager.updateViewports();
OHIF.viewer.layoutManager.layoutTemplateName = 'gridLayout';
OHIF.viewer.layoutManager.layoutProps = layoutProps;
OHIF.viewer.layoutManager.updateViewports();
const $dropdown = instance.$('.layoutChooser');
viewportUtils.toggleDialog($dropdown);
@@ -1,7 +1,7 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import $ from 'jquery';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
Template.seriesQuickSwitch.onCreated(() => {
const instance = Template.instance();
@@ -11,7 +11,7 @@ Template.seriesQuickSwitch.onCreated(() => {
// Gets the viewport data for the given viewport index
instance.getViewportData = viewportIndex => {
const layoutManager = OHIF.viewerbase.layoutManager;
const layoutManager = OHIF.viewer.layoutManager;
return layoutManager && layoutManager.viewportData && layoutManager.viewportData[viewportIndex];
};
@@ -22,7 +22,7 @@ Template.seriesQuickSwitch.onCreated(() => {
instance.lastStudy = {};
instance.autorun(() => {
OHIF.viewerbase.layoutManager.observer.depend();
OHIF.viewer.layoutManager.observer.depend();
const viewportData = instance.getViewportData(viewportIndex);
@@ -68,9 +68,9 @@ Template.seriesQuickSwitch.helpers({
seriesItems() {
const instance = Template.instance();
OHIF.viewerbase.layoutManager.observer.depend();
OHIF.viewer.layoutManager.observer.depend();
const { viewportIndex } = instance.data;
const viewportData = OHIF.viewerbase.layoutManager.viewportData[viewportIndex];
const viewportData = OHIF.viewer.layoutManager.viewportData[viewportIndex];
const study = instance.currentStudy.get();
const seriesItems = [];
@@ -3,7 +3,7 @@ import { ReactiveVar } from 'meteor/reactive-var';
import { Session } from 'meteor/session';
import $ from 'jquery';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
Template.studySeriesQuickSwitch.onCreated(() => {
const instance = Template.instance();
@@ -13,7 +13,7 @@ Template.studySeriesQuickSwitch.onCreated(() => {
// Gets the viewport data for the given viewport index
instance.getViewportData = viewportIndex => {
const layoutManager = OHIF.viewerbase.layoutManager;
const layoutManager = OHIF.viewer.layoutManager;
return layoutManager && layoutManager.viewportData && layoutManager.viewportData[viewportIndex];
};
@@ -24,7 +24,6 @@ Template.studySeriesQuickSwitch.onCreated(() => {
instance.lastStudy = {};
instance.autorun(() => {
Session.get('LayoutManagerUpdated');
const viewportData = instance.getViewportData(viewportIndex);
@@ -1,5 +1,5 @@
import { Template } from 'meteor/templating';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
Template.studyTimepoint.onCreated(() => {
const instance = Template.instance();
@@ -2,7 +2,7 @@ import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { Tracker } from 'meteor/tracker';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
import { OHIFError } from '../../../lib/classes/OHIFError';
Template.studyTimepointBrowser.onCreated(() => {
@@ -3,7 +3,7 @@ import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import _ from 'underscore';
import $ from 'jquery';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
Template.studyTimepointStudy.onCreated(() => {
const instance = Template.instance();
@@ -1,4 +1,4 @@
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import _ from 'underscore';
@@ -101,7 +101,6 @@ Template.toolbarSectionButton.helpers({
disableButton() {
window.store.getState().viewports.activeViewport;
Session.get('LayoutManagerUpdated');
const instance = Template.instance();
const isCommandDisabled = OHIF.commands.isDisabled(instance.data.id);
const isFunctionDisabled = instance.data.disableFunction && instance.data.disableFunction();
@@ -1,6 +1,6 @@
import { Template } from 'meteor/templating';
import _ from 'underscore';
import { OHIF } from 'meteor/ohif:core';
import { OHIF } from 'ohif-core';
Template.windowLevelPresetsForm.onCreated(() => {
const instance = Template.instance();