WIP reorganization

This commit is contained in:
Erik Ziegler committed 2018-12-12 09:10:39 +01:00
1 parent 6706dfe634
commit 054e37dfb7
266 files changed
+98 -620

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
{
"parser": "babel-eslint",
"parserOptions": {
"allowImportExportEverywhere": true
},
"plugins": [
"meteor"
],
"env": {
/* Allows global vars from the Meteor environment to pass and enables certain rules */
"meteor": true,
"node": true,
"browser": true
},
"extends": [
"airbnb",
"plugin:meteor/recommended"
],
"settings": {
"import/resolver": "meteor"
},
"rules": {
"meteor/no-session": 0, // We are actually using Session for now...
"meteor/eventmap-params": [2, {"eventParamName": "event"}],
"meteor/eventmap-params": [2, {"templateInstanceParamName": "instance"}],
"import/no-extraneous-dependencies": 0,
"import/no-unresolved": 0, // There are a bunch of ESLint problems with Meteor's resolver
"import/no-duplicates": 0, // So we are disabling these for now
"import/extensions": 0,
"import/no-absolute-path": 0,
"no-console": 0, // For development
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
"indent": ["error", 4],
"new-cap": 0, // Until Match has an exception
"func-names": 0, // This is a bit of an annoying rule
"no-underscore-dangle": 0, // Doesn't seem to mesh with _id for MongoDB Ids (or SimpleSchema)
"max-len": 0, // TODO: re-enable the rules below and fix all of the errors
"consistent-return": 0,
"no-param-reassign": 0,
"no-mixed-operators": 0,
"arrow-body-style": 0,
"valid-typeof": 0,
"import/prefer-default-export": 0
"no-undef": 0
},
"globals": {}
}
@@ -0,0 +1,19 @@
# This file contains information which helps Meteor properly upgrade your
# app when you run 'meteor update'. You should check it into version control
# with your project.
notices-for-0.9.0
notices-for-0.9.1
0.9.4-platform-file
notices-for-facebook-graph-api-2
1.2.0-standard-minifiers-package
1.2.0-meteor-platform-split
1.2.0-cordova-changes
1.2.0-breaking-changes
1.3.0-split-minifiers-package
1.3.5-remove-old-dev-bundle-link
1.4.0-remove-old-dev-bundle-link
1.4.1-add-shell-server-package
1.4.3-split-account-service-packages
1.5-add-dynamic-import-package
1.7-split-underscore-from-meteor-base
+2
View File
@@ -0,0 +1,2 @@
dev_bundle
local
+7
View File
@@ -0,0 +1,7 @@
# This file contains a token that is unique to your project.
# Check it into your repository along with the rest of this directory.
# It can be used for purposes such as:
# - ensuring you don't accidentally deploy one app on top of another
# - providing package authors with aggregated statistics
1q3vtk41m2yk4k1rqj08l
@@ -0,0 +1,136 @@
{
"starrynight": {
"version": "3.7.0"
},
"nightwatch": {
"version": "0.8.6"
},
"src_folders": [
"./tests/nightwatch/walkthroughs"
],
"output_folder": "./tests/nightwatch/reports",
"custom_commands_path": [
"./tests/nightwatch/commands",
"./tests/nightwatch/commands/api/meteor",
"./tests/nightwatch/commands/actions",
"./tests/nightwatch/commands/components",
"./tests/nightwatch/commands/methods"
],
"custom_assertions_path": [
"./tests/nightwatch/assertions"
],
"globals_path": "./tests/nightwatch/globals.json",
"selenium": {
"start_process": true,
"server_path": "${npm_config_prefix}/lib/node_modules/starrynight/node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-2.45.0.jar",
"log_path": "tests/nightwatch/logs",
"host": "127.0.0.1",
"port": 4444,
"cli_args": {
"webdriver.chrome.driver": "${npm_config_prefix}/lib/node_modules/starrynight/node_modules/chromedriver/bin/chromedriver"
}
},
"test_settings": {
"default": {
"launch_url": "http://localhost:5000",
"selenium_host": "127.0.0.1",
"selenium_port": 4444,
"pathname": "/wd/hub",
"silent": true,
"disable_colors": false,
"firefox_profile": false,
"ie_driver": "",
"screenshots": {
"enabled": false,
"path": "./tests/nightwatch/screenshots"
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"loggingPrefs": {
"browser": "ALL"
}
},
"exclude": "./tests/nightwatch/unittests/*"
},
"phantomjs": {
"desiredCapabilities": {
"browserName": "phantomjs",
"javascriptEnabled": true,
"databaseEnabled": false,
"locationContextEnabled": false,
"applicationCacheEnabled": false,
"browserConnectionEnabled": false,
"webStorageEnabled": false,
"acceptSslCerts": true,
"rotatable": false,
"nativeEvents": false,
"phantomjs.binary.path": "${npm_config_prefix}/lib/node_modules/starrynight/node_modules/phantomjs/bin/phantomjs"
}
},
"travis": {
"launch_url": "http://localhost:3000",
"selenium_host": "127.0.0.1",
"selenium_port": 4444,
"pathname": "/wd/hub",
"silent": true,
"disable_colors": false,
"firefox_profile": false,
"screenshots": {
"enabled": false,
"path": "./tests/nightwatch/screenshots"
},
"desiredCapabilities": {
"browserName": "firefox",
"javascriptEnabled": true,
"databaseEnabled": true,
"locationContextEnabled": true,
"applicationCacheEnabled": true,
"browserConnectionEnabled": true,
"webStorageEnabled": true,
"acceptSslCerts": true,
"rotatable": true,
"nativeEvents": true
}
},
"travischrome": {
"launch_url": "http://localhost:3000",
"selenium_host": "127.0.0.1",
"selenium_port": 4444,
"pathname": "/wd/hub",
"silent": true,
"disable_colors": false,
"firefox_profile": false,
"screenshots": {
"enabled": false,
"path": "./tests/nightwatch/screenshots"
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"databaseEnabled": true,
"locationContextEnabled": true,
"applicationCacheEnabled": true,
"browserConnectionEnabled": true,
"webStorageEnabled": true,
"acceptSslCerts": true,
"rotatable": true,
"nativeEvents": true,
"chromeOptions": {
"args": [
"--no-sandbox"
]
}
}
},
"unittests": {
"selenium": {
"start_process": false,
"start_session": false
},
"filter": "./tests/nightwatch/unittests/*",
"exclude": ""
}
}
}
+63
View File
@@ -0,0 +1,63 @@
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
npm-bcrypt@0.9.3
meteor-base@1.4.0 # Packages every Meteor app needs to have
mobile-experience@1.0.5 # Packages for a great mobile UX
mongo@1.5.0 # The database Meteor supports right now
blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views
session@1.1.7 # Client-side reactive dictionary for your app
jquery@1.11.10 # Helpful client-side library
tracker@1.2.0 # Meteor's client-side reactive programming library
standard-minifier-css@1.4.1
standard-minifier-js@2.3.4
http@1.4.1
promise@0.11.1
stylus@2.513.13
random@1.1.0
reactive-var@1.0.11
reactive-dict@1.2.0
check@1.3.1
email@1.2.3
ecmascript@0.11.1 # Enable ECMAScript2015+ syntax in app code
clinical:active-entry
clinical:theming
clinical:fonts
clinical:hipaa-audit-log
clinical:hipaa-logger
# OHIF Packages
ohif:polyfill
ohif:design
ohif:core
ohif:header
ohif:cornerstone
ohif:cornerstone-settings
ohif:viewerbase
ohif:studies
ohif:study-list
ohif:hanging-protocols
ohif:metadata
# Necessary for Lesion Trakcer
ohif:lesiontracker
ohif:user-management
ohif:user-meteor-accounts
ohif:select-tree
accounts-base@1.4.2
accounts-password@1.5.1
fortawesome:fontawesome
momentjs:moment@2.15.1
aldeed:simple-schema # Third party package to deal with schemas
aldeed:template-extension@4.0.0
aldeed:collection2
zuuk:stale-session
shell-server@0.3.1
underscore
+2
View File
@@ -0,0 +1,2 @@
server
browser
+1
View File
@@ -0,0 +1 @@
METEOR@1.7.0.3
+145
View File
@@ -0,0 +1,145 @@
accounts-base@1.4.2
accounts-password@1.5.1
aldeed:collection2@2.10.0
aldeed:collection2-core@1.2.0
aldeed:schema-deny@1.1.0
aldeed:schema-index@1.1.1
aldeed:simple-schema@1.5.4
aldeed:template-extension@4.1.0
allow-deny@1.1.0
amplify@1.0.0
autoupdate@1.4.1
babel-compiler@7.1.1
babel-runtime@1.2.2
base64@1.0.11
binary-heap@1.0.10
blaze@2.3.2
blaze-html-templates@1.1.2
blaze-tools@1.0.10
boilerplate-generator@1.5.0
caching-compiler@1.1.12
caching-html-compiler@1.1.3
callback-hook@1.1.0
check@1.3.1
clinical:active-entry@1.5.16
clinical:auto-resizing@0.2.0
clinical:fonts@1.1.6
clinical:hipaa-audit-log@2.4.2
clinical:hipaa-logger@1.3.0
clinical:router@2.0.19
clinical:router-location@2.1.0
clinical:router-middleware-stack@2.1.2
clinical:router-url@2.1.0
clinical:theming@0.4.10
ddp@1.4.0
ddp-client@2.3.3
ddp-common@1.4.0
ddp-rate-limiter@1.0.7
ddp-server@2.2.0
deps@1.0.12
diff-sequence@1.1.0
dynamic-import@0.4.1
ecmascript@0.11.1
ecmascript-runtime@0.7.0
ecmascript-runtime-client@0.7.1
ecmascript-runtime-server@0.7.0
ejson@1.1.0
email@1.2.3
es5-shim@4.8.0
fastclick@1.0.13
fortawesome:fontawesome@4.7.0
geojson-utils@1.0.10
grove:less@0.2.0
hot-code-push@1.0.4
html-tools@1.0.11
htmljs@1.0.11
http@1.4.1
id-map@1.1.0
iron:controller@1.0.12
iron:core@1.0.11
iron:dynamic-template@1.0.12
iron:layout@1.0.12
johdirr:meteor-git-rev@0.0.4
jquery@1.11.11
launch-screen@1.1.1
livedata@1.0.18
localstorage@1.2.0
logging@1.1.20
mdg:validation-error@0.5.1
meteor@1.9.2
meteor-base@1.4.0
meteor-platform@1.2.6
minifier-css@1.3.1
minifier-js@2.3.5
minimongo@1.4.4
mobile-experience@1.0.5
mobile-status-bar@1.0.14
modern-browsers@0.1.2
modules@0.12.2
modules-runtime@0.10.2
momentjs:moment@2.22.2
mongo@1.5.1
mongo-dev-server@1.1.0
mongo-id@1.0.7
mrt:moment@2.8.1
natestrauser:select2@4.0.3
npm-bcrypt@0.9.3
npm-mongo@3.0.7
observe-sequence@1.0.16
ohif:commands@0.0.1
ohif:core@0.0.1
ohif:cornerstone@0.0.1
ohif:cornerstone-settings@0.0.1
ohif:design@0.0.1
ohif:hanging-protocols@0.0.1
ohif:header@0.0.1
ohif:hotkeys@0.0.1
ohif:lesiontracker@0.0.1
ohif:log@0.0.1
ohif:measurements@0.0.1
ohif:metadata@0.0.1
ohif:polyfill@0.0.1
ohif:select-tree@0.0.1
ohif:servers@0.0.1
ohif:studies@0.0.1
ohif:study-list@0.0.1
ohif:themes@0.0.1
ohif:themes-common@0.0.1
ohif:user-management@0.0.1
ohif:user-meteor-accounts@0.0.1
ohif:viewerbase@0.0.1
ohif:wadoproxy@0.0.1
ordered-dict@1.1.0
promise@0.11.1
raix:eventemitter@0.1.3
random@1.1.0
rate-limit@1.0.9
reactive-dict@1.2.0
reactive-var@1.0.11
reload@1.2.0
retry@1.1.0
routepolicy@1.0.13
service-configuration@1.0.11
session@1.1.7
sha@1.0.9
shell-server@0.3.1
silentcicero:jszip@0.0.4
socket-stream-client@0.2.2
spacebars@1.0.15
spacebars-compiler@1.1.3
srp@1.0.10
standard-app-packages@1.0.9
standard-minifier-css@1.4.1
standard-minifier-js@2.3.4
stylus@2.513.14
templating@1.3.2
templating-compiler@1.3.3
templating-runtime@1.3.2
templating-tools@1.1.2
tracker@1.2.0
ui@1.0.13
underscore@1.0.10
url@1.2.0
webapp@1.6.2
webapp-hashing@1.0.9
zuuk:stale-session@1.0.8
+8
View File
@@ -0,0 +1,8 @@
# LesionTracker
LesionTracker is an open source, zero-footprint image viewer focused on oncology clinical trial workflows. It is built using Meteor platform which enables modularity with a set of packages of the OHIF framework.
### Why LesionTracker?
LesionTracker brings an user experience for the basic tumor metrics through web browser. It provides a DICOM server for storing and streaming images to the viewer, tools for measuring and following lesions over time, and a database for measurements of overlay data. A web-based system for image assessments rather than a workstation-based installed application will improve workflow efficiency, enhance accessibility, and promote collaborative image review for the radiologists at cooperating cancer centers.
To get started, checkout [LesionTracker Documentation](https://github.com/OHIF/Viewers/wiki/LesionTracker)
+58
View File
@@ -0,0 +1,58 @@
import { Session } from 'meteor/session';
if (Meteor.isClient){
ActiveEntry.configure({
logo: {
url: '/mini-circles.png',
displayed: true
},
signIn: {
displayFullName: true,
destination: '/studylist'
},
signUp: {
destination: '/studylist'
},
themeColors: {
primary: ""
},
passwordOptions: {
showPasswordStrengthIndicator: false,
requireRegexValidation: true,
//requireStrongPasswords: false
passwordHistoryCount: 6,
failedAttemptsLimit: 5
}
});
Session.set('ThemeConfig', {
palette: {
colorA: "",
colorB: "",
colorC: "",
colorD: "",
colorE: ""
}
});
}
/*
if (Meteor.isServer){
Accounts.emailTemplates.siteName = 'AwesomeSite';
Accounts.emailTemplates.from = 'AwesomeSite Admin <accounts@example.com>';
Accounts.emailTemplates.enrollAccount.subject = function(user) {
return 'Welcome to Awesome Town, ' + user.profile.name;
};
Accounts.emailTemplates.enrollAccount.text = function(user, url) {
return 'You have been selected to participate in building a better future!'
+ ' To activate your account, simply click the link below:\n\n'
+ url;
};
Meteor.startup(function() {
//process.env.MAIL_URL = 'smtp://sandboxid.mailgun.org:mypassword@smtp.mailgun.org:587';
});
}
*/
@@ -0,0 +1,2 @@
set METEOR_PACKAGE_DIRS=..\Packages
meteor --settings ../config/medkenOrthanc.json
+1
View File
@@ -0,0 +1 @@
METEOR_PACKAGE_DIRS="../Packages" meteor --settings ../config/medkenOrthanc.json
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
declare config='../config/orthancDICOMWeb.json'
if [ $# -gt 0 ]; then
if [ "$1" = '--dimse' ]; then
config="${config%/*}/orthancDIMSE.json"
[ -f "$config" ] && echo "DIMSE config file selected: $config"
fi
fi
echo 'Starting Meteor server...'
METEOR_PACKAGE_DIRS="../Packages" meteor --settings "$config"
@@ -0,0 +1,2 @@
set METEOR_PACKAGE_DIRS=..\Packages
meteor --settings ../config/orthancDICOMWeb.json
+2
View File
@@ -0,0 +1,2 @@
echo "Starting Meteor server..."
METEOR_PACKAGE_DIRS="../Packages" meteor --settings ../config/orthancDICOMWeb.json
+3
View File
@@ -0,0 +1,3 @@
<body>
<div id="notificationArea" class="notification-area"></div>
</body>
+2
View File
@@ -0,0 +1,2 @@
body
background-color: black
@@ -0,0 +1,29 @@
<template name="app">
{{#header brandHref='http://ohif.org' headerClasses=instance.headerClasses}}
{{#section 'brand'}}
<svg class="logo-image">
<use xlink:href={{absoluteUrl "packages/ohif_viewerbase/assets/icons.svg#icon-ohif-logo"}}></use>
</svg>
<div class="logo-text">Open Health Imaging Foundation</div>
{{/section}}
{{#section 'headerAfterBrand'}}
{{#if studyListToggleText}}
<a href="#" class="btn studyListLinkSection pull-left js-toggle-studyList" id="{{dasherize studyListToggleText}}-btn">
{{studyListToggleText}}
</a>
{{/if}}
{{/section}}
{{#section 'headerMenu'}}
<span class="research-use pull-left m-r-1">
INVESTIGATIONAL USE ONLY
</span>
<span class="user-name pull-left m-r-1">{{userName}}</span>
<div class="menu-toggle pull-right">
<i class="fa fa-cog"></i>
<span class="caret-down"></span>
</div>
{{/section}}
{{/header}}
{{>Template.dynamic template=(choose this.template 'studylist') data=this}}
</template>
@@ -0,0 +1,125 @@
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { Router } from 'meteor/clinical:router';
import { ReactiveVar } from 'meteor/reactive-var';
import { OHIF } from 'meteor/ohif:core';
Template.app.onCreated(() => {
const instance = Template.instance();
instance.headerClasses = new ReactiveVar('');
OHIF.header.dropdown.setItems([{
action: OHIF.user.audit,
text: 'View Audit Log',
iconClasses: 'log',
iconSvgUse: 'packages/ohif_viewerbase/assets/icons.svg#log',
separatorAfter: true
}, {
action: () => OHIF.ui.showDialog('themeSelectorModal'),
text: 'Themes',
iconClasses: 'theme',
iconSvgUse: 'packages/ohif_viewerbase/assets/icons.svg#theme',
separatorAfter: true
}, {
action: () => OHIF.ui.showDialog('serverInformationModal'),
text: 'Server Information',
iconClasses: 'server',
iconSvgUse: 'packages/ohif_viewerbase/assets/icons.svg#server',
separatorAfter: true
}, {
action: () => OHIF.ui.showDialog('userPreferencesDialog'),
text: 'Preferences',
icon: 'fa fa-user',
separatorAfter: true
}, {
action: OHIF.user.changePassword,
text: 'Change Password',
iconClasses: 'password',
iconSvgUse: 'packages/ohif_viewerbase/assets/icons.svg#password'
}, {
action: OHIF.user.logout,
text: 'Logout',
iconClasses: 'logout',
iconSvgUse: 'packages/ohif_viewerbase/assets/icons.svg#logout'
}]);
instance.autorun(() => {
const currentRoute = Router.current();
if (!currentRoute) return;
const routeName = currentRoute.route.getName();
const isViewer = routeName.indexOf('viewer') === 0;
// Add or remove the strech class from body
$(document.body)[isViewer ? 'addClass' : 'removeClass']('stretch');
// Set the header on its bigger version if the viewer is not opened
instance.headerClasses.set(isViewer ? '' : 'header-big');
// Set the viewer open state on session
Session.set('ViewerOpened', isViewer);
});
});
Template.app.events({
'click .js-toggle-studyList'(event, instance) {
event.preventDefault();
event.stopPropagation();
const isViewer = Session.get('ViewerOpened');
if (!isViewer) {
const timepointId = OHIF.viewer.data.currentTimepointId;
if (timepointId) {
Router.go('viewerTimepoint', { timepointId });
} else {
const { studyInstanceUids } = OHIF.viewer.data;
Router.go('viewerStudies', { studyInstanceUids });
}
return;
}
OHIF.ui.unsavedChanges.presentProactiveDialog('viewer.*', (hasChanges, userChoice) => {
if (!hasChanges) {
return Router.go('studylist');
}
switch (userChoice) {
case 'abort-action':
return;
case 'save-changes':
OHIF.ui.unsavedChanges.trigger('viewer', 'save', false);
OHIF.ui.unsavedChanges.clear('viewer.*');
break;
case 'abandon-changes':
OHIF.ui.unsavedChanges.clear('viewer.*');
break;
}
Router.go('studylist');
}, {
position: {
x: event.clientX + 15,
y: event.clientY + 15
}
});
}
});
Template.app.helpers({
userName: OHIF.user.getName,
studyListToggleText() {
const isViewer = Session.get('ViewerOpened');
// Return empty if viewer was not opened yet
if (!OHIF.utils.ObjectPath.get(OHIF, 'viewer.data.studyInstanceUids')) return;
return isViewer ? 'Study list' : 'Back to viewer';
},
dasherize(text) {
return text.replace(/ /g, '-').toLowerCase();
}
});
Session.set('defaultSignInMessage', 'Tumor tracking in your browser.');
@@ -0,0 +1,88 @@
@require "{ohif:design}/app"
body>.header
.brand
height: 30px
display: inline-block
text-decoration: none
.logo-image
display: inline-block
fill: transparent
float: left
height: 100%
margin: 0 8px 0 0
width: 30px
.logo-text
display: inline-block
font-family: $logoFontFamily
font-size: 14px
font-weight: $logoFontWeight
theme('color', '$textPrimaryColor')
line-height: 30px
.header-menu
.user-name
font-size: 13px
.menu-toggle
theme('border-left', 'solid 1px $defaultColor')
display: inline-block
height: 18px
padding: 0 8px
.fa
theme('color', '$defaultColor')
font-size: 17px
line-height: 18px
.caret-down
theme('color', '$uiGrayLight')
margin: 0 4px 4px 2px
.btn
theme('color', '$textSecondaryColor')
cursor: pointer
font-size: 13px
font-weight: 500
line-height: 26px
&:hover
theme('color', '$hoverColor')
&:active
theme('color', '$activeColor')
.studyListLinkSection
theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness)
margin: 3px 0 0 10px
padding: 0 0 0 10px
&#back-to-viewer-btn
border-left: 0
&.header-big
padding-left: $studyListPadding
padding-right: $studyListPadding
.brand
height: 100%
width: 80%
line-height: $topBarExpandedHeight - 10px
.logo-image
margin: 0 20px 0 0
width: 50px
.logo-text
font-size: 30px
.studyListLinkSection
border: none
left: 0
margin: 0
padding: 0
position: absolute
top: 0
@@ -0,0 +1,37 @@
<template name="toolbarSection">
<div class="toolbarSection noselect p-x-2">
<div class="clearfix">
<div class="pull-left m-t-1">
{{>roundedButtonGroup leftSidebarToggleButtonData}}
</div>
{{>toolbarSectionTools toolbarButtons=toolbarButtons}}
<div class="pull-right m-t-1 rm-x-1">
{{#form (extend api=instance.api)}}
{{#button class='btn p-x-2' action='save' disabled=(isFinishDisabled)}}Save{{/button}}
{{/form}}
</div>
<div id="toggleMeasurements" class="pull-right m-t-1 rm-x-1">
{{>roundedButtonGroup rightSidebarToggleButtonData}}
</div>
<div id="toggleHUD" class="toolbarSectionButton pull-right rp-x-1 m-t-1 rm-r-3 {{#if session 'measurementTableHudOpen'}}active{{/if}}">
<div class="svgContainer">
<svg>
<use xlink:href={{absoluteUrl "packages/ohif_viewerbase/assets/icons.svg#icon-hud"}}></use>
</svg>
</div>
<div class="buttonLabel">HUD</div>
</div>
<div id="toggleTrial" class="toolbarSectionButton pull-right rp-x-1 m-t-1 rm-r-1">
<div class="svgContainer">
<svg>
<use xlink:href={{absoluteUrl "packages/ohif_viewerbase/assets/icons.svg#icon-trial-info"}}></use>
</svg>
</div>
<div class="buttonLabel">Trial</div>
</div>
</div>
</div>
</template>
@@ -0,0 +1,320 @@
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { Tracker } from 'meteor/tracker';
import { OHIF } from 'meteor/ohif:core';
import { Viewerbase } from 'meteor/ohif:viewerbase';
Template.toolbarSection.helpers({
isFinishDisabled() {
const instance = Template.instance();
// Run this computation on save or every time any measurement / timepoint suffer changes
OHIF.ui.unsavedChanges.depend();
instance.saveObserver.depend();
Session.get('LayoutManagerUpdated');
return OHIF.ui.unsavedChanges.probe('viewer.*') === 0;
},
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: 'Studies'
}]
};
},
rightSidebarToggleButtonData() {
const instance = Template.instance();
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() {
// Check if the measure tools shall be disabled
const isToolDisabled = false; //!Template.instance().data.timepointApi;
const targetSubTools = [];
targetSubTools.push({
id: 'bidirectional',
title: 'Bidirectional',
classes: 'imageViewerTool rm-l-3',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-target',
disabled: isToolDisabled
});
targetSubTools.push({
id: 'targetCR',
title: 'CR Target',
classes: 'imageViewerTool',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-target-cr',
disabled: isToolDisabled
});
targetSubTools.push({
id: 'targetUN',
title: 'UN Target',
classes: 'imageViewerTool',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-target-un',
disabled: isToolDisabled
});
const extraTools = [];
extraTools.push({
id: 'stackScroll',
title: 'Stack Scroll',
classes: 'imageViewerTool',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-stack-scroll'
});
extraTools.push({
id: 'resetViewport',
title: 'Reset',
classes: 'imageViewerCommand',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-reset'
});
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: 'invert',
title: 'Invert',
classes: 'imageViewerCommand',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-invert'
});
extraTools.push({
id: 'magnify',
title: 'Magnify',
classes: 'imageViewerTool',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-magnify'
});
extraTools.push({
id: 'ellipticalRoi',
title: 'Ellipse',
classes: 'imageViewerTool',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-elliptical-roi'
});
extraTools.push({
id: 'toggleDownloadDialog',
title: 'Download',
classes: 'imageViewerCommand',
iconClasses: 'fa fa-camera',
active: () => $('#imageDownloadDialog').is(':visible')
});
extraTools.push({
id: 'toggleCineDialog',
title: 'CINE',
classes: 'imageViewerCommand',
iconClasses: 'fa fa-youtube-play',
active: () => $('#cineDialog').is(':visible')
});
const buttonData = [];
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: 'linkStackScroll',
title: 'Link',
classes: 'imageViewerCommand toolbarSectionButton nonAutoDisableState',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-link',
disableFunction: Viewerbase.viewportUtils.isStackScrollLinkingDisabled
});
buttonData.push({
id: 'toggleTarget',
title: 'Target',
classes: 'rm-l-3',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-target',
disabled: isToolDisabled,
subTools: targetSubTools
});
buttonData.push({
id: 'nonTarget',
title: 'Non-Target',
classes: 'imageViewerTool',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-non-target',
disabled: isToolDisabled
});
buttonData.push({
id: 'length',
title: 'Temp',
classes: 'imageViewerTool',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-temp'
});
buttonData.push({
id: 'toggleMore',
title: 'More',
classes: 'rp-x-1 rm-l-3',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-more',
disabled: isToolDisabled,
subTools: extraTools
});
return buttonData;
}
});
Template.toolbarSection.events({
'click #toggleTarget'(event, instance) {
const $target = $(event.currentTarget);
if (!$target.hasClass('active') && $target.hasClass('expanded')) {
Viewerbase.toolManager.setActiveTool('bidirectional');
}
},
'click #toggleHUD'(event) {
const $this = $(event.currentTarget);
// Stop here if the tool is disabled
if ($this.hasClass('disabled')) {
return;
}
const state = Session.get('measurementTableHudOpen');
Session.set('measurementTableHudOpen', !state);
},
'click #toggleTrial'(event) {
if (!$(event.currentTarget).hasClass('disabled')) {
OHIF.ui.showDialog('trialOptionsModal');
}
}
});
Template.toolbarSection.onCreated( function() {
const instance = Template.instance();
instance.path = 'viewer.studyViewer.measurements';
instance.saveObserver = new Tracker.Dependency();
instance.api = {
save() {
// 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 = instance.data.measurementApi.storeMeasurements();
promise.then(successHandler).catch(errorHandler);
OHIF.ui.showDialog('dialogLoading', {
promise,
text: 'Saving measurement data'
});
return promise;
}
};
instance.unsavedChangesHandler = () => {
const isNotDisabled = !instance.$('.js-finish-case').hasClass('disabled');
if (isNotDisabled && instance.progressPercent.get() === 100) {
instance.api.save();
}
};
// Attach handler for unsaved changes dialog...
OHIF.ui.unsavedChanges.attachHandler(instance.path, 'save', instance.unsavedChangesHandler);
});
Template.toolbarSection.onRendered(function() {
// TODO: Figure out a way to disable/enable the buttons with each status from New API
// // Set disabled/enabled tool buttons that are set in toolManager
// const states = Viewerbase.toolManager.getToolDefaultStates();
// const disabledToolButtons = states.disabledToolButtons;
// const allToolbarButtons = $('.toolbarSection').find('.toolbarSectionButton:not(.nonAutoDisableState)');
//
// // Additional toolbar buttons whose classes are not toolbarSectionButton
// allToolbarButtons.push($('#toolbarSectionEntry')[0]);
// allToolbarButtons.push($('#toggleMeasurements')[0]);
//
// if (disabledToolButtons && disabledToolButtons.length > 0) {
// for (let i = 0; i < allToolbarButtons.length; i++) {
// const toolbarButton = allToolbarButtons[i];
// const index = disabledToolButtons.indexOf($(toolbarButton).attr('id'));
// if (index !== -1) {
// $(toolbarButton).addClass('disabled');
// $(toolbarButton).find('*').addClass('disabled');
// } else {
// $(toolbarButton).removeClass('disabled');
// $(toolbarButton).find('*').removeClass('disabled');
// }
// }
// }
});
Template.caseProgress.onDestroyed(() => {
const instance = Template.instance();
// Remove unsaved changes handler after this view has been destroyed...
OHIF.ui.unsavedChanges.removeHandler(instance.path, 'save', instance.unsavedChangesHandler);
});
@@ -0,0 +1,27 @@
@import "{ohif:design}/app"
.toolbarSection
theme('border-bottom', '%s solid $uiBorderColor' % $uiBorderThickness)
flex: 0 0 auto
height: $toolbarHeight
padding-top: 6px
position: relative
transition(height 300ms ease)
width: 100%
&.expanded
height: $toolbarHeight + $toolbarDrawerHeight
.toolbarSectionEntry
theme('color', '$defaultColor')
cursor: pointer
display: inline-block
theme('fill', '$defaultColor')
margin-top: 3px
min-width: 30px
theme('stroke', '$defaultColor')
text-align: center
.saveMeasurements
display: inline-block
margin-left: 22px
@@ -0,0 +1,17 @@
<template name="viewer">
<div class="viewerDialogs">
{{#if and Template.subscriptionsReady dataSourcesReady}}
{{>confirmDeleteDialog}}
{{>measurementTableHUD (clone this)}}
{{>cineDialog}}
{{/if}}
</div>
<div id="viewer">
{{#if and Template.subscriptionsReady dataSourcesReady}}
{{>toolbarSection (clone this state=state)}}
{{>viewerSection (clone this state=state)}}
{{else}}
{{>loadingText}}
{{/if}}
</div>
</template>
@@ -0,0 +1,385 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Tracker } from 'meteor/tracker';
import { Session } from 'meteor/session';
import { ReactiveDict } from 'meteor/reactive-dict';
import { _ } from 'meteor/underscore';
import { $ } from 'meteor/jquery';
import { OHIF } from 'meteor/ohif:core';
import 'meteor/ohif:cornerstone';
import 'meteor/ohif:viewerbase';
import 'meteor/ohif:metadata';
Meteor.startup(() => {
Session.set('TimepointsReady', false);
Session.set('MeasurementsReady', false);
OHIF.viewer.displaySeriesQuickSwitch = true;
OHIF.viewer.stackImagePositionOffsetSynchronizer = new OHIF.viewerbase.StackImagePositionOffsetSynchronizer();
// Create the synchronizer used to update reference lines
OHIF.viewer.updateImageSynchronizer = new cornerstoneTools.Synchronizer('cornerstonenewimage', cornerstoneTools.updateImageSynchronizer);
OHIF.viewer.metadataProvider = new OHIF.cornerstone.MetadataProvider();
// Metadata configuration
const metadataProvider = OHIF.viewer.metadataProvider;
cornerstone.metaData.addProvider(metadataProvider.getProvider());
// Target tools configuration
OHIF.lesiontracker.configureTargetToolsHandles();
});
Template.viewer.onCreated(() => {
Session.set('ViewerReady', false);
const instance = Template.instance();
// Define the OHIF.viewer.data global object
OHIF.viewer.data = OHIF.viewer.data || Session.get('ViewerData') || {};
const { TimepointApi, MeasurementApi, ConformanceCriteria } = OHIF.measurements;
const currentTimepointId = OHIF.viewer.data.currentTimepointId;
const timepointApi = new TimepointApi(currentTimepointId);
const measurementApi = new MeasurementApi(timepointApi);
const conformanceCriteria = new ConformanceCriteria(measurementApi, timepointApi);
const apis = {
timepointApi,
measurementApi,
conformanceCriteria
};
Object.assign(OHIF.viewer, apis);
Object.assign(instance.data, apis);
instance.state = new ReactiveDict();
instance.state.set('leftSidebar', Session.get('leftSidebar'));
instance.state.set('rightSidebar', Session.get('rightSidebar'));
const viewportUtils = OHIF.viewerbase.viewportUtils;
OHIF.viewer.functionList = $.extend(OHIF.viewer.functionList, {
toggleLesionTrackerTools: OHIF.lesiontracker.toggleLesionTrackerTools,
bidirectional: () => {
// Used for hotkeys
OHIF.viewerbase.toolManager.setActiveTool('bidirectional');
},
nonTarget: () => {
// Used for hotkeys
OHIF.viewerbase.toolManager.setActiveTool('nonTarget');
},
// Viewport functions
toggleCineDialog: viewportUtils.toggleCineDialog,
clearTools: viewportUtils.clearTools,
resetViewport: viewportUtils.resetViewport,
invert: viewportUtils.invert,
flipV: viewportUtils.flipV,
flipH: viewportUtils.flipH,
rotateL: viewportUtils.rotateL,
rotateR: viewportUtils.rotateR,
linkStackScroll: viewportUtils.linkStackScroll
});
if (OHIF.viewer.data.loadedSeriesData) {
OHIF.log.info('Reloading previous loadedSeriesData');
OHIF.viewer.loadedSeriesData = OHIF.viewer.data.loadedSeriesData;
} else {
OHIF.log.info('Setting default viewer data');
OHIF.viewer.loadedSeriesData = {};
OHIF.viewer.data.loadedSeriesData = {};
}
Session.set('activeViewport', OHIF.viewer.data.activeViewport || false);
// Set lesion tool buttons as disabled if pixel spacing is not available for active element
instance.autorun(OHIF.lesiontracker.pixelSpacingAutorunCheck);
// @TypeSafeStudies
// Clears OHIF.viewer.Studies collection
OHIF.viewer.Studies.removeAll();
// @TypeSafeStudies
// Clears OHIF.viewer.StudyMetadataList collection
OHIF.viewer.StudyMetadataList.removeAll();
instance.data.studies.forEach(study => {
const studyMetadata = new OHIF.metadata.StudyMetadata(study, study.studyInstanceUid);
let displaySets = study.displaySets;
if (!study.displaySets) {
displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(studyMetadata);
study.displaySets = displaySets;
}
studyMetadata.setDisplaySets(displaySets);
study.selected = true;
OHIF.viewer.Studies.insert(study);
OHIF.viewer.StudyMetadataList.insert(studyMetadata);
});
const patientId = instance.data.studies[0].patientId;
// LT-382: Preventing HP to keep identifying studies in timepoints that might be removed
instance.data.studies.forEach(study => (delete study.timepointType));
// TODO: Consider combining the retrieval calls into one?
const timepointsPromise = timepointApi.retrieveTimepoints({ patientId });
timepointsPromise.then(() => {
const timepoints = timepointApi.all();
// Set timepointType in studies to be used in hanging protocol engine
timepoints.forEach(timepoint => {
timepoint.studyInstanceUids.forEach(studyInstanceUid => {
const study = _.find(instance.data.studies, element => {
return element.studyInstanceUid === studyInstanceUid;
});
if (!study) {
return;
}
// @TODO: Maybe this should be a setCustomAttribute?
study.timepointType = timepoint.timepointType;
});
});
Session.set('TimepointsReady', true);
const timepointIds = timepoints.map(t => t.timepointId);
const measurementsPromise = measurementApi.retrieveMeasurements(patientId, timepointIds);
measurementsPromise.then(() => {
Session.set('MeasurementsReady', true);
measurementApi.syncMeasurementsAndToolData();
});
});
// Provide the necessary data to the Measurement API and Timepoint API
const prior = timepointApi.prior();
if (prior) {
measurementApi.priorTimepointId = prior.timepointId;
}
// Enable/Disable Lesion Tracker Tools if the opened study is associated or not
OHIF.lesiontracker.toggleLesionTrackerToolsButtons(!!currentTimepointId);
let firstMeasurementActivated = false;
instance.autorun(() => {
if (!Session.get('TimepointsReady') ||
!Session.get('MeasurementsReady') ||
!Session.get('ViewerReady') ||
firstMeasurementActivated) {
return;
}
// Find and activate the first measurement by Lesion Number
// NOTE: This is inefficient, we should be using a hanging protocol
// to hang the first measurement's imageId immediately, rather
// than changing images after initial loading...
const config = OHIF.measurements.MeasurementApi.getConfiguration();
const tools = config.measurementTools[0].childTools;
const firstTool = tools[Object.keys(tools)[0]];
const measurementTypeId = firstTool.id;
const collection = measurementApi.tools[measurementTypeId];
const sorting = {
sort: {
measurementNumber: -1
}
};
const data = collection.find({}, sorting).fetch();
const current = timepointApi.current();
if (!current) {
return;
}
let timepoints = [current];
const prior = timepointApi.prior();
if (prior) {
timepoints.push(prior);
}
// TODO: Clean this up, it's probably an inefficient way to get what we need
const groupObject = _.groupBy(data, m => m.measurementNumber);
// Reformat the data
const rows = Object.keys(groupObject).map(key => ({
measurementTypeId: measurementTypeId,
measurementNumber: key,
entries: groupObject[key]
}));
const rowItem = rows[0];
// Activate the first lesion
if (rowItem) {
OHIF.measurements.jumpToRowItem(rowItem, timepoints);
}
firstMeasurementActivated = true;
});
instance.measurementModifiedHandler = _.throttle((event, instance) => {
OHIF.measurements.MeasurementHandlers.onModified(event, instance);
}, 300);
});
/**
* Sets sidebar configuration and active tool based on viewer template instance
* @param {Object} instance Template instance for viewer template
*/
const setActiveToolAndSidebar = () => {
const instance = Template.instance();
const { studies, currentTimepointId, measurementApi, timepointIds } = instance.data;
// Default actions for Associated Studies
if (currentTimepointId) {
// Follow-up studies: same as the first measurement in the table
// Baseline studies: target-tool
if (studies[0]) {
let activeTool;
// In follow-ups, get the baseline timepointId
const timepointId = timepointIds.find(id => id !== currentTimepointId);
// Follow-up studies
if (studies[0].timepointType === 'followup' && timepointId) {
const measurementTools = OHIF.measurements.MeasurementApi.getConfiguration().measurementTools;
// Create list of measurement tools
const measurementTypes = measurementTools.map(
tool => {
const { id, cornerstoneToolType } = tool;
return {
id,
cornerstoneToolType
};
}
);
// Iterate over each measurement tool to find the first baseline
// measurement. If so, stops the loop and prevent fetching from all
// collections
measurementTypes.every(({ id, cornerstoneToolType }) => {
// Get measurement
if (measurementApi[id]) {
const measurement = measurementApi[id].findOne({ timepointId });
// Found a measurement, save tool and stop loop
if (measurement) {
const isArray = Array.isArray(cornerstoneToolType);
activeTool = isArray ? cornerstoneToolType[0] : cornerstoneToolType;
return false;
}
}
return true;
});
}
// If not set, for associated studies default is target-tool
OHIF.viewerbase.toolManager.setActiveTool(activeTool || 'bidirectional');
}
// Toggle Measurement Table
if (instance.state) {
instance.state.set('rightSidebar', 'measurements');
}
}
// Hide as default for single study
else {
if (instance.state) {
instance.state.set('rightSidebar', null);
}
}
};
/**
* Inits OHIF Hanging Protocol's onReady.
* It waits for OHIF Hanging Protocol to be ready to instantiate the ProtocolEngine
* Hanging Protocol will use OHIF LayoutManager to render viewports properly
*/
const initHangingProtocol = () => {
// When Hanging Protocol is ready
HP.ProtocolStore.onReady(() => {
setActiveToolAndSidebar();
// Gets all StudyMetadata objects: necessary for Hanging Protocol to access study metadata
const studyMetadataList = OHIF.viewer.StudyMetadataList.all();
// Caches Layout Manager: Hanging Protocol uses it for layout management according to current protocol
const layoutManager = OHIF.viewerbase.layoutManager;
// Instantiate StudyMetadataSource: necessary for Hanging Protocol to get study metadata
const studyMetadataSource = new OHIF.studies.classes.OHIFStudyMetadataSource();
// Creates Protocol Engine object with required arguments
const ProtocolEngine = new HP.ProtocolEngine(layoutManager, studyMetadataList, [], studyMetadataSource);
// Sets up Hanging Protocol engine
HP.setEngine(ProtocolEngine);
Session.set('ViewerReady', true);
Session.set('activeViewport', 0);
});
};
Template.viewer.onRendered(function() {
this.autorun(() => {
// To make sure ohif viewerMain is rendered before initializing Hanging Protocols
const isOHIFViewerMainRendered = Session.get('OHIFViewerMainRendered');
// To avoid first run
if (isOHIFViewerMainRendered) {
// To run only when ViewerMainRendered dependency has changed.
// because initHangingProtocol can have other reactive components
Tracker.nonreactive(initHangingProtocol);
}
});
});
Template.viewer.helpers({
dataSourcesReady() {
// TODO: Find a better way to do this
const ready = Session.get('TimepointsReady') && Session.get('MeasurementsReady');
OHIF.log.info('dataSourcesReady? : ' + ready);
return ready;
},
state() {
return Template.instance().state;
}
});
Template.viewer.events({
'cornerstonetoolsmeasurementadded .imageViewerViewport'(event, instance) {
const originalEvent = event.originalEvent;
OHIF.measurements.MeasurementHandlers.onAdded(originalEvent, instance);
},
'cornerstonetoolsmeasurementmodified .imageViewerViewport'(event, instance) {
const originalEvent = event.originalEvent;
instance.measurementModifiedHandler(originalEvent, instance);
},
'cornerstonemeasurementremoved .imageViewerViewport'(event, instance) {
const originalEvent = event.originalEvent;
OHIF.measurements.MeasurementHandlers.onRemoved(originalEvent, instance);
}
});
Template.viewer.onDestroyed(() => {
Session.set('ViewerMainReady', false);
Session.set('TimepointsReady', false);
Session.set('MeasurementsReady', false);
OHIF.viewer.stackImagePositionOffsetSynchronizer.deactivate();
});
@@ -0,0 +1,50 @@
@import "{ohif:design}/app"
#viewer
background-color: black
height: 100%
width: 100%
#imageViewerViewports
.viewportContainer
border: none !important
outline: 0 !important // Prevent blue outline in Chrome
position: relative
&:hover
&.active
&:hover.active
border: none !important
outline: 0 !important // Prevent blue outline in Chrome
.imageViewerViewport
theme('border-bottom', '%s solid $uiBorderColor' % $uiBorderThickness)
canvas
border-color: transparent
border-style: solid
border-width: 1px
&:not(:last-child)
.imageViewerViewport
theme('border-right', '%s solid $uiBorderColor' % $uiBorderThickness)
&:first-child
.imageViewerViewport
theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness)
&.active
.imageViewerViewport
border-right: none !important
canvas
theme('border-color', '$uiBorderColorActive')
.sidebar-left-open
#imageViewerViewports
.viewportContainer
&:first-child
.removable
.imageViewerViewport
border-left: none
@@ -0,0 +1,21 @@
<template name="viewerSection">
<div class="viewerSection">
<div class="sidebarMenu sidebar-left {{#if leftSidebarOpen}}sidebar-open{{/if}}">
{{#if isTimepointBrowser}}
{{>timepointBrowserSidebar (clone this)}}
{{else}}
{{#if instance.loading.get}}
{{>loadingText}}
{{else}}
{{>studyBrowserSidebar (clone this studiesInformation=instance.studiesInformation.get)}}
{{/if}}
{{/if}}
</div>
<div class="mainContent {{#if leftSidebarOpen}}sidebar-left-open{{/if}} {{#if rightSidebarOpen}}sidebar-right-open{{/if}}">
{{>viewerMain (clone this)}}
</div>
<div class="sidebarMenu sidebar-right {{#if rightSidebarOpen}}sidebar-open{{/if}}">
{{>measurementTable (clone this)}}
</div>
</div>
</template>
@@ -0,0 +1,72 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { $ } from 'meteor/jquery';
import { OHIF } from 'meteor/ohif:core';
Template.viewerSection.onCreated(() => {
const instance = Template.instance();
instance.isTimepointBrowser = () => !!OHIF.viewer.data.currentTimepointId;
OHIF.viewer.quickSwitchStudyBrowserTemplate = 'timepointBrowserQuickSwitch';
if (!instance.isTimepointBrowser()) {
OHIF.viewer.quickSwitchStudyBrowserTemplate = 'studyBrowserQuickSwitch';
instance.loading = new ReactiveVar(true);
instance.studiesInformation = new ReactiveVar([]);
const filter = { studyInstanceUid: OHIF.viewer.data.studyInstanceUids };
OHIF.studies.searchStudies(filter).then(studiesData => {
instance.loading.set(false);
instance.studiesInformation.set(studiesData);
}).catch(error => {
instance.loading.set(false);
const text = 'An error has occurred while retrieving studies information';
OHIF.ui.notifications.danger({ text });
OHIF.log.error(error);
});
}
});
Template.viewerSection.events({
'transitionend .sidebarMenu'(event) {
if (!event.target.classList.contains('sidebarMenu')) return;
window.ResizeViewportManager.handleResize();
},
'ohif.measurements.timepoint.changeViewType .timepoint-browser-list'(event, instance, viewType) {
const $browserList = $(event.currentTarget);
const $allBrowserItems = $browserList.find('.timepoint-browser-item');
// Removes all active classes to collapse the timepoints and studies
$allBrowserItems.removeClass('active');
if (viewType === 'key') {
const { timepointIds, currentTimepointId } = OHIF.viewer.data;
timepointIds.forEach(timepointId => {
const $browserItem = $allBrowserItems.filter(`[data-id=${timepointId}]`);
$browserItem.find('.timepoint-item').trigger('ohif.measurements.timepoint.load');
});
// Show only current timepoint expanded on key timepoints tab
const $browserItem = $allBrowserItems.filter(`[data-id=${currentTimepointId}]`);
$browserItem.find('.timepoint-item').trigger('click');
}
}
});
Template.viewerSection.helpers({
leftSidebarOpen() {
return Template.instance().data.state.get('leftSidebar');
},
rightSidebarOpen() {
return Template.instance().data.state.get('rightSidebar');
},
isTimepointBrowser() {
return Template.instance().isTimepointBrowser();
},
studiesInformation() {
return Template.instance().studiesInformation.get();
}
});
@@ -0,0 +1,81 @@
@require '{ohif:design}/app'
.viewerSection
display: flex
flex: 1
flex-flow: row nowrap
align-items: stretch
height: 'calc(100% - %s)' % ($toolbarHeight + $topBarHeight)
width: 100%
.sidebarMenu
height: 100%
// required transformation to make inner fixed elements relative to this one
transform(scale(1))
transition($sidebarTransition)
.sidebar-option
height: 100%
max-width: inherit
position: absolute
transform(translateX(100%))
transition($sidebarTransition)
width: 100%
&.active
transform(translateX(0%))
.sidebar-left
theme('border-right', '%s solid $uiBorderColor' % $uiBorderThickness)
flex: 1
margin-left: - $studiesSidebarMenuWidth
max-width: $studiesSidebarMenuWidth
order: 1
visibility: hidden
&.sidebar-open
margin-left: 0
visibility: visible
.loadingTextDiv
theme('color', '$textSecondaryColor')
font-size: 32px
.mainContent
flex: 1
height: 100%
order: 2
overflow: visible
position: relative
transition($sidebarTransition)
width: 100%
.viewerMain
left: 0
position: absolute
top: 0
.sidebar-right
flex: 1
margin-right: - $rightSidebarMenuWidth
max-width: $rightSidebarMenuWidth
order: 3
position: relative
visibility: hidden
&[data-timepoints="3"]
margin-right: - ($rightSidebarMenuWidth + 135.5px)
max-width: $rightSidebarMenuWidth + 135.5px
&[data-timepoints="4"]
margin-right: - ($rightSidebarMenuWidth + 270px)
max-width: $rightSidebarMenuWidth + 270px
&.sidebar-open
margin-right: 0
visibility: visible
.studiesListedChanger
theme('border-bottom', '%s solid $uiBorderColor' % $uiBorderThickness)
padding: 20px 10px
text-align: center
+34
View File
@@ -0,0 +1,34 @@
import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { OHIF } from 'meteor/ohif:core';
import { cornerstoneWADOImageLoader } from 'meteor/ohif:cornerstone';
Meteor.startup(function() {
const maxWebWorkers = Math.max(navigator.hardwareConcurrency - 1, 1);
const config = {
maxWebWorkers: maxWebWorkers,
startWebWorkersOnDemand: true,
webWorkerPath : OHIF.utils.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderWebWorker.es5.js'),
taskConfiguration: {
'decodeTask' : {
loadCodecsOnStartup : true,
initializeCodecsOnStartup: false,
codecsPath: OHIF.utils.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderCodecs.es5.js'),
usePDFJS: false
}
}
};
cornerstoneWADOImageLoader.webWorkerManager.initialize(config);
cornerstoneWADOImageLoader.configure({
beforeSend: function(xhr) {
const userId = Meteor.userId();
const loginToken = Accounts._storedLoginToken();
if (userId && loginToken) {
xhr.setRequestHeader("x-user-id", userId);
xhr.setRequestHeader("x-auth-token", loginToken);
}
}
});
});
+17
View File
@@ -0,0 +1,17 @@
<head>
<meta charset="utf-8">
<title>Lesion Tracker</title>
<meta name="description" content="Prototype viewer application for oncology">
<!-- Prevents page zooming -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="shortcut icon" type="image/png" href="/images/logo.png" sizes="16x16 32x32 64x64">
<!--Best display for mobile devices-->
<meta http-equiv="cleartype" content="on">
<meta name="MobileOptimized" content="320">
<meta name="HandheldFriendly" content="True">
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Make SVG work on IE -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
@@ -0,0 +1,111 @@
import { Meteor } from 'meteor/meteor';
Meteor.startup(() => {
console.log('Adding Lesion Tracker Hanging Protocols');
//------------------------------------------------------------------------------
// Define Baseline protocol
const proto = new HP.Protocol('LT_Baseline');
proto.locked = true;
const isBaseline = new HP.ProtocolMatchingRule();
isBaseline.required = true;
isBaseline.weight = 1;
isBaseline.attribute = 'timepointType';
isBaseline.constraint = {
equals: {
value: 'baseline'
}
};
proto.addProtocolMatchingRule(isBaseline);
const oneByOne = new HP.ViewportStructure('grid', {
rows: 1,
columns: 1
});
// Stage 1
const single = new HP.Viewport();
const baseline = new HP.StudyMatchingRule(true);
baseline.required = true;
baseline.attribute = 'timepointType';
baseline.constraint = {
equals: {
value: 'baseline'
}
};
single.studyMatchingRules.push(baseline);
const first = new HP.Stage(oneByOne, 'oneByOne');
first.viewports.push(single);
proto.addStage(first);
HP.lesionTrackerBaselineProtocol = proto;
HP.lesionTrackerBaselineProtocol.id = 'lesionTrackerBaselineProtocol';
//------------------------------------------------------------------------------
// Define Followup Protocol
const protoFollowup = new HP.Protocol('LT_BaselineFollowup');
protoFollowup.locked = true;
const isFollowup = new HP.ProtocolMatchingRule();
isFollowup.required = true;
isFollowup.weight = 2;
isFollowup.attribute = 'timepointType';
isFollowup.constraint = {
equals: {
value: 'followup'
}
};
protoFollowup.addProtocolMatchingRule(isFollowup);
const oneByTwo = new HP.ViewportStructure('grid', {
rows: 1,
columns: 2
});
// Stage 1
const left = new HP.Viewport();
const right = new HP.Viewport();
const baseline2 = new HP.StudyMatchingRule(true);
baseline2.required = true;
baseline2.attribute = 'timepointType';
baseline2.constraint = {
equals: {
value: 'baseline'
}
};
const followup = new HP.StudyMatchingRule();
followup.required = true;
followup.attribute = 'timepointType';
followup.constraint = {
equals: {
value: 'followup'
}
};
left.studyMatchingRules.push(followup);
right.studyMatchingRules.push(baseline2);
const first2 = new HP.Stage(oneByTwo, 'oneByTwo');
first2.viewports.push(left);
first2.viewports.push(right);
protoFollowup.addStage(first2);
HP.lesionTrackerFollowupProtocol = protoFollowup;
HP.lesionTrackerFollowupProtocol.id = 'lesionTrackerFollowupProtocol';
HP.ProtocolStore.onReady(() => {
console.log('Inserting lesion tracker protocols');
HP.ProtocolStore.addProtocol(HP.lesionTrackerBaselineProtocol);
HP.ProtocolStore.addProtocol(HP.lesionTrackerFollowupProtocol);
});
});
@@ -0,0 +1,53 @@
import { Meteor } from 'meteor/meteor';
import { _ } from 'meteor/underscore';
import { OHIF } from 'meteor/ohif:core';
Meteor.startup(() => {
const { toolManager } = OHIF.viewerbase;
const contextName = 'viewer';
// Enable the custom tools
const customTools = [{
id: 'bidirectional',
name: 'Target'
}, {
id: 'nonTarget',
name: 'Non-Target'
}, {
id: 'targetCR',
name: 'CR Target'
}, {
id: 'targetUN',
name: 'UN Target'
}];
customTools.forEach(tool => {
_.defaults(OHIF.hotkeys.defaults[contextName], { [tool.id]: '' });
OHIF.commands.register(contextName, tool.id, {
name: tool.name,
action: tool.action || (() => toolManager.setActiveTool(tool.id))
});
});
// Enable the custom commands
const customCommands = [{
id: 'linkStackScroll',
name: 'Link',
action: OHIF.viewerbase.viewportUtils.linkStackScroll
}, {
id: 'saveMeasurements',
name: 'Save measurements',
hotkey: 'CTRL+S',
action() {
const activeTimepoint = OHIF.measurements.getActiveTimepoint();
if (!activeTimepoint) return;
OHIF.measurements.saveMeasurements(OHIF.viewer.measurementApi, activeTimepoint.timepointId);
}
}];
customCommands.forEach(command => {
_.defaults(OHIF.hotkeys.defaults[contextName], { [command.id]: command.hotkey || '' });
OHIF.commands.register(contextName, command.id, {
name: command.name,
action: command.action || (() => toolManager.setActiveTool(command.id))
});
});
});
+3
View File
@@ -0,0 +1,3 @@
import loglevel from 'loglevel';
log = loglevel.getLogger('OHIFViewer');
log.setLevel('info');
+78
View File
@@ -0,0 +1,78 @@
import { Meteor } from 'meteor/meteor';
import { Router } from 'meteor/clinical:router';
import { OHIF } from 'meteor/ohif:core';
Router.configure({
loadingTemplate: 'loading'
});
// If we are running a disconnected client similar to the StandaloneViewer
// (see https://docs.ohif.org/standalone-viewer/usage.html) we don't want
// our routes to get stuck while waiting for Pub / Sub.
//
// In this case, the developer is required to add Servers and specify
// a CurrentServer with some other approach (e.g. a separate script).
if (Meteor.settings &&
Meteor.settings.public &&
Meteor.settings.public.clientOnly !== true) {
Router.waitOn(function() {
return [
Meteor.subscribe('servers'),
Meteor.subscribe('currentServer')
];
});
}
Router.onBeforeAction('loading');
Router.onBeforeAction(function() {
// verifyEmail controls whether emailVerification template will be rendered or not
const publicSettings = Meteor.settings && Meteor.settings.public;
const verifyEmail = publicSettings && publicSettings.verifyEmail || false;
// Check if user is signed in or needs an email verification
if (!Meteor.userId() && !Meteor.loggingIn()) {
this.render('entrySignIn');
} else if (verifyEmail && Meteor.user().emails && !Meteor.user().emails[0].verified) {
this.render('emailVerification');
} else {
this.next();
}
}, {
except: ['entrySignIn', 'entrySignUp', 'forgotPassword', 'resetPassword', 'emailVerification']
});
Router.route('/', function() {
Router.go('studylist', {}, { replaceState: true });
}, { name: 'home' });
Router.route('/studylist', {
name: 'studylist',
onBeforeAction: function() {
const next = this.next;
// Retrieve the timepoints data to display in studylist
const promise = OHIF.studylist.timepointApi.retrieveTimepoints({});
promise.then(() => next());
},
action: function() {
this.render('app', { data: { template: 'studylist' } });
}
});
Router.route('/viewer/timepoints/:timepointId', function() {
const timepointId = this.params.timepointId;
OHIF.viewerbase.renderViewer(this, { timepointId });
}, { name: 'viewerTimepoint' });
Router.route('/viewer/studies/:studyInstanceUids', function() {
const studyInstanceUids = this.params.studyInstanceUids.split(';');
OHIF.viewerbase.renderViewer(this, { studyInstanceUids });
}, { name: 'viewerStudies' });
// OHIF #98 Show specific series of study
Router.route('/study/:studyInstanceUid/series/:seriesInstanceUids', function () {
const studyInstanceUid = this.params.studyInstanceUid;
const seriesInstanceUids = this.params.seriesInstanceUids.split(';');
OHIF.viewerbase.renderViewer(this, { studyInstanceUids: [studyInstanceUid], seriesInstanceUids });
}, { name: 'viewerSeries' });
File diff suppressed because it is too large. Load diff
+38
View File
@@ -0,0 +1,38 @@
{
"name": "LesionTracker",
"private": true,
"scripts": {
"lint": "eslint .",
"fix": "eslint --fix .",
"pretest": "npm run lint --silent"
},
"version": "1.0.0",
"description": "",
"dependencies": {
"@babel/runtime": "7.0.0-beta.51",
"bcrypt": "^3.0.1",
"loglevel": "^1.6.1",
"url": "^0.11.0"
},
"devDependencies": {
"babel-eslint": "^10.0.1",
"eslint": "^5.6.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-import-resolver-meteor": "^0.4.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-meteor": "^5.1.0",
"eslint-plugin-react": "^7.11.1"
},
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/OHIF/Viewers.git"
},
"author": "OHIF",
"license": "MIT",
"bugs": {
"url": "https://github.com/OHIF/Viewers/issues"
},
"homepage": "https://github.com/OHIF/Viewers"
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+52
View File
@@ -0,0 +1,52 @@
import { OHIF } from 'meteor/ohif:core';
Meteor.startup(function () {
// Mail server settings
var username = Meteor.settings && Meteor.settings.mailServerSettings && Meteor.settings.mailServerSettings.username || null;
var password = Meteor.settings && Meteor.settings.mailServerSettings && Meteor.settings.mailServerSettings.password || null;
var server = Meteor.settings && Meteor.settings.mailServerSettings && Meteor.settings.mailServerSettings.server || null;
var port = Meteor.settings && Meteor.settings.mailServerSettings && Meteor.settings.mailServerSettings.port || null;
var verifyEmail = Meteor.settings && Meteor.settings.public && Meteor.settings.public.verifyEmail || false;
var siteName = Meteor.settings && Meteor.settings.public && Meteor.settings.public.siteName || "Lesion Tracker";
if (username && password && server && port) {
Accounts.emailTemplates.siteName = siteName;
Accounts.emailTemplates.from = siteName+' Admin <'+username+'>';
process.env.MAIL_URL = 'smtp://' +
encodeURIComponent(username) + ':' +
encodeURIComponent(password) + '@' +
encodeURIComponent(server) + ':' + port;
// Subject line of the email.
Accounts.emailTemplates.verifyEmail.subject = function(user) {
return 'Confirm Your Email Address for '+siteName;
};
// Email text
Accounts.emailTemplates.verifyEmail.text = function(user, url) {
return 'Thank you for registering. Please click on the following link to verify your email address: \r\n' + url;
};
// Reset password mail
Accounts.emailTemplates.resetPassword.subject = function() {
return 'Reset your '+siteName+' password'
};
Accounts.urls.resetPassword = function(token) {
return OHIF.utils.absoluteUrl('resetPassword/' + token);
};
Accounts.emailTemplates.resetPassword.text = function(user, url) {
return "Hello " + user.profile.fullName + ",\n\n" +
"Click the following link to set your new password:\n" +
url + "\n\n";
};
// Send email when account is created
Accounts.config({
sendVerificationEmail: verifyEmail
});
}
});