reorganize packages, start converting overall app to react (very broken at the moment)
This commit is contained in:
1 parent
024fe1a448
commit
5f30f7bd35
479 files changed
+5364
-11611
No files matched your search
@@ -0,0 +1,30 @@
|
||||
// Measurement Table Components imports
|
||||
import './measurementTable.html';
|
||||
import './measurementTable.styl';
|
||||
import './measurementTable.js';
|
||||
|
||||
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';
|
||||
|
||||
import './measurementTableHeaderRow/measurementTableHeaderRow.html';
|
||||
import './measurementTableHeaderRow/measurementTableHeaderRow.styl';
|
||||
import './measurementTableHeaderRow/measurementTableHeaderRow.js';
|
||||
|
||||
import './measurementTableTimepointCell/measurementTableTimepointCell.html';
|
||||
import './measurementTableTimepointCell/measurementTableTimepointCell.styl';
|
||||
import './measurementTableTimepointCell/measurementTableTimepointCell.js';
|
||||
|
||||
import './measurementTableTimepointHeader/measurementTableTimepointHeader.html';
|
||||
import './measurementTableTimepointHeader/measurementTableTimepointHeader.styl';
|
||||
import './measurementTableTimepointHeader/measurementTableTimepointHeader.js';
|
||||
|
||||
import './measurementTableWarnings/measurementTableWarningsDialog.html';
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<template name="measurementTable">
|
||||
<div id="measurementTableContainer" class="flex-v">
|
||||
<div class="measurementTableHeader">
|
||||
{{#if this.timepoints.get.length}}
|
||||
<div class="measurementTableLayoutChanger viewerRoundedButtonGroup">
|
||||
{{>roundedButtonGroup buttonGroupData}}
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="measurementTableTimepointHeaderRow">
|
||||
<div class="warning-status {{#unless hasWarnings}}hidden{{/unless}}">
|
||||
<svg>
|
||||
<use xlink:href={{absoluteUrl "packages/ohif_viewerbase/assets/icons.svg#icon-ui-warning"}}></use>
|
||||
</svg>
|
||||
</div>
|
||||
{{#each timepoint in this.timepoints.get}}
|
||||
{{>measurementTableTimepointHeader (clone this timepoint)}}
|
||||
{{/each}}
|
||||
<!-- TODO: Add header for cross-sectional / non-longitudinal data -->
|
||||
</div>
|
||||
</div>
|
||||
{{#scrollArea class='measurementTableView flex-grow fit' scrollStep=63}}
|
||||
{{>measurementTableView (clone this)}}
|
||||
{{/scrollArea}}
|
||||
</div>
|
||||
</template>
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import _ from 'underscore';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
Template.measurementTable.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
instance.data.measurementTableLayout = new ReactiveVar('comparison');
|
||||
instance.data.timepoints = new ReactiveVar([]);
|
||||
|
||||
// Run this computation every time table layout changes
|
||||
instance.autorun(() => {
|
||||
// Get the current table layout
|
||||
const tableLayout = instance.data.measurementTableLayout.get();
|
||||
|
||||
const timepointApi = instance.data.timepointApi;
|
||||
let timepoints;
|
||||
if (!timepointApi) {
|
||||
timepoints = [];
|
||||
} else if (tableLayout === 'key') {
|
||||
timepoints = timepointApi.key();
|
||||
} else {
|
||||
timepoints = timepointApi.comparison();
|
||||
}
|
||||
|
||||
// Return key timepoints
|
||||
instance.data.timepoints.set(timepoints);
|
||||
});
|
||||
});
|
||||
|
||||
Template.measurementTable.onRendered(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
instance.autorun(() => {
|
||||
// Run this computation every time the lesion table layout is changed
|
||||
instance.data.measurementTableLayout.dep.depend();
|
||||
|
||||
if (instance.data.state.get('rightSidebar') !== 'measurements') {
|
||||
// Remove the amount attribute from sidebar element tag
|
||||
instance.$('#measurementTableContainer').closest('.sidebarMenu').removeAttr('data-timepoints');
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the amount of timepoints being shown
|
||||
const timepointAmount = instance.data.timepoints.get().length;
|
||||
|
||||
// Set the amount in an attribute on sidebar element tag
|
||||
instance.$('#measurementTableContainer').closest('.sidebarMenu').attr('data-timepoints', timepointAmount);
|
||||
});
|
||||
});
|
||||
|
||||
Template.measurementTable.helpers({
|
||||
hasWarnings() {
|
||||
return Template.instance().data.conformanceCriteria.nonconformities.get();
|
||||
},
|
||||
|
||||
buttonGroupData() {
|
||||
const instance = Template.instance();
|
||||
return {
|
||||
value: instance.data.measurementTableLayout,
|
||||
options: [{
|
||||
value: 'comparison',
|
||||
text: 'Comparison'
|
||||
}, {
|
||||
value: 'key',
|
||||
text: 'Key Timepoints'
|
||||
}]
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
Template.measurementTable.events({
|
||||
'click .warning-status'(event, instance) {
|
||||
const nonconformities = instance.data.conformanceCriteria.nonconformities.get();
|
||||
const messages = [];
|
||||
_.each(nonconformities, nonconformity => messages.push(nonconformity.message));
|
||||
|
||||
OHIF.ui.showDialog('measurementTableWarningsDialog', {
|
||||
messages,
|
||||
position: {
|
||||
x: event.clientX,
|
||||
y: event.clientY
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
@require '{ohif:viewerbase}/app'
|
||||
|
||||
#measurementTableContainer
|
||||
theme('background-color', '$primaryBackgroundColor')
|
||||
height: 100%
|
||||
width: 100%
|
||||
|
||||
.measurementTableTimepointHeaderRow
|
||||
display: flex
|
||||
padding: 0 2px 0 44px
|
||||
position: relative
|
||||
|
||||
.warning-status
|
||||
theme('border', '2px solid $uiYellow')
|
||||
border-radius: 16px
|
||||
cursor: pointer
|
||||
height: 32px
|
||||
left: 0
|
||||
margin: 4px 6px
|
||||
padding-top: 1px
|
||||
position: absolute
|
||||
text-align: center
|
||||
top: 0
|
||||
transition(border-color 0.3s ease)
|
||||
width: 32px
|
||||
|
||||
&:hover
|
||||
theme('border-color', '$hoverColor')
|
||||
|
||||
svg
|
||||
theme('fill', '$hoverColor')
|
||||
|
||||
svg
|
||||
theme('fill', '$uiYellow')
|
||||
display: inline
|
||||
height: 20px
|
||||
transition(all 0.3s ease)
|
||||
width: 22px
|
||||
|
||||
.measurementTableLayoutChanger
|
||||
margin: 0 auto
|
||||
padding: 20px
|
||||
text-align: center
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<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>
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
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;
|
||||
}
|
||||
});
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
@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')
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<template name="measurementTableHeaderRow">
|
||||
<div class="measurementTableHeaderRow">
|
||||
<div class="type">{{toolGroup.name}}</div>
|
||||
<div class="max {{#if gt numberOfMeasurements maxNumMeasurements}}warning{{/if}}">
|
||||
{{#if getMax toolGroup.id}}
|
||||
<p class="maxNumMeasurements">Max {{getMax toolGroup.id}}</p>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="numberOfMeasurements">{{numberOfMeasurements toolGroup.id}}</div>
|
||||
</div>
|
||||
</template>
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { Viewerbase } from 'meteor/ohif:viewerbase';
|
||||
|
||||
Template.measurementTableHeaderRow.helpers({
|
||||
numberOfMeasurements(toolGroupId) {
|
||||
const { toolGroup, measurementRows } = Template.instance().data;
|
||||
if (toolGroup.id === 'newTargets') {
|
||||
let result = 0;
|
||||
|
||||
measurementRows.forEach(measurementRow => {
|
||||
const measurementData = measurementRow.entries[0];
|
||||
if (measurementData.isSplitLesion) return;
|
||||
result++;
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return measurementRows.length ? measurementRows.length : null;
|
||||
},
|
||||
|
||||
getMax(toolGroupId) {
|
||||
const { conformanceCriteria } = Template.instance().data;
|
||||
if (!conformanceCriteria) return;
|
||||
|
||||
if (toolGroupId === 'targets') {
|
||||
return conformanceCriteria.maxTargets.get();
|
||||
} else if (toolGroupId === 'newTargets') {
|
||||
return conformanceCriteria.maxNewTargets.get();
|
||||
}
|
||||
}
|
||||
});
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
@import "{ohif:viewerbase}/app"
|
||||
|
||||
$headerRowHeight = 63px
|
||||
|
||||
.measurementTableHeaderRow
|
||||
theme('background-color', '$uiGrayDarker')
|
||||
theme('color', '$textSecondaryColor')
|
||||
display: flex
|
||||
theme('fill', '$textSecondaryColor')
|
||||
height: $headerRowHeight
|
||||
line-height: $headerRowHeight
|
||||
margin-top: 2px
|
||||
width: 100%
|
||||
|
||||
&.inactive .add
|
||||
cursor: not-allowed
|
||||
|
||||
svg
|
||||
fill: #5A666D
|
||||
|
||||
div
|
||||
align-items: stretch
|
||||
flex: 1
|
||||
justify-content: space-around
|
||||
text-align: center
|
||||
|
||||
.add
|
||||
cursor: pointer
|
||||
max-width: 30px
|
||||
padding-left: 2px
|
||||
|
||||
svg
|
||||
fill: #C1D8E3
|
||||
height: $headerRowHeight
|
||||
max-width: 11px
|
||||
|
||||
&:hover svg
|
||||
theme('fill', '$hoverColor')
|
||||
|
||||
&:active svg
|
||||
theme('fill', '$activeColor')
|
||||
|
||||
.type
|
||||
theme('color', '$textSecondaryColor')
|
||||
font-size: 22px
|
||||
font-weight: 300
|
||||
line-height: $headerRowHeight
|
||||
padding: 0 10px 0 20px
|
||||
text-align: left
|
||||
|
||||
.numberOfMeasurements
|
||||
theme('color', '$uiSkyBlue')
|
||||
float: right
|
||||
font-weight: 300
|
||||
font-size: 40px
|
||||
max-width: 54px
|
||||
height: $headerRowHeight
|
||||
line-height: 66px
|
||||
|
||||
.max
|
||||
height: $headerRowHeight
|
||||
max-width: 64px
|
||||
text-align: right
|
||||
|
||||
.maxNumMeasurements
|
||||
theme('background-color', '$textSecondaryColor')
|
||||
border-radius: 3px
|
||||
color: black
|
||||
display: table
|
||||
font-size: 12px
|
||||
font-weight: 500
|
||||
height: 19px
|
||||
line-height: 17px
|
||||
margin-left: auto
|
||||
margin-top: 22px
|
||||
padding: 2px 6px 0
|
||||
text-transform: uppercase
|
||||
transition($sidebarTransition)
|
||||
|
||||
&.warning
|
||||
.maxNumMeasurements
|
||||
theme('background-color', '$uiYellow')
|
||||
theme('color', '$textPrimaryColor')
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
<template name="measurementTableRow">
|
||||
<div class="measurementTableRow {{#if hasWarnings}}warning{{/if}}{{#if responseStatus}}response-status{{/if}}" data-measurementid="{{_id}}">
|
||||
<div class='measurementRowSidebar'>
|
||||
<div class="measurementNumber">
|
||||
{{rowItem.measurementNumber}}
|
||||
</div>
|
||||
{{#if hasWarnings}}
|
||||
<div class="warning-icon">
|
||||
<svg>
|
||||
<use xlink:href={{absoluteUrl "packages/ohif_viewerbase/assets/icons.svg#icon-ui-warning"}}></use>
|
||||
</svg>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if rowItem.responseStatus}}
|
||||
<div class="response-status-icon">
|
||||
{{rowItem.responseStatus}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="measurementDetails">
|
||||
<div class='location'>
|
||||
{{#if rowItem.location}}
|
||||
{{getLocationLabel rowItem.location}}
|
||||
{{else}}
|
||||
(No description)
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="timepointData">
|
||||
<!--Each time point as a column-->
|
||||
{{#each timepoint in timepoints.get}}
|
||||
{{>measurementTableTimepointCell (clone this timepoint)}}
|
||||
{{else}}
|
||||
{{>measurementTableTimepointCell}}
|
||||
{{/each}}
|
||||
</div>
|
||||
<div class="rowOptions">
|
||||
<div class="rowAction js-rename pull-left m-r-2" tabindex="1">
|
||||
<svg class="edit-icon">
|
||||
<use xlink:href={{absoluteUrl "packages/ohif_viewerbase/assets/icons.svg#icon-measurements-additional"}}></use>
|
||||
</svg>
|
||||
Relabel
|
||||
</div>
|
||||
<div class="rowAction js-delete pull-left" tabindex="1">
|
||||
<svg class="close-icon">
|
||||
<use xlink:href={{absoluteUrl "packages/ohif_viewerbase/assets/icons.svg#icon-ui-close"}}></use>
|
||||
</svg>
|
||||
Delete
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import _ from 'underscore';
|
||||
import $ from 'jquery';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { cornerstone } from 'meteor/ohif:cornerstone';
|
||||
|
||||
Template.measurementTableRow.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
instance.getWarningMessages = () => {
|
||||
const measurementTypeId = instance.data.rowItem.measurementTypeId;
|
||||
const measurementNumber = instance.data.rowItem.measurementNumber;
|
||||
const groupedNonConformities = instance.data.conformanceCriteria.groupedNonConformities.get() || {};
|
||||
const nonconformitiesByMeasurementTypeId = groupedNonConformities[measurementTypeId] || {};
|
||||
const nonconformitiesByMeasurementNumbers = nonconformitiesByMeasurementTypeId.measurementNumbers || {};
|
||||
const nonconformitiesByMeasurementNumber = nonconformitiesByMeasurementNumbers[measurementNumber] || {};
|
||||
|
||||
return _.uniq(nonconformitiesByMeasurementNumber.messages || []);
|
||||
};
|
||||
});
|
||||
|
||||
Template.measurementTableRow.helpers({
|
||||
hasWarnings() {
|
||||
return !!Template.instance().getWarningMessages().length;
|
||||
}
|
||||
});
|
||||
|
||||
Template.measurementTableRow.events({
|
||||
'click .measurementRowSidebar .warning-icon'(event, instance) {
|
||||
event.stopPropagation();
|
||||
OHIF.ui.showDialog('measurementTableWarningsDialog', {
|
||||
messages: instance.getWarningMessages(),
|
||||
position: {
|
||||
x: event.clientX,
|
||||
y: event.clientY
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
'click .measurementRowSidebar'(event, instance) {
|
||||
const $row = instance.$('.measurementTableRow');
|
||||
const rowItem = instance.data.rowItem;
|
||||
const timepoints = instance.data.timepoints.get();
|
||||
|
||||
$row.closest('.measurementTableView').find('.measurementTableRow').not($row).removeClass('active');
|
||||
$row.toggleClass('active');
|
||||
|
||||
const childToolKey = $(event.target).attr('data-child');
|
||||
OHIF.measurements.jumpToRowItem(rowItem, timepoints, childToolKey);
|
||||
},
|
||||
|
||||
'click .js-rename'(event, instance) {
|
||||
const rowItem = instance.data.rowItem;
|
||||
const entry = rowItem.entries[0];
|
||||
|
||||
// Show the measure flow for targets
|
||||
OHIF.measurements.toggleLabelButton({
|
||||
measurement: entry,
|
||||
element: document.body,
|
||||
measurementApi: instance.data.measurementApi,
|
||||
position: {
|
||||
x: event.clientX,
|
||||
y: event.clientY
|
||||
},
|
||||
autoClick: true
|
||||
});
|
||||
},
|
||||
|
||||
'click .js-delete'(event, instance) {
|
||||
const dialogSettings = {
|
||||
class: 'themed',
|
||||
title: 'Delete measurements',
|
||||
message: 'Are you sure you want to delete the measurement across all timepoints?',
|
||||
position: {
|
||||
x: event.clientX,
|
||||
y: event.clientY
|
||||
}
|
||||
};
|
||||
|
||||
OHIF.ui.showDialog('dialogConfirm', dialogSettings).then(formData => {
|
||||
const measurementTypeId = instance.data.rowItem.measurementTypeId;
|
||||
const measurement = instance.data.rowItem.entries[0];
|
||||
const measurementNumber = measurement.measurementNumber;
|
||||
const { timepointApi, measurementApi } = instance.data;
|
||||
|
||||
// Remove all the measurements with the given type and number
|
||||
measurementApi.deleteMeasurements(measurementTypeId, { measurementNumber });
|
||||
|
||||
// Sync the new measurement data with cornerstone tools
|
||||
const baseline = timepointApi.baseline();
|
||||
measurementApi.sortMeasurements(baseline.timepointId);
|
||||
|
||||
// Repaint the images on all viewports without the removed measurements
|
||||
_.each($('.imageViewerViewport'), element => cornerstone.updateImage(element));
|
||||
|
||||
// Notify that viewer suffered changes
|
||||
OHIF.measurements.triggerTimepointUnsavedChanges('deleted');
|
||||
});
|
||||
}
|
||||
});
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
@import "{ohif:viewerbase}/app"
|
||||
|
||||
.measurementTableRow
|
||||
display: flex
|
||||
margin-left: -6px
|
||||
margin-top: 2px
|
||||
padding-left: 6px
|
||||
// required transformation to make inner fixed elements relative to this one
|
||||
transform(scale(1))
|
||||
width: calc(100% + 6px)
|
||||
|
||||
&.active
|
||||
|
||||
.measurementRowSidebar
|
||||
theme('color', '$activeColor')
|
||||
|
||||
.rowOptions
|
||||
height: 35px
|
||||
visibility: visible
|
||||
|
||||
&.response-status .measurementRowSidebar .response-status-icon
|
||||
theme('background-color', '$defaultColor')
|
||||
theme('color', '$uiGray')
|
||||
border-radius: 11px
|
||||
font-size: 12px
|
||||
font-weight: 700
|
||||
height: 21px
|
||||
line-height: 22px
|
||||
margin: 5px auto 0
|
||||
text-align: center
|
||||
width: 21px
|
||||
|
||||
&.warning .measurementRowSidebar
|
||||
theme('background-color', '$uiYellow')
|
||||
theme('color', '$textPrimaryColor')
|
||||
|
||||
.warning-icon, svg
|
||||
width: 22px
|
||||
height: 20px
|
||||
pointer-events: inherit
|
||||
|
||||
.warning-icon
|
||||
margin: 7px auto 0
|
||||
|
||||
svg
|
||||
theme('fill', '$textPrimaryColor')
|
||||
|
||||
.rowOptions
|
||||
theme('background-color', '$uiGrayDarker')
|
||||
height: 0
|
||||
overflow: hidden
|
||||
transition(all 0.3s ease)
|
||||
visibility: hidden
|
||||
|
||||
.rowAction
|
||||
theme('color', '$defaultColor')
|
||||
cursor: pointer
|
||||
line-height: 35px
|
||||
transition(all 0.3s ease)
|
||||
|
||||
&:hover, &:active
|
||||
theme('color', '$textPrimaryColor')
|
||||
|
||||
svg
|
||||
theme('fill', '$textPrimaryColor')
|
||||
theme('stroke', '$textPrimaryColor')
|
||||
|
||||
svg
|
||||
theme('fill', '$defaultColor')
|
||||
theme('stroke', '$defaultColor')
|
||||
transition(all 0.3s ease)
|
||||
|
||||
&.edit-icon
|
||||
width: 14px
|
||||
height: 13px
|
||||
|
||||
&.close-icon
|
||||
width: 11px
|
||||
height: 11px
|
||||
|
||||
.measurementRowSidebar
|
||||
theme('background', '$uiGray')
|
||||
theme('color', '$textSecondaryColor')
|
||||
cursor: pointer
|
||||
flex: 1
|
||||
max-width: 30px
|
||||
transition(all 0.3s ease)
|
||||
|
||||
.measurementNumber
|
||||
font-size: 14px
|
||||
font-weight: 400
|
||||
margin-right: 5px
|
||||
padding-top: 10px
|
||||
text-align: center
|
||||
|
||||
.measurementDetails
|
||||
flex: 1
|
||||
padding: 5px 2px 0 0
|
||||
|
||||
&>*
|
||||
padding-left: 14px
|
||||
|
||||
.location
|
||||
font-weight: 400
|
||||
font-size: 14px
|
||||
theme('color', '$textSecondaryColor')
|
||||
height: 30px
|
||||
line-height: 30px
|
||||
margin-left: -2px
|
||||
width: 100%
|
||||
|
||||
.timepointData
|
||||
display: flex
|
||||
min-height: 27px
|
||||
margin-top: 1px
|
||||
|
||||
div
|
||||
flex: 1
|
||||
font-size: 14px
|
||||
font-weight: 400
|
||||
justify-content: space-around
|
||||
line-height: 18px
|
||||
padding-bottom: 4px
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<template name="measurementTableTimepointCell">
|
||||
{{#if hasDataAtThisTimepoint}}
|
||||
<div class="measurementTableTimepointCell noselect {{#if isLoading}}loading{{/if}}" tabindex="1">
|
||||
<i class="fa fa-spin fa-circle-o-notch fa-fw loading-spinner"></i>
|
||||
{{{displayData}}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="measurementTableTimepointCell noselect empty">
|
||||
...
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import _ from 'underscore';
|
||||
import $ from 'jquery';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { cornerstone } from 'meteor/ohif:cornerstone';
|
||||
|
||||
Template.measurementTableTimepointCell.helpers({
|
||||
hasDataAtThisTimepoint() {
|
||||
// This simple function just checks whether or not timepoint data
|
||||
// exists for this Measurement at this Timepoint
|
||||
const instance = Template.instance();
|
||||
const { rowItem, timepointId } = instance.data;
|
||||
|
||||
if (timepointId) {
|
||||
const dataAtThisTimepoint = _.where(rowItem.entries, { timepointId });
|
||||
return dataAtThisTimepoint.length > 0;
|
||||
} else {
|
||||
return rowItem.entries.length > 0;
|
||||
}
|
||||
},
|
||||
|
||||
displayData() {
|
||||
const instance = Template.instance();
|
||||
const { rowItem, timepointId } = instance.data;
|
||||
|
||||
let data;
|
||||
if (timepointId) {
|
||||
const dataAtThisTimepoint = _.where(rowItem.entries, { timepointId });
|
||||
if (dataAtThisTimepoint.length > 1) {
|
||||
throw 'More than one measurement was found at the same timepoint with the same measurement number?';
|
||||
}
|
||||
|
||||
data = dataAtThisTimepoint[0];
|
||||
} else {
|
||||
data = rowItem.entries[0];
|
||||
}
|
||||
|
||||
const config = OHIF.measurements.MeasurementApi.getConfiguration();
|
||||
const measurementTools = config.measurementTools;
|
||||
|
||||
const toolGroup = _.findWhere(measurementTools, { id: rowItem.measurementTypeId });
|
||||
const tool = _.findWhere(toolGroup.childTools, { id: data.toolType });
|
||||
if (!tool) {
|
||||
// TODO: Figure out what is going on here?
|
||||
OHIF.log.warn('Something went wrong?');
|
||||
}
|
||||
|
||||
const { displayFunction } = tool.options.measurementTable;
|
||||
return displayFunction(data);
|
||||
},
|
||||
|
||||
isLoading() {
|
||||
const instance = Template.instance();
|
||||
const { rowItem, timepointId } = instance.data;
|
||||
const { entries } = rowItem;
|
||||
const measurementData = timepointId ? _.findWhere(entries, { timepointId }) : entries[0];
|
||||
const { studyInstanceUid } = measurementData;
|
||||
return OHIF.studies.loadingDict.get(studyInstanceUid) === 'loading';
|
||||
}
|
||||
});
|
||||
|
||||
Template.measurementTableTimepointCell.events({
|
||||
'dblclick .measurementTableTimepointCell'(event, instance) {
|
||||
const { rowItem, timepointId } = instance.data;
|
||||
if (!timepointId) return;
|
||||
|
||||
const measurementData = _.findWhere(rowItem.entries, { timepointId });
|
||||
if (!measurementData || measurementData.toolType !== 'nonTarget') return;
|
||||
|
||||
const viewportIndex = rowItem.entries.indexOf(measurementData);
|
||||
const $viewports = $('#viewer .imageViewerViewport');
|
||||
let $element = $viewports.eq(viewportIndex);
|
||||
$element = $element.length ? $element : $viewports.eq(0);
|
||||
|
||||
OHIF.ui.showDialog('dialogNonTargetMeasurement', {
|
||||
event,
|
||||
title: 'Change Lesion Location',
|
||||
element: $element[0],
|
||||
measurementData,
|
||||
edit: true
|
||||
});
|
||||
},
|
||||
|
||||
'keydown .measurementTableTimepointCell'(event, instance) {
|
||||
// Delete a lesion if Ctrl+D or DELETE is pressed while a lesion is selected
|
||||
const keys = {
|
||||
D: 68,
|
||||
DELETE: 46
|
||||
};
|
||||
const keyCode = event.which;
|
||||
|
||||
if (keyCode === keys.DELETE || keyCode === keys.BACKSPACE || (keyCode === keys.D && event.ctrlKey === true)) {
|
||||
const timepointId = instance.data.timepointId;
|
||||
|
||||
const offset = $(event.currentTarget).offset();
|
||||
const dialogSettings = {
|
||||
class: 'themed',
|
||||
title: 'Delete measurements',
|
||||
message: 'Are you sure you want to delete this measurement?',
|
||||
position: {
|
||||
x: offset.left,
|
||||
y: offset.top
|
||||
}
|
||||
};
|
||||
|
||||
OHIF.ui.showDialog('dialogConfirm', dialogSettings).then(() => {
|
||||
const measurementTypeId = instance.data.rowItem.measurementTypeId;
|
||||
const measurement = instance.data.rowItem.entries[0];
|
||||
const measurementNumber = measurement.measurementNumber;
|
||||
const { timepointApi, measurementApi } = instance.data;
|
||||
|
||||
// Remove all the measurements with the given type and number
|
||||
measurementApi.deleteMeasurements(measurementTypeId, {
|
||||
measurementNumber,
|
||||
timepointId
|
||||
});
|
||||
|
||||
// Sync the new measurement data with cornerstone tools
|
||||
const baseline = timepointApi.baseline();
|
||||
measurementApi.sortMeasurements(baseline.timepointId);
|
||||
|
||||
// Repaint the images on all viewports without the removed measurements
|
||||
_.each($('.imageViewerViewport'), element => cornerstone.updateImage(element));
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
@require '{ohif:viewerbase}/app'
|
||||
|
||||
.measurementTableTimepointCell
|
||||
theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness)
|
||||
cursor: pointer
|
||||
padding: 0 10px
|
||||
position: relative
|
||||
|
||||
.loading-spinner
|
||||
display: none
|
||||
font-size: 16px
|
||||
position: absolute
|
||||
right: 5px
|
||||
top: 3px
|
||||
|
||||
span
|
||||
display: block
|
||||
|
||||
&.loading .loading-spinner
|
||||
display: block
|
||||
|
||||
&, span
|
||||
theme('color', '$textPrimaryColor')
|
||||
|
||||
&:hover, span:hover
|
||||
theme('color', '$activeColor')
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<template name="measurementTableTimepointHeader">
|
||||
<div class="measurementTableTimepointHeader">
|
||||
<div class="timepointName">
|
||||
{{timepointName this}}
|
||||
</div>
|
||||
<div class="timepointDate">
|
||||
{{formatDA latestDate "DD-MMM-YY"}}
|
||||
</div>
|
||||
<div class="case-progress-container">
|
||||
{{>caseProgress}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
|
||||
Template.measurementTableTimepointHeader.helpers({
|
||||
timepointName(timepoint) {
|
||||
return Template.instance().data.timepointApi.name(timepoint);
|
||||
}
|
||||
});
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
@require '{ohif:viewerbase}/app'
|
||||
|
||||
.measurementTableTimepointHeader
|
||||
flex: 1
|
||||
justify-content: space-around
|
||||
padding-top: 2px
|
||||
position: relative
|
||||
|
||||
.timepointName, .timepointDate
|
||||
theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness)
|
||||
font-weight: 400
|
||||
padding-left: 12px
|
||||
text-align: left
|
||||
|
||||
.timepointName
|
||||
theme('color', '$textSecondaryColor')
|
||||
font-size: 12px
|
||||
line-height: 12px
|
||||
|
||||
.timepointDate
|
||||
theme('color', '$textPrimaryColor')
|
||||
font-size: 14px
|
||||
line-height: 20px
|
||||
padding-bottom: 6px
|
||||
|
||||
.case-progress-container
|
||||
position: absolute
|
||||
right: 4px
|
||||
top: 0
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<template name="measurementTableView">
|
||||
{{#let config=measurementConfiguration groups=measurementGroups.get}}
|
||||
{{#each measurementGroup in groups}}
|
||||
{{! #if hasMeasurements measurementGroup.toolGroup.id}}
|
||||
{{>measurementTableHeaderRow (clone this
|
||||
toolGroup=measurementGroup.toolGroup
|
||||
measurementRows=measurementGroup.measurementRows)}}
|
||||
{{! /if}}
|
||||
{{#each rowItem in measurementGroup.measurementRows}}
|
||||
{{>measurementTableRow (clone this rowItem=rowItem)}}
|
||||
{{/each}}
|
||||
{{/each}}
|
||||
|
||||
{{#each newLesionGroup in config.newLesions}}
|
||||
{{#let toolGroup=(getNewLesionsToolGroup newLesionGroup)}}
|
||||
{{#let newMeasurements=(newLesionsMeasurements toolGroup)}}
|
||||
{{#if newMeasurements.length}}
|
||||
{{#let collection=newMeasurements}}
|
||||
{{>measurementTableHeaderRow (clone this
|
||||
toolGroup=toolGroup
|
||||
measurementRows=collection)}}
|
||||
|
||||
{{#each entry in collection}}
|
||||
{{>measurementTableRow (clone this rowItem=entry)}}
|
||||
{{/each}}
|
||||
{{/let}}
|
||||
{{/if}}
|
||||
{{/let}}
|
||||
{{/let}}
|
||||
{{/each}}
|
||||
{{/let}}
|
||||
{{#unless this.isHud}}
|
||||
{{#if or (hasMeasurements 'targets') (hasMeasurements 'nonTargets')}}
|
||||
<div class="report-area">
|
||||
<div class="btn btn-sm js-pdf">Generate Report</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
</template>
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
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';
|
||||
|
||||
Template.measurementTableView.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
const { measurementApi, timepointApi } = instance.data;
|
||||
|
||||
instance.data.measurementGroups = new ReactiveVar();
|
||||
|
||||
Tracker.autorun(() => {
|
||||
measurementApi.changeObserver.depend();
|
||||
const data = OHIF.measurements.getMeasurementsGroupedByNumber(measurementApi, timepointApi);
|
||||
instance.data.measurementGroups.set(data);
|
||||
});
|
||||
});
|
||||
|
||||
Template.measurementTableView.events({
|
||||
'click .js-pdf'(event, instance) {
|
||||
const { measurementApi, timepointApi } = instance.data;
|
||||
OHIF.measurements.exportPdf(measurementApi, timepointApi);
|
||||
}
|
||||
});
|
||||
|
||||
Template.measurementTableView.helpers({
|
||||
hasMeasurements(toolGroupId) {
|
||||
const instance = Template.instance();
|
||||
const groups = instance.data.measurementGroups.get();
|
||||
|
||||
if (!groups) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const group = _.find(groups, item => item.toolGroup.id === toolGroupId);
|
||||
return group && !!group.measurementRows.length;
|
||||
},
|
||||
|
||||
getNewLesionsToolGroup(newLesionGroup) {
|
||||
const configuration = OHIF.measurements.MeasurementApi.getConfiguration();
|
||||
const toolGroup = _.findWhere(configuration.measurementTools, { id: newLesionGroup.toolGroupId });
|
||||
|
||||
return {
|
||||
id: newLesionGroup.id,
|
||||
name: newLesionGroup.name,
|
||||
childTools: toolGroup.childTools,
|
||||
measurementTypeId: toolGroup.id
|
||||
};
|
||||
},
|
||||
|
||||
newLesionsMeasurements(toolGroup) {
|
||||
const { measurementApi, timepointApi } = Template.instance().data;
|
||||
const current = timepointApi.current();
|
||||
const baseline = timepointApi.baseline();
|
||||
|
||||
if (!measurementApi || !timepointApi || !current || !baseline) return;
|
||||
|
||||
// If this is a baseline, stop here since there are no new measurements to display
|
||||
if (!current || current.timepointType === 'baseline') {
|
||||
OHIF.log.info('Skipping New Measurements section');
|
||||
return;
|
||||
}
|
||||
|
||||
// Retrieve all the data for this Measurement type (e.g. 'targets')
|
||||
// which was recorded at baseline.
|
||||
const measurementTypeId = toolGroup.measurementTypeId;
|
||||
const atBaseline = measurementApi.fetch(measurementTypeId, {
|
||||
timepointId: baseline.timepointId
|
||||
});
|
||||
|
||||
// Obtain a list of the Measurement Numbers from the
|
||||
// measurements which have baseline data
|
||||
const numbers = atBaseline.map(m => m.measurementNumber);
|
||||
|
||||
// Retrieve all the data for this Measurement type which
|
||||
// do NOT match the Measurement Numbers obtained above
|
||||
const data = measurementApi.fetch(measurementTypeId, {
|
||||
measurementNumber: { $nin: numbers }
|
||||
});
|
||||
|
||||
// Group the Measurements by Measurement Number
|
||||
const groupObject = _.groupBy(data, entry => entry.measurementNumber);
|
||||
|
||||
// Reformat the data for display in the table
|
||||
return Object.keys(groupObject).map(key => ({
|
||||
measurementTypeId: measurementTypeId,
|
||||
measurementNumber: key,
|
||||
location: OHIF.measurements.getLocation(groupObject[key]),
|
||||
responseStatus: false, // TODO: Get the latest timepoint and determine the response status
|
||||
entries: groupObject[key]
|
||||
}));
|
||||
}
|
||||
});
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
@import "{ohif:viewerbase}/app"
|
||||
|
||||
.measurementTableView
|
||||
|
||||
.report-area
|
||||
theme('background-color', '$uiGrayDarker')
|
||||
margin-top: 2px
|
||||
padding: 10px 0
|
||||
|
||||
.btn.js-pdf
|
||||
theme('background-color', '$activeColor')
|
||||
theme('border', '1px solid $uiBorderColorActive')
|
||||
color: #000
|
||||
display: table
|
||||
margin: 0 auto
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
<template name="measurementTableWarningsDialog">
|
||||
{{#dialogSimple (extend this class='themed' dialogClass='modal-sm' title='Criteria nonconformities')}}
|
||||
<ol>
|
||||
{{#each message in this.messages}}
|
||||
<li>{{message}}</li>
|
||||
{{/each}}
|
||||
</ol>
|
||||
{{/dialogSimple}}
|
||||
</template>
|
||||
Reference in new issue
Block a user