Work on refactoring measurements out of Lesion Tracker package
- Removed AssociatedStudies Collection - Measurement API is generated from configuration files - Data exchange methods are defined in configuration
This commit is contained in:
1 parent
c511edd419
commit
ab4d4c9008
537 files changed
+5122
-3545
No files matched your search
+19
@@ -0,0 +1,19 @@
|
||||
<template name="associationModal">
|
||||
<div class="modal" id="associationModal" tabindex="-1" role="dialog" aria-labelledby="associationModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="associationModalLabel">Study Association</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
{{ >studyAssociationTable }}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" id="saveAssociations">Save</button>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id='cancelAssociation'>Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
Template.associationModal.events({
|
||||
'click #saveAssociations': function(e) {
|
||||
log.info('Saving associations');
|
||||
const Timepoints = StudyList.timepointApi.timepoints;
|
||||
|
||||
// Close the modal
|
||||
const saveButton = $(e.currentTarget);
|
||||
saveButton.attr('disabled', true);
|
||||
saveButton.addClass('btn-success').removeClass('btn-primary');
|
||||
|
||||
// Find the rows of the study association table
|
||||
const tableRows = $('#studyAssociationTable table tbody tr');
|
||||
|
||||
// Create an empty object to group studies into
|
||||
var studies = {};
|
||||
|
||||
// Loop through each row to parse the data
|
||||
tableRows.each(function() {
|
||||
// Get a selector for this row
|
||||
var row = $(this);
|
||||
|
||||
// Check the includeStudy checkbox to see if we should parse this row
|
||||
var includeStudy = row.find('input.includeStudy[type="checkbox"]').eq(0).prop('checked');
|
||||
if (!includeStudy) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find the selected timepoint option for this study
|
||||
var timepointInput = row.find('input.timepointOption[type="radio"]:checked');
|
||||
|
||||
// Find the related label and trim it down to actual label (TODO: do this another way)
|
||||
var timepointType = timepointInput.val();
|
||||
|
||||
// Get the study metaData by checking the row with the template engine Blaze
|
||||
var data = Blaze.getData(this);
|
||||
|
||||
// Concatenate the study data to an array, depending on whether is was marked as baseline
|
||||
// or follow-up
|
||||
if (!studies.hasOwnProperty(timepointType)) {
|
||||
studies[timepointType] = [];
|
||||
}
|
||||
|
||||
studies[timepointType].push(data);
|
||||
});
|
||||
|
||||
Object.keys(studies).forEach(function(timepointType) {
|
||||
// Get the studies associated with this timepoint
|
||||
var relatedStudies = studies[timepointType];
|
||||
|
||||
// Create an array of all the studyInstanceUids for storage in the Timepoint
|
||||
var studyInstanceUids = relatedStudies.map(function(study) {
|
||||
return study.studyInstanceUid;
|
||||
});
|
||||
|
||||
// Create an array of all the studyDates for storage in the Timepoint
|
||||
var studyDates = relatedStudies.map(function(study) {
|
||||
return moment(study.studyDate).toDate();
|
||||
});
|
||||
|
||||
// Sort the study dates, so we can get a range for these values
|
||||
studyDates = studyDates.sort();
|
||||
|
||||
// HipaaEventType to log changes in collections
|
||||
var hipaaEventType;
|
||||
var hipaaEvent;
|
||||
|
||||
// Check if these studies are already associated with an existing Timepoint
|
||||
var existingTimepoint;
|
||||
if (timepointType === 'baseline') {
|
||||
// If we're trying to associate them to the Baseline, we don't need to
|
||||
// check if the studyInstanceUids are already associated with anything else
|
||||
existingTimepoint = Timepoints.findOne({
|
||||
patientId: relatedStudies[0].patientId,
|
||||
timepointType: 'baseline'
|
||||
});
|
||||
} else {
|
||||
// If we're trying to associate them to a Follow-up, we should check if any
|
||||
// of them are already part of a Follow-up (e.g. Follow-up 1), so that
|
||||
// the rest will also be associated with Follow-up 1.
|
||||
existingTimepoint = Timepoints.findOne({
|
||||
patientId: relatedStudies[0].patientId,
|
||||
studyInstanceUids: {
|
||||
$in: studyInstanceUids
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var timepointId;
|
||||
if (existingTimepoint) {
|
||||
// If these studies are already associated with an existing Timepoint,
|
||||
// and the desired timepoint type is the same (e.g. Follow-up), update
|
||||
// this Timepoint instead of creating a new one
|
||||
Timepoints.update(existingTimepoint._id, {
|
||||
$set: {
|
||||
studyInstanceUids: studyInstanceUids
|
||||
}
|
||||
});
|
||||
timepointId = existingTimepoint.timepointId;
|
||||
hipaaEventType = 'modify';
|
||||
} else {
|
||||
// Create a new timepoint to represent the (baseline or follow-up) studies
|
||||
let timepoint = {
|
||||
timepointType: timepointType,
|
||||
timepointId: Random.id(),
|
||||
studyInstanceUids: studyInstanceUids,
|
||||
patientId: relatedStudies[0].patientId,
|
||||
earliestDate: studyDates[0],
|
||||
latestDate: studyDates[studyDates.length - 1]
|
||||
};
|
||||
|
||||
// Insert this timepoint into the Timepoints Collection
|
||||
Timepoints.insert(timepoint);
|
||||
timepointId = timepoint.timepointId;
|
||||
hipaaEventType = 'create';
|
||||
}
|
||||
|
||||
// Log
|
||||
hipaaEvent = {
|
||||
eventType: hipaaEventType,
|
||||
userId: Meteor.userId(),
|
||||
userName: Meteor.user().profile.fullName,
|
||||
collectionName: "Timepoints",
|
||||
recordId: timepointId,
|
||||
patientId: relatedStudies[0].patientId,
|
||||
patientName: relatedStudies[0].patientName
|
||||
};
|
||||
});
|
||||
|
||||
StudyList.timepointApi.storeTimepoints();
|
||||
|
||||
// Hide the modal
|
||||
$('#associationModal').modal('hide');
|
||||
|
||||
// Reset the save button to its normal state
|
||||
saveButton.removeClass('btn-success').addClass('btn-primary');
|
||||
saveButton.attr('disabled', false);
|
||||
},
|
||||
'click #cancelAssociation': function() {
|
||||
// When the modal is closed, we should reset
|
||||
// the save button to its normal state
|
||||
var saveButton = $('#saveAssociations');
|
||||
saveButton.removeClass('btn-success').addClass('btn-primary');
|
||||
saveButton.attr('disabled', false);
|
||||
}
|
||||
});
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
#associationModal
|
||||
.modal-dialog
|
||||
width: 80%
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
<template name="studyAssociationTable">
|
||||
<div id="studyAssociationTable">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h4>Instructions</h4>
|
||||
<p>Associate the selected studies with timepoints in the clinical trial. Only 1 follow-up time point can be associated at the same time.</p>
|
||||
<p>We have automatically retrieved all studies within 14 days (<strong>{{formatDA earliestDate}}</strong> to <strong>{{formatDA latestDate}}</strong>) of your selected studies, in case you forgot to
|
||||
select a study.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-responsive">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="center">Include Study?</th>
|
||||
<th class="center">Study Date</th>
|
||||
<th class="center">Patient Name</th>
|
||||
<th class="center">Study Description</th>
|
||||
<th class="center">Timepoint Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{{ #each relevantStudies }}
|
||||
<tr>
|
||||
<td class="center">
|
||||
<input type="checkbox" class="includeStudy" {{valueIf autoselected '' 'checked'}}/>
|
||||
</td>
|
||||
<td class="center studyDataCell {{ #if autoselected }}disabled{{ /if }}">
|
||||
{{ #if autoselected}}
|
||||
<p class="studyDate autoselected"
|
||||
data-toggle="tooltip"
|
||||
title="This study was autoselected.">
|
||||
{{formatDA studyDate}}
|
||||
</p>
|
||||
{{ else }}
|
||||
<p class="studyDate">{{formatDA studyDate}}</p>
|
||||
{{ /if }}
|
||||
</td>
|
||||
<td class="center studyDataCell {{ #if autoselected }}disabled{{ /if }}">
|
||||
<p>{{formatPN patientName}}</p>
|
||||
</td>
|
||||
<td class="studyDataCell {{ #if autoselected }}disabled{{ /if }}">
|
||||
<p>{{studyDescription}}</p>
|
||||
</td>
|
||||
<td class="timepointOptions center studyDataCell noselect {{ #if autoselected }}disabled{{ /if }}">
|
||||
{{ #each timepointOptions }}
|
||||
<label class="noselect">
|
||||
<input type="radio"
|
||||
name="{{../_id}}"
|
||||
value="{{value}}"
|
||||
class="timepointOption"
|
||||
{{ valueIf checked 'checked' ''}}
|
||||
{{ valueIf autoselected 'disabled' ''}}>
|
||||
{{name}}
|
||||
</label>
|
||||
{{ /each }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ /each }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
* Finds related studies within defined time window of =/- 14 days of selected studies
|
||||
* @param selectedStudies
|
||||
* @param range Object
|
||||
*/
|
||||
function getDateRange(selectedStudies, range) {
|
||||
if (range === undefined) {
|
||||
range = {
|
||||
days: 14
|
||||
};
|
||||
}
|
||||
|
||||
if (!selectedStudies.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var earliestStudy = selectedStudies[0];
|
||||
var latestStudy = selectedStudies[selectedStudies.length - 1];
|
||||
|
||||
var earliestDate = moment(earliestStudy.studyDate, 'YYYYMMDD');
|
||||
earliestDate.subtract(range);
|
||||
|
||||
var latestDate = moment(latestStudy.studyDate, 'YYYYMMDD');
|
||||
latestDate.add(range);
|
||||
|
||||
return {
|
||||
earliestDate: earliestDate,
|
||||
latestDate: latestDate
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects all studies related to the currently input studies,
|
||||
* based on various criteria. Returns the entire array of related studies.
|
||||
*
|
||||
* (at the moment, this is only the date range +/- 14 days, with a matching patientId)
|
||||
*
|
||||
* @param selectedStudies A user-selected list of studies
|
||||
* @returns {*} The entire array of related studies
|
||||
*/
|
||||
function autoSelectStudies(selectedStudies) {
|
||||
if (!selectedStudies.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var range = getDateRange(selectedStudies);
|
||||
|
||||
// Fetch autoselected studies based on the date range
|
||||
// Note that we used MongoDB's fetch here so we have a mutable array,
|
||||
// rather than a Cursor
|
||||
var autoselected = StudyListStudies.find({
|
||||
studyDate: {
|
||||
$gte: range.earliestDate.format('YYYYMMDD'),
|
||||
$lte: range.latestDate.format('YYYYMMDD')
|
||||
}
|
||||
}, {
|
||||
sort: {
|
||||
studyDate: 1
|
||||
}
|
||||
}).fetch();
|
||||
|
||||
// Make an array of studyInstanceUids in selectedStudies
|
||||
var studyInstanceUids = selectedStudies.map(function(selectedStudy) {
|
||||
return selectedStudy.studyInstanceUid;
|
||||
});
|
||||
|
||||
autoselected.forEach(function(study) {
|
||||
var exists = studyInstanceUids.indexOf(study.studyInstanceUid);
|
||||
if (exists > -1) {
|
||||
study.autoselected = false;
|
||||
return;
|
||||
}
|
||||
|
||||
study.autoselected = true;
|
||||
});
|
||||
|
||||
return autoselected;
|
||||
}
|
||||
|
||||
Template.studyAssociationTable.helpers({
|
||||
/**
|
||||
* This helpers includes the user-selected and autoselected studies
|
||||
* to be associated.
|
||||
*
|
||||
* @returns {Array.<T>}
|
||||
*/
|
||||
relevantStudies: function() {
|
||||
var selectedStudies = StudyListSelectedStudies.find({}, {
|
||||
sort: {
|
||||
studyDate: 1
|
||||
}
|
||||
}).fetch() || [];
|
||||
|
||||
return autoSelectStudies(selectedStudies);
|
||||
},
|
||||
/**
|
||||
* This helper returns the list of Timepoint types the user can set for this study
|
||||
*
|
||||
* @returns {Array.<T>}
|
||||
*/
|
||||
timepointOptions: function() {
|
||||
return [{
|
||||
value: 'baseline',
|
||||
name: 'Baseline',
|
||||
checked: true
|
||||
}, {
|
||||
value: 'followup',
|
||||
name: 'Follow-up',
|
||||
checked: false
|
||||
}];
|
||||
},
|
||||
earliestDate: function() {
|
||||
var selectedStudies = StudyListSelectedStudies.find({}, {
|
||||
sort: {
|
||||
studyDate: 1
|
||||
}
|
||||
}).fetch();
|
||||
|
||||
var range = getDateRange(selectedStudies);
|
||||
if (range) {
|
||||
return range.earliestDate;
|
||||
}
|
||||
},
|
||||
latestDate: function() {
|
||||
var selectedStudies = StudyListSelectedStudies.find({}, {
|
||||
sort: {
|
||||
studyDate: 1
|
||||
}
|
||||
}).fetch();
|
||||
|
||||
var range = getDateRange(selectedStudies);
|
||||
if (range) {
|
||||
return range.latestDate;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Template.studyAssociationTable.events({
|
||||
'change input.includeStudy': function(e) {
|
||||
var checkbox = e.currentTarget;
|
||||
var studyDataCells = $(checkbox).parents('tr').find('td.studyDataCell');
|
||||
if (checkbox.checked === true) {
|
||||
studyDataCells.removeClass('disabled');
|
||||
studyDataCells.find('input').attr('disabled', false);
|
||||
} else {
|
||||
studyDataCells.addClass('disabled');
|
||||
studyDataCells.find('input').attr('disabled', true);
|
||||
}
|
||||
}
|
||||
});
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#studyAssociationTable
|
||||
.header
|
||||
text-align: center
|
||||
|
||||
.center
|
||||
text-align: center
|
||||
|
||||
table
|
||||
tbody
|
||||
tr
|
||||
td.timepointOptions
|
||||
input
|
||||
margin: 0 3px
|
||||
|
||||
label
|
||||
padding: 0 5px
|
||||
|
||||
td.disabled
|
||||
opacity: 0.2
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<template name="confirmRemoveTimepointAssociation">
|
||||
<div class="modal" id="confirmRemoveTimepointAssociation" tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false" aria-labelledby="removeAssociationModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="removeAssociationModalLabel">Remove Association</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
Measurements related to this Study and Timepoint will be erased. Do you really want to delete this association?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a id="removeTimepointAssociations" type="button" class="btn btn-danger" data-dismiss="modal"
|
||||
title="Remove Timepoint Association"> Remove
|
||||
</a>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id='btnRemoVeAssociationModalCancel'>Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
Template.confirmRemoveTimepointAssociation.events({
|
||||
'click #removeTimepointAssociations': function() {
|
||||
// Remove association
|
||||
StudyList.functions['removeTimepointAssociations']();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
<template name="caseProgress">
|
||||
<div class="caseProgress">
|
||||
{{#unless progressComplete}}
|
||||
{{>radialProgressBar isLocked=isLocked progressPercent=progressPercent progressText=progressText}}
|
||||
{{ /unless }}
|
||||
{{#if isLocked}}
|
||||
<div class="caseProgressStatus">
|
||||
<h5>Locked</h5>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if progressComplete}}
|
||||
<div class="caseProgressStatus">
|
||||
<button class="btn js-finish-case">Enter response</button>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,97 @@
|
||||
import { MeasurementsConfiguration } from 'meteor/ohif:measurements/both/configuration/measurements';
|
||||
|
||||
const config = MeasurementsConfiguration.getConfiguration();
|
||||
|
||||
Template.caseProgress.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
instance.progressPercent = new ReactiveVar();
|
||||
instance.progressText = new ReactiveVar();
|
||||
instance.isLocked = new ReactiveVar();
|
||||
});
|
||||
|
||||
Template.caseProgress.onRendered(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
// Stop here if we have no current timepoint ID (and therefore no defined timepointAPI)
|
||||
if (!instance.data.timepointApi) {
|
||||
instance.progressPercent.set(100);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the current timepoint
|
||||
const current = instance.data.timepointApi.current();
|
||||
if (!current) {
|
||||
instance.progressPercent.set(100);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!current.timepointId) {
|
||||
instance.progressPercent.set(100);
|
||||
return;
|
||||
}
|
||||
|
||||
instance.isLocked.set(current.isLocked);
|
||||
|
||||
// Retrieve the initial number of targets left to measure at this
|
||||
// follow-up. Note that this is done outside of the reactive function
|
||||
// below so that new lesions don't change the initial target count.
|
||||
const withPriors = true;
|
||||
const totalTargets = 10; //instance.data.measurementApi.targets(withPriors).length;
|
||||
|
||||
// If we're currently reviewing a Baseline timepoint, don't do any
|
||||
// progress measurement.
|
||||
if (current.timepointType === 'baseline') {
|
||||
instance.progressPercent.set(100);
|
||||
} else {
|
||||
// Setup a reactive function to update the progress whenever
|
||||
// a measurement is made
|
||||
instance.autorun(() => {
|
||||
// Obtain the number of Measurements for which the current Timepoint has
|
||||
// no Measurement data
|
||||
const numRemainingMeasurements = 5; //instance.data.measurementApi.unmarked().length;
|
||||
|
||||
// Update the Case Progress text with the remaining measurement count
|
||||
instance.progressText.set(numRemainingMeasurements);
|
||||
|
||||
// Calculate the Case Progress as a percentage in order to update the
|
||||
// radial progress bar
|
||||
const numMeasurementsMade = Math.max(totalTargets - numRemainingMeasurements, 0);
|
||||
const progressPercent = Math.round(100 * numMeasurementsMade / totalTargets);
|
||||
instance.progressPercent.set(progressPercent);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Template.caseProgress.helpers({
|
||||
progressPercent() {
|
||||
return Template.instance().progressPercent.get();
|
||||
},
|
||||
|
||||
progressText() {
|
||||
return Template.instance().progressText.get();
|
||||
},
|
||||
|
||||
isLocked() {
|
||||
return Template.instance().isLocked.get();
|
||||
},
|
||||
|
||||
progressComplete() {
|
||||
const instance = Template.instance();
|
||||
if (!instance.data.timepointApi) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const progressPercent = instance.progressPercent.get();
|
||||
return progressPercent === 100;
|
||||
}
|
||||
});
|
||||
|
||||
Template.caseProgress.events({
|
||||
'click .js-finish-case'() {
|
||||
const instance = Template.instance();
|
||||
console.log('Case Finished!');
|
||||
switchToTab('studylistTab');
|
||||
instance.data.measurementApi.storeMeasurements();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,32 @@
|
||||
@import "{design}/app"
|
||||
|
||||
.caseProgress
|
||||
transition(all 0.3 ease)
|
||||
|
||||
.radialProgress
|
||||
display: inline-block
|
||||
float:left
|
||||
|
||||
.caseProgressStatus
|
||||
display: inline-block
|
||||
float: left
|
||||
margin-left: 22px
|
||||
|
||||
h5
|
||||
theme('color', '$textPrimaryColor')
|
||||
line-height: 46px
|
||||
margin: 0
|
||||
font-size: 15px
|
||||
font-weight: bold
|
||||
|
||||
button.btn
|
||||
theme('background-color', '$activeColor')
|
||||
theme('border', '1px solid $uiBorderColorActive')
|
||||
color: #000
|
||||
cursor: pointer
|
||||
font-size: 15px
|
||||
font-weight: bold
|
||||
height: 37px
|
||||
margin-top: 6px
|
||||
text-align: center
|
||||
width: 126px
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
<template name="radialProgressBar">
|
||||
<div class="radialProgress">
|
||||
<svg id="svg"
|
||||
width="46"
|
||||
height="46"
|
||||
viewPort="0 0 50 50"
|
||||
version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
<!-- stroke-dasharray is 2 * PI * radius !-->
|
||||
<circle r="21"
|
||||
cx="23"
|
||||
cy="23"
|
||||
fill="transparent"
|
||||
stroke-dasharray="131.9469"
|
||||
stroke-dashoffset="0">
|
||||
</circle>
|
||||
{{#unless isLocked}}
|
||||
<circle id="bar"
|
||||
r="21"
|
||||
cx="23"
|
||||
cy="23"
|
||||
fill="transparent"
|
||||
stroke-dasharray="131.9469"
|
||||
style="stroke-dashoffset: {{progressRadius}}px;">
|
||||
</circle>
|
||||
{{/unless}}
|
||||
</svg>
|
||||
<div class="progressText">
|
||||
{{#if isLocked}}
|
||||
<svg class="locked">
|
||||
<use xlink:href=/packages/ohif_viewerbase/assets/icons.svg#icon-status-lock></use>
|
||||
</svg>
|
||||
{{else}}
|
||||
{{#if progressComplete}}
|
||||
<svg class="complete">
|
||||
<use xlink:href=/packages/ohif_viewerbase/assets/icons.svg#icon-status-complete></use>
|
||||
</svg>
|
||||
{{else}}
|
||||
{{progressText}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
Template.radialProgressBar.helpers({
|
||||
progressComplete() {
|
||||
const instance = Template.instance();
|
||||
return instance.data.progressPercent === 100;
|
||||
},
|
||||
|
||||
progressRadius() {
|
||||
var radius = 21 * 2 * Math.PI;
|
||||
const instance = Template.instance();
|
||||
var percentLeft = (100 - instance.data.progressPercent) / 100;
|
||||
return percentLeft * radius;
|
||||
}
|
||||
});
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
@import "{design}/app"
|
||||
|
||||
$circleSize = 46px
|
||||
|
||||
.radialProgress
|
||||
position: relative
|
||||
height: $circleSize
|
||||
width: $circleSize
|
||||
vendorize(box-shadow, 0 0 1em black)
|
||||
border-radius: 100%
|
||||
|
||||
#svg circle
|
||||
stroke-dashoffset: 0
|
||||
theme('stroke', '$uiBorderColorDark')
|
||||
stroke-width: 3px
|
||||
vendorize(transition, stroke-dashoffset 1s linear)
|
||||
|
||||
#svg #bar
|
||||
theme('stroke', '$activeColor')
|
||||
vendorize(transform, rotate(270deg))
|
||||
vendorize(transform-origin, center center)
|
||||
|
||||
.progressText
|
||||
position: absolute
|
||||
width: $circleSize
|
||||
height: $circleSize
|
||||
line-height: $circleSize
|
||||
font-weight: 700
|
||||
font-size: 17px
|
||||
text-align: center
|
||||
theme('color', '$activeColor')
|
||||
top: 0
|
||||
|
||||
svg
|
||||
theme('fill', '$activeColor')
|
||||
left: 50%
|
||||
position: absolute
|
||||
theme('stroke', '$activeColor')
|
||||
top: 50%
|
||||
transform(translateX(-50%) translateY(-50%))
|
||||
|
||||
&.locked
|
||||
width: 16px
|
||||
height: 21px
|
||||
|
||||
&.complete
|
||||
width: 27px
|
||||
height: 27px
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<template name="longitudinalStudyListContextMenu">
|
||||
{{#if uiSettings.studyListFunctionsEnabled}}
|
||||
<div id="studyContextMenu" class="studyContextMenu noselect"
|
||||
oncontextmenu='return false;'
|
||||
unselectable='on'
|
||||
onselectstart='return false;'>
|
||||
<ul>
|
||||
<li>
|
||||
<a id="viewStudies" type="button"
|
||||
title="View Studies">
|
||||
View
|
||||
</a>
|
||||
<hr/>
|
||||
<a id="launchStudyAssociation" type="button"
|
||||
data-toggle="modal"
|
||||
data-target="#associationModal"
|
||||
title="Launch Study Association">
|
||||
Associate
|
||||
</a>
|
||||
<a id="launchRemoveAssociation" type="button"
|
||||
data-toggle="modal"
|
||||
data-target="#confirmRemoveTimepointAssociation"
|
||||
title="Remove Timepoint Association">
|
||||
Remove Association
|
||||
</a>
|
||||
<hr/>
|
||||
<a id="viewSeriesDetails" type="button"
|
||||
title="View Series Details">
|
||||
View Series Details
|
||||
</a>
|
||||
<a class="disabled">Anonymize</a>
|
||||
<a class="disabled">Send</a>
|
||||
<hr/>
|
||||
<a id="exportSelectedStudies"
|
||||
title="Export Selected Studies">
|
||||
Export
|
||||
</a>
|
||||
<a class="disabled">Delete</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
// Use Aldeed's meteor-template-extension package to replace the
|
||||
// default StudyListStudy template.
|
||||
// See https://github.com/aldeed/meteor-template-extension
|
||||
const defaultTemplate = 'studyContextMenu';
|
||||
Template.longitudinalStudyListContextMenu.replaces(defaultTemplate);
|
||||
|
||||
StudyList.functions['removeTimepointAssociations'] = removeTimepointAssociations;
|
||||
StudyList.functions['exportSelectedStudies'] = exportSelectedStudies;
|
||||
StudyList.functions['viewStudies'] = viewStudies;
|
||||
|
||||
/**
|
||||
* Removes all present study / timepoint associations from the Clinical Trial
|
||||
*/
|
||||
function removeTimepointAssociations() {
|
||||
// Get a Cursor pointing to the selected Studies from the StudyList
|
||||
const selectedStudies = StudyListSelectedStudies.find({}, {
|
||||
sort: {
|
||||
studyDate: 1
|
||||
}
|
||||
});
|
||||
|
||||
// Loop through the Cursor of Selected Studies
|
||||
selectedStudies.forEach(function(selectedStudy) {
|
||||
// Find the Timepoint that was previously referenced
|
||||
const timepointApi = Template.instance().timepointApi;
|
||||
if (!timepointApi) {
|
||||
return;
|
||||
}
|
||||
|
||||
let timepoint = timepointApi.study(data.study.studyInstanceUid)[0];
|
||||
if (!timepoint) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find the index of the current studyInstanceUid in the array
|
||||
// of reference studyInstanceUids
|
||||
var index = timepoint.studyInstanceUids.indexOf(study.studyInstanceUid);
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the specified studyInstanceUid from the array of associated studyInstanceUids
|
||||
timepoint.studyInstanceUids.splice(index, 1);
|
||||
|
||||
// Check if there are still one or more Studies associated with this Timepoint
|
||||
if (timepoint.studyInstanceUids.length) {
|
||||
// Update the Timepoints Collection with this modified array for the
|
||||
// studyInstanceUids attribute
|
||||
Timepoints.update(timepoint._id, {
|
||||
$set: {
|
||||
studyInstanceUids: timepoint.studyInstanceUids
|
||||
}
|
||||
});
|
||||
|
||||
// Log
|
||||
var hipaaEvent = {
|
||||
eventType: 'modify',
|
||||
userId: Meteor.userId(),
|
||||
userName: Meteor.user().profile.fullName,
|
||||
collectionName: "Timepoints",
|
||||
recordId: study.timepointId,
|
||||
patientId: study.patientId,
|
||||
patientName: study.patientName
|
||||
};
|
||||
HipaaLogger.logEvent(hipaaEvent);
|
||||
} else {
|
||||
// If no more Studies are associated with this Timepoint, we should remove it
|
||||
// from the Timepoints Collection via a server call
|
||||
Meteor.call('removeTimepoint', timepoint._id, function(error) {
|
||||
if (error) {
|
||||
log.warn(error);
|
||||
return;
|
||||
}
|
||||
|
||||
// Log
|
||||
var hipaaEvent = {
|
||||
eventType: 'delete',
|
||||
userId: Meteor.userId(),
|
||||
userName: Meteor.user().profile.fullName,
|
||||
collectionName: "Timepoints",
|
||||
recordId: study.timepointId,
|
||||
patientId: study.patientId,
|
||||
patientName: study.patientName
|
||||
};
|
||||
HipaaLogger.logEvent(hipaaEvent);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ---------- TODO: Remove these duplicated functions below -------------
|
||||
|
||||
|
||||
/**
|
||||
* Exports all selected studies on the studylist
|
||||
*/
|
||||
function exportSelectedStudies() {
|
||||
const selectedStudies = StudyListSelectedStudies.find({}, {
|
||||
sort: {
|
||||
studyDate: 1
|
||||
}
|
||||
}).fetch();
|
||||
|
||||
if (!selectedStudies || !selectedStudies.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
exportStudies(selectedStudies);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads multiple unassociated studies in the Viewer
|
||||
*/
|
||||
function viewStudies() {
|
||||
console.log('viewStudies');
|
||||
const selectedStudies = StudyListSelectedStudies.find({}, {
|
||||
sort: {
|
||||
studyDate: 1
|
||||
}
|
||||
}).fetch();
|
||||
|
||||
if (!selectedStudies || !selectedStudies.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var title = selectedStudies[0].patientName;
|
||||
var studyInstanceUids = selectedStudies.map(function(study) {
|
||||
return study.studyInstanceUid;
|
||||
});
|
||||
|
||||
// Generate a unique ID to represent this tab
|
||||
// We can't just use the Mongo entry ID because
|
||||
// then it will change after hot-reloading.
|
||||
const contentid = Random.id();
|
||||
|
||||
// Update the ViewerData global object
|
||||
ViewerData[contentid] = {
|
||||
title: title,
|
||||
contentid: contentid,
|
||||
studyInstanceUids: studyInstanceUids
|
||||
};
|
||||
|
||||
// Switch to the new tab
|
||||
switchToTab(contentid);
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<template name="longitudinalStudyListStudy">
|
||||
<tr class="studylistStudy noselect">
|
||||
<td>
|
||||
{{#if reviewerTip}}
|
||||
<i class="fa fa-exclamation-circle reviewerTip" data-toggle="tooltip" data-placement="bottom" title="{{reviewerTip}}"></i>
|
||||
{{/if}}
|
||||
{{formatPN patientName}}
|
||||
</td>
|
||||
<td>
|
||||
{{patientId}}
|
||||
</td>
|
||||
{{#unless isTouchDevice}}
|
||||
<td>
|
||||
{{accessionNumber}}
|
||||
</td>
|
||||
{{/unless}}
|
||||
<td>
|
||||
{{formatDA studyDate}} {{ #if timepointName }}({{timepointName}}){{ /if }}
|
||||
</td>
|
||||
{{#unless isTouchDevice}}
|
||||
<td>
|
||||
{{modalities}}
|
||||
</td>
|
||||
{{/unless}}
|
||||
<td>
|
||||
{{studyDescription}}
|
||||
</td>
|
||||
{{#unless isTouchDevice}}
|
||||
<td>
|
||||
{{numberOfStudyRelatedInstances}}
|
||||
</td>
|
||||
{{/unless}}
|
||||
|
||||
</tr>
|
||||
</template>
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
// Use Aldeed's meteor-template-extension package to replace the
|
||||
// default StudyListStudy template.
|
||||
// See https://github.com/aldeed/meteor-template-extension
|
||||
const defaultTemplate = 'studylistStudy';
|
||||
Template.longitudinalStudyListStudy.replaces(defaultTemplate);
|
||||
|
||||
// Add the TimepointName helper to the default template. The
|
||||
// HTML of this template is replaced with that of longitudinalStudyListStudy
|
||||
Template[defaultTemplate].helpers({
|
||||
timepointName: function() {
|
||||
const instance = Template.instance();
|
||||
const timepointApi = StudyList.timepointApi;
|
||||
if (!timepointApi) {
|
||||
return;
|
||||
}
|
||||
|
||||
const timepoint = timepointApi.study(instance.data.studyInstanceUid)[0];
|
||||
if (!timepoint) {
|
||||
return;
|
||||
}
|
||||
|
||||
return timepointApi.name(timepoint);
|
||||
},
|
||||
reviewerTip: function() {
|
||||
const instance = Template.instance();
|
||||
const timepointApi = StudyList.timepointApi;
|
||||
if (!timepointApi) {
|
||||
return;
|
||||
}
|
||||
|
||||
const timepoint = timepointApi.study(instance.data.studyInstanceUid);
|
||||
if (!timepoint) {
|
||||
return;
|
||||
}
|
||||
|
||||
var timepointReviewers = Reviewers.findOne({
|
||||
timepointId: timepoint.timepointId
|
||||
});
|
||||
|
||||
if (!timepointReviewers) {
|
||||
return;
|
||||
}
|
||||
|
||||
return getReviewerTipText(timepointReviewers.reviewers);
|
||||
}
|
||||
});
|
||||
|
||||
function getReviewerTipText(reviewers) {
|
||||
if (!reviewers || !reviewers.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var newReviewers = reviewers.filter(function(reviewer) {
|
||||
return reviewer.userId !== Meteor.userId();
|
||||
});
|
||||
|
||||
if (!newReviewers.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tipText = 'The study is being reviewed by ';
|
||||
newReviewers.forEach(function(reviewer, index) {
|
||||
if (reviewer.userId === Meteor.userId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (index > 0) {
|
||||
tipText += ',';
|
||||
}
|
||||
|
||||
tipText += reviewer.userName;
|
||||
});
|
||||
|
||||
return tipText;
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
.studylistStudy
|
||||
cursor: pointer
|
||||
|
||||
.reviewerTip
|
||||
color: darkred
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<template name="longitudinalViewportOverlay">
|
||||
<div class="imageViewerViewportOverlay noselect {{#if gt numImages 1}}controlsVisible{{/if}}">
|
||||
<div class="topleft dicomTag">
|
||||
<div>{{formatPN patientName}}</div>
|
||||
<div>{{patientId}}</div>
|
||||
<div class='timepointName'>{{timepointName}}</div>
|
||||
</div>
|
||||
<div class="topright dicomTag">
|
||||
<div>{{studyDescription}}</div>
|
||||
<div>{{formatDA studyDate}} {{formatTM studyTime}}</div>
|
||||
</div>
|
||||
<div class="bottomright dicomTag">
|
||||
<div>Zoom: {{formatNumberPrecision zoom 2}}%</div>
|
||||
<div>{{compression}}</div>
|
||||
<div>{{wwwc}}</div>
|
||||
</div>
|
||||
<div class="bottomleft dicomTag">
|
||||
<div>Ser: {{seriesNumber}}</div>
|
||||
<div>{{#if gt numImages 1}}Img: {{instanceNumber}} ({{imageIndex}}/{{numImages}}){{/if}}</div>
|
||||
<div>{{frameRate}}</div>
|
||||
<div>{{imageDimensions}}</div>
|
||||
<div>{{seriesDescription}}</div>
|
||||
</div>
|
||||
{{#if gt numImages 1}}
|
||||
{{>imageControls imageIndex=imageIndex numImages=numImages}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</template>
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// Use Aldeed's meteor-template-extension package to replace the
|
||||
// default viewportOverlay template.
|
||||
// See https://github.com/aldeed/meteor-template-extension
|
||||
var defaultTemplate = 'viewportOverlay';
|
||||
Template.longitudinalViewportOverlay.replaces(defaultTemplate);
|
||||
|
||||
// Add the TimepointName helper to the default template. The
|
||||
// HTML of this template is replaced with that of longitudinalViewportOverlay
|
||||
Template[defaultTemplate].helpers({
|
||||
timepointName: function() {
|
||||
var data = this;
|
||||
const timepointApi = Template.instance().timepointApi;
|
||||
if (!timepointApi) {
|
||||
return;
|
||||
}
|
||||
|
||||
const timepoint = timepointApi.study(data.studyInstanceUid);
|
||||
if (!timepoint) {
|
||||
return;
|
||||
}
|
||||
|
||||
return timepointApi.name(timepoint);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
<template name="measurementTable">
|
||||
<div id="measurementTableContainer">
|
||||
{{#if this.timepoints.get.length}}
|
||||
<div class="measurementTableLayoutChanger viewerRoundedButtonGroup">
|
||||
{{>roundedButtonGroup buttonGroupData}}
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="measurementTableTimepointHeaderRow">
|
||||
{{#each timepoint in this.timepoints.get}}
|
||||
{{>measurementTableTimepointHeader (clone this timepoint)}}
|
||||
{{/each}}
|
||||
<!-- TODO: Add header for cross-sectional / non-longitudinal data -->
|
||||
</div>
|
||||
{{>measurementTableView (clone this)}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,88 @@
|
||||
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();
|
||||
|
||||
let timepoints;
|
||||
if (!instance.data.timepointApi) {
|
||||
timepoints = [];
|
||||
} else if (tableLayout === 'key') {
|
||||
timepoints = instance.data.timepointApi.key();
|
||||
} else {
|
||||
timepoints = instance.data.timepointApi.currentAndPrior();
|
||||
}
|
||||
|
||||
// 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.onRendered(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
// Find the first measurement by Lesion Number
|
||||
let firstLesion = undefined; // = instance.data.measurementApi.firstLesion();
|
||||
|
||||
// Create an object to store the ContentId inside
|
||||
const templateData = {
|
||||
contentId: Session.get('activeContentId')
|
||||
};
|
||||
|
||||
// Activate the first lesion
|
||||
if (firstLesion) {
|
||||
activateLesion(firstLesion._id, templateData);
|
||||
}
|
||||
});
|
||||
|
||||
Template.measurementTable.events({
|
||||
/**
|
||||
* Retrieve the lesion id from the DOM data for this row
|
||||
*/
|
||||
/*'click table#tblLesion tbody tr': function(e, template) {
|
||||
var measurementId = $(e.currentTarget).data('measurementid');
|
||||
activateLesion(measurementId, template.data);
|
||||
},*/
|
||||
});
|
||||
|
||||
Template.measurementTable.helpers({
|
||||
buttonGroupData() {
|
||||
const instance = Template.instance();
|
||||
return {
|
||||
value: instance.data.measurementTableLayout,
|
||||
options: [{
|
||||
value: 'comparison',
|
||||
text: 'Comparison'
|
||||
}, {
|
||||
value: 'key',
|
||||
text: 'Key Timepoints'
|
||||
}]
|
||||
};
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
@import "{design}/app"
|
||||
|
||||
#measurementTableContainer
|
||||
theme('background-color', '$primaryBackgroundColor')
|
||||
height: 100%
|
||||
width: 100%
|
||||
|
||||
.measurementTableTimepointHeaderRow
|
||||
display: flex
|
||||
padding: 2px 2px 0 44px
|
||||
|
||||
.measurementTableLayoutChanger
|
||||
margin: 0 auto
|
||||
padding: 20px
|
||||
text-align: center
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<template name="measurementTableHUD">
|
||||
<div id="measurementTableHUD" class="dialog-animated {{hudHidden}}">
|
||||
<div class="header">
|
||||
<span>Measurements</span>
|
||||
<svg class="buttonClose">
|
||||
<use xlink:href="/packages/ohif_viewerbase/assets/icons.svg#icon-ui-close"></use>
|
||||
</svg>
|
||||
</div>
|
||||
{{>measurementTableView (clone this)}}
|
||||
<div class="footer">
|
||||
{{#each toolbarButton in toolbarButtons}}
|
||||
{{>toolbarSectionButton toolbarButton}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
Template.measurementTableHUD.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
if (instance.data.timepointApi) {
|
||||
instance.data.timepoints = new ReactiveVar(instance.data.timepointApi.currentAndPrior());
|
||||
}
|
||||
});
|
||||
|
||||
Template.measurementTableHUD.onRendered(() => {
|
||||
const instance = Template.instance();
|
||||
instance.$('#measurementTableHUD').resizable().draggable();
|
||||
});
|
||||
|
||||
Template.measurementTableHUD.events({
|
||||
'click .buttonClose'(event, instance) {
|
||||
Session.set('measurementTableHudOpen', false);
|
||||
}
|
||||
});
|
||||
|
||||
Template.measurementTableHUD.helpers({
|
||||
hudHidden() {
|
||||
return Session.get('measurementTableHudOpen') ? 'dialog-open' : 'dialog-closed';
|
||||
},
|
||||
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;
|
||||
}
|
||||
});
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
@import "{design}/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: 10000
|
||||
|
||||
.measurementTableView.scrollArea
|
||||
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.scrollArea
|
||||
height: calc(100% - 55px - 70px)
|
||||
padding-bottom: 20px
|
||||
|
||||
.footer
|
||||
theme('background', '$uiGrayDarkest')
|
||||
border-top: $uiBorderThickness solid $borderColor
|
||||
width: 100%
|
||||
height: 70px
|
||||
position: absolute
|
||||
bottom: 0
|
||||
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')
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<template name="measurementTableHeaderRow">
|
||||
<div class="measurementTableHeaderRow">
|
||||
{{ #if anyUnmarkedLesionsLeft}}
|
||||
<div class="add js-setTool">
|
||||
<svg>
|
||||
<use xlink:href=/packages/ohif_viewerbase/assets/icons.svg#icon-ui-add></use>
|
||||
</svg>
|
||||
</div>
|
||||
{{ /if }}
|
||||
<div class="type">
|
||||
{{measurementType.name}}
|
||||
</div>
|
||||
<div class="max {{ # if gt numberOfMeasurements maxNumMeasurements }}warning{{/if}}">
|
||||
{{ #if maxNumMeasurements }}
|
||||
<p class="maxNumMeasurements">
|
||||
Max {{maxNumMeasurements}}
|
||||
</p>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="numberOfMeasurements">
|
||||
{{numberOfMeasurements}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
Template.measurementTableHeaderRow.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
instance.maxNumMeasurements = new ReactiveVar();
|
||||
|
||||
if (!instance.data.timepointApi) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the current timepoint
|
||||
const current = instance.data.timepointApi.current();
|
||||
|
||||
// Stop here if no timepoint was found
|
||||
if (!current) {
|
||||
console.warn('No current timepoint found?');
|
||||
return;
|
||||
}
|
||||
|
||||
const timepointType = current.timepointType;
|
||||
|
||||
// TODO: Check if we have criteria where maximum limits are applied to
|
||||
// Non-Targets and/or New Lesions
|
||||
if (timepointType === 'baseline' && instance.data.id === 'target') {
|
||||
instance.autorun(() => {
|
||||
// Identify which Trial Conformance Criteria are currently being used
|
||||
// Note that there may be more than one.
|
||||
const criteriaTypes = TrialCriteriaTypes.find({
|
||||
selected: true
|
||||
}).map(function(criteria) {
|
||||
return criteria.id;
|
||||
});
|
||||
|
||||
const currentConstraints = getTrialCriteriaConstraints(criteriaTypes);
|
||||
if (!currentConstraints) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Fix Trial Conformance Criteria, it appears that totalNumberOfLesions
|
||||
// is applied to both Targets and Non-Targets, when it should typically only be
|
||||
// for Targets
|
||||
const criteria = currentConstraints[timepointType];
|
||||
const maxNumMeasurements = criteria.group.totalNumberOfLesions.numericality.lessThanOrEqualTo;
|
||||
instance.maxNumMeasurements.set(maxNumMeasurements);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Template.measurementTableHeaderRow.helpers({
|
||||
numberOfMeasurements() {
|
||||
return Template.instance().data.measurements.length;
|
||||
},
|
||||
|
||||
maxNumMeasurements() {
|
||||
return Template.instance().maxNumMeasurements.get();
|
||||
},
|
||||
|
||||
anyUnmarkedLesionsLeft() {
|
||||
const instance = Template.instance();
|
||||
const measurementType = instance.data.measurementType;
|
||||
const measurementApi = instance.data.measurementApi;
|
||||
|
||||
// TODO: Add selector to check if there are unmarked lesions
|
||||
//return measurementApi.fetch(measurementType.id).length;
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
Template.measurementTableHeaderRow.events({
|
||||
'click .js-setTool'(event, instance) {
|
||||
const measurementType = instance.data.measurementType;
|
||||
toolManager.setActiveTool(measurementType.cornerstoneToolType);
|
||||
}
|
||||
});
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
@import "{design}/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
|
||||
theme('fill', '$hoverColor')
|
||||
|
||||
&:active
|
||||
theme('fill', '$activeColor')
|
||||
|
||||
.type
|
||||
theme('color', '$textSecondaryColor')
|
||||
font-size: 22px
|
||||
font-weight: 300
|
||||
line-height: $headerRowHeight
|
||||
padding: 0 10px
|
||||
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 {{#unless rowItem.location}}warning{{/unless}}{{#if responseStatus}}response-status{{/if}}" data-measurementid="{{_id}}">
|
||||
<div class='lesionRowSidebar'>
|
||||
<div class="lesionNumber">
|
||||
{{rowItem.measurementNumber}}
|
||||
</div>
|
||||
{{#unless rowItem.location}}
|
||||
<div class="warning-icon">
|
||||
<svg>
|
||||
<use xlink:href=/packages/ohif_viewerbase/assets/icons.svg#icon-ui-warning></use>
|
||||
</svg>
|
||||
</div>
|
||||
{{/unless}}
|
||||
{{#if rowItem.responseStatus}}
|
||||
<div class="response-status-icon">
|
||||
{{ rowItem.responseStatus }}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="lesionDetails">
|
||||
<div class='location'>
|
||||
{{#if rowItem.location}}
|
||||
{{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="/packages/ohif_viewerbase/assets/icons.svg#icon-measurements-additional"></use>
|
||||
</svg>
|
||||
Rename
|
||||
</div>
|
||||
<div class="rowAction js-delete pull-left" tabindex="1">
|
||||
<svg class="close-icon">
|
||||
<use xlink:href=/packages/ohif_viewerbase/assets/icons.svg#icon-ui-close></use>
|
||||
</svg>
|
||||
Delete
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
function doneCallback(measurementData, deleteTool) {
|
||||
// If a Lesion or Non-Target is removed via a dialog
|
||||
// opened by the Lesion Table, we should clear the data for
|
||||
// the specified Timepoint Cell
|
||||
if (deleteTool === true) {
|
||||
Meteor.call('removeMeasurement', measurementData.id, function(error, response) {
|
||||
if (error) {
|
||||
log.warn(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Delete a lesion if Ctrl+D or DELETE is pressed while a lesion is selected
|
||||
var keys = {
|
||||
D: 68,
|
||||
DELETE: 46
|
||||
};
|
||||
|
||||
Template.measurementTableRow.events({
|
||||
'click .lesionRowSidebar'(event, instance) {
|
||||
const $row = instance.$('.measurementTableRow');
|
||||
$row.closest('.measurementTableView').find('.measurementTableRow').not($row).removeClass('active');
|
||||
$row.toggleClass('active');
|
||||
},
|
||||
|
||||
'dblclick .location': function() {
|
||||
log.info('Double clicked on Lesion Location cell');
|
||||
|
||||
var measurementData = this;
|
||||
|
||||
// TODO = Fix this weird issue? Need to set toolData's ID properly..
|
||||
measurementData.id = this._id;
|
||||
|
||||
changeLesionLocationCallback(measurementData, null, doneCallback);
|
||||
},
|
||||
|
||||
'keydown .location': function(e) {
|
||||
var keyCode = e.which;
|
||||
|
||||
if (keyCode === keys.DELETE ||
|
||||
(keyCode === keys.D && e.ctrlKey === true)) {
|
||||
var currentMeasurement = this;
|
||||
var options = {
|
||||
keyPressAllowed: false,
|
||||
title: 'Remove measurement?',
|
||||
text: 'Are you sure you would like to remove the entire measurement?'
|
||||
};
|
||||
|
||||
showConfirmDialog(() => {
|
||||
Meteor.call('removeMeasurement', currentMeasurement._id, (error, response) => {
|
||||
if (error) {
|
||||
log.warn(error);
|
||||
}
|
||||
});
|
||||
}, options);
|
||||
}
|
||||
}
|
||||
});
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
@import "{design}/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)
|
||||
|
||||
&:before
|
||||
theme('background-color', '$activeColor')
|
||||
border-top-left-radius: 7px
|
||||
border-bottom-left-radius: 7px
|
||||
content: ''
|
||||
display: block
|
||||
height: 100%
|
||||
left: 0
|
||||
opacity: 0
|
||||
pointer-events: none
|
||||
position: fixed
|
||||
top: 0
|
||||
transition(all 0.3s ease)
|
||||
width: 5px
|
||||
|
||||
&.active
|
||||
|
||||
&:before
|
||||
opacity: 1
|
||||
|
||||
.lesionRowSidebar
|
||||
theme('color', '$activeColor')
|
||||
|
||||
.rowOptions
|
||||
height: 35px
|
||||
visibility: visible
|
||||
|
||||
&.response-status .lesionRowSidebar .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 .lesionRowSidebar
|
||||
theme('background-color', '$uiYellow')
|
||||
theme('color', '$textPrimaryColor')
|
||||
|
||||
.warning-icon, svg
|
||||
width: 22px
|
||||
height: 20px
|
||||
|
||||
.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
|
||||
|
||||
.lesionRowSidebar
|
||||
theme('background', '$uiGray')
|
||||
theme('color', '$textSecondaryColor')
|
||||
cursor: pointer
|
||||
flex: 1
|
||||
max-width: 30px
|
||||
transition(all 0.3s ease)
|
||||
|
||||
.lesionNumber
|
||||
font-size: 14px
|
||||
font-weight: 400
|
||||
margin-right: 5px
|
||||
padding-top: 10px
|
||||
text-align: center
|
||||
|
||||
.lesionDetails
|
||||
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
|
||||
height: 27px
|
||||
margin-top: 1px
|
||||
|
||||
div
|
||||
flex: 1
|
||||
font-size: 14px
|
||||
font-weight: 400
|
||||
justify-content: space-around
|
||||
line-height: 18px
|
||||
padding-bottom: 10px
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<template name="measurementTableTimepointCell">
|
||||
{{#if hasDataAtThisTimepoint}}
|
||||
<div class="measurementTableTimepointCell" tabindex="1">
|
||||
{{displayData}}
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="measurementTableTimepointCell empty">
|
||||
...
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
import { MeasurementsConfiguration } from 'meteor/ohif:measurements/both/configuration/measurements';
|
||||
|
||||
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 = instance.data.rowItem;
|
||||
|
||||
if (this.timepointId) {
|
||||
const dataAtThisTimepoint = _.where(rowItem.entries, {timepointId: this.timepointId});
|
||||
return dataAtThisTimepoint.length > 0;
|
||||
} else {
|
||||
return rowItem.entries.length > 0;
|
||||
}
|
||||
},
|
||||
displayData() {
|
||||
const instance = Template.instance();
|
||||
|
||||
const rowItem = instance.data.rowItem;
|
||||
let data;
|
||||
if (this.timepointId) {
|
||||
const dataAtThisTimepoint = _.where(rowItem.entries, {timepointId: this.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 = MeasurementsConfiguration.getConfiguration();
|
||||
const measurementTools = config.measurementTools;
|
||||
|
||||
const tool = _.where(measurementTools, {id: rowItem.measurementTypeId})[0];
|
||||
const displayFunction = tool.options.measurementTableOptions.displayFunction;
|
||||
return displayFunction(data);
|
||||
}
|
||||
});
|
||||
|
||||
function doneCallback(measurementData, deleteTool) {
|
||||
// If a Lesion or Non-Target is removed via a dialog
|
||||
// opened by the Lesion Table, we should clear the data for
|
||||
// the specified Timepoint Cell
|
||||
if (deleteTool === true) {
|
||||
log.info('Confirm clicked!');
|
||||
clearMeasurementTimepointData(measurementData.id, measurementData.timepointId);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete a lesion if Ctrl+D or DELETE is pressed while a lesion is selected
|
||||
const keys = {
|
||||
D: 68,
|
||||
DELETE: 46
|
||||
};
|
||||
|
||||
Template.measurementTableTimepointCell.events({
|
||||
'dblclick .measurementTableTimepointCell': function() {
|
||||
log.info('Double clicked on a timepoint cell');
|
||||
// Search Measurements by lesion and timepoint
|
||||
const currentMeasurement = Template.parentData(1).rowItem;
|
||||
|
||||
// Create some fake measurement data
|
||||
const currentTimepointID = this.timepointId;
|
||||
|
||||
const timepointData = currentMeasurement.timepoints[currentTimepointID];
|
||||
if (!timepointData) {
|
||||
return;
|
||||
}
|
||||
|
||||
let measurementData = {
|
||||
id: currentMeasurement._id,
|
||||
timepointId: currentTimepointID,
|
||||
response: timepointData.response,
|
||||
imageId: timepointData.imageId,
|
||||
handles: timepointData.handles,
|
||||
seriesInstanceUid: timepointData.seriesInstanceUid,
|
||||
studyInstanceUid: timepointData.studyInstanceUid
|
||||
};
|
||||
|
||||
if (currentMeasurement.isTarget) {
|
||||
showConfirmDialog(function() {
|
||||
clearMeasurementTimepointData(currentMeasurement._id, currentTimepointID);
|
||||
});
|
||||
} else {
|
||||
changeNonTargetResponse(measurementData, null, doneCallback);
|
||||
}
|
||||
},
|
||||
'keydown .measurementTableTimepointCell': function(e) {
|
||||
const keyCode = e.which;
|
||||
if (keyCode === keys.DELETE ||
|
||||
(keyCode === keys.D && e.ctrlKey === true)) {
|
||||
const currentMeasurement = Template.parentData(1).rowItem;
|
||||
const currentTimepointID = this.timepointId;
|
||||
|
||||
showConfirmDialog(function() {
|
||||
clearMeasurementTimepointData(currentMeasurement._id, currentTimepointID);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
@import "{design}/app"
|
||||
|
||||
.measurementTableTimepointCell
|
||||
theme('border-left', '%s solid $uiBorderColor' % $uiBorderThickness)
|
||||
theme('color', '$textPrimaryColor')
|
||||
padding: 0 10px
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<template name="measurementTableTimepointHeader">
|
||||
<div class="measurementTableTimepointHeader">
|
||||
<div class="timepointName">
|
||||
{{timepointName}}
|
||||
</div>
|
||||
<div class="timepointDate">
|
||||
{{formatDA latestDate "DD-MMM-YY"}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
Template.measurementTableTimepointHeader.helpers({
|
||||
'timepointName': function() {
|
||||
const timepoint = this;
|
||||
const instance = Template.instance();
|
||||
const timepointApi = instance.data.timepointApi;
|
||||
return timepointApi.name(timepoint);
|
||||
}
|
||||
});
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
@import "{design}/app"
|
||||
|
||||
.measurementTableTimepointHeader
|
||||
flex: 1
|
||||
justify-content: space-around
|
||||
|
||||
div
|
||||
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
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
<template name="measurementTableView">
|
||||
<div class="measurementTableView scrollArea">
|
||||
{{ #let config=measurementConfiguration}}
|
||||
{{ #each measurementType in config.measurementTools}}
|
||||
{{#if measurementType.options.showInMeasurementTable }}
|
||||
{{#let collection=(groupByMeasurementNumber measurementType.id)}}
|
||||
{{>measurementTableHeaderRow
|
||||
measurementType=measurementType
|
||||
measurements=collection
|
||||
currentTimepointId=currentTimepointId
|
||||
timepointApi=timepointApi
|
||||
measurementApi=measurementApi}}
|
||||
|
||||
{{#each entry in collection}}
|
||||
{{>measurementTableRow (clone this rowItem=entry)}}
|
||||
{{/each}}
|
||||
{{/let}}
|
||||
{{/if}}
|
||||
{{ /each }}
|
||||
|
||||
{{#if config.newMeasurementTool }}
|
||||
{{ #let new=newMeasurements }}
|
||||
{{#if new }}
|
||||
{{#let collection=new tool=config.newMeasurementTool}}
|
||||
{{>measurementTableHeaderRow
|
||||
measurementType=tool.measurementType
|
||||
measurements=collection
|
||||
currentTimepointId=currentTimepointId
|
||||
timepointApi=timepointApi
|
||||
measurementApi=measurementApi}}
|
||||
|
||||
{{#each entry in collection}}
|
||||
{{>measurementTableRow (clone this rowItem=entry)}}
|
||||
{{/each}}
|
||||
{{/let}}
|
||||
{{/if}}
|
||||
{{/let}}
|
||||
{{/if}}
|
||||
{{/let}}
|
||||
</div>
|
||||
</template>
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
import { MeasurementsConfiguration } from 'meteor/ohif:measurements/both/configuration/measurements';
|
||||
|
||||
Template.measurementTableView.helpers({
|
||||
isFollowup() {
|
||||
const instance = Template.instance();
|
||||
const current = instance.data.timepointApi.current();
|
||||
return (current && current.timepointType === 'followup');
|
||||
},
|
||||
|
||||
groupByMeasurementNumber(measurementTypeId) {
|
||||
const api = Template.instance().data.measurementApi;
|
||||
const Collection = api[measurementTypeId];
|
||||
const data = Collection.find().fetch();
|
||||
|
||||
const groupObject = _.groupBy(data, entry => { return entry.measurementNumber });
|
||||
|
||||
return Object.keys(groupObject).map(key => {
|
||||
return {
|
||||
measurementTypeId: measurementTypeId,
|
||||
measurementNumber: key,
|
||||
entries: groupObject[key]
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
newMeasurements() {
|
||||
// Find all measurements from this timepoint which do not have a corresponding measurement
|
||||
// at the prior timepoint.
|
||||
const instance = Template.instance();
|
||||
if (!instance.data.timepointApi) {
|
||||
return;
|
||||
}
|
||||
|
||||
const api = instance.data.measurementApi;
|
||||
|
||||
const config = MeasurementsConfiguration.getConfiguration();
|
||||
const measurementTools = config.measurementTools;
|
||||
|
||||
// If this is a baseline, stop here since there are no new measurements to display
|
||||
const current = instance.data.timepointApi.current();
|
||||
if (!current || current.timepointType === 'baseline') {
|
||||
console.log('Skipping New Measurements section');
|
||||
return;
|
||||
}
|
||||
|
||||
let data = [];
|
||||
measurementTools.forEach(tool => {
|
||||
// Handle only tools which are meant to be displayed in the measurement table
|
||||
if (!tool || !tool.options || !tool.options.showInMeasurementTable) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find only those measurements made at this timepoint
|
||||
const selector = {
|
||||
timepointId: current.timepointId
|
||||
}
|
||||
|
||||
// Sort ascending by measurement number
|
||||
const options = {
|
||||
sort: {
|
||||
measurementNumber: 1
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieve measurements made at this timepoint
|
||||
const api = Template.instance().data.measurementApi;
|
||||
const measurementTypeId = tool.id;
|
||||
const Collection = api[measurementTypeId];
|
||||
const measurements = Collection.find(selector, options);
|
||||
|
||||
// For each measurement, check if a previous measurement exists with an identical measurement number
|
||||
let newMeasurements = [];
|
||||
measurements.forEach(measurement => {
|
||||
// If no previous measurements exist, add it to the array of new measurements
|
||||
const selector = {
|
||||
measurementNumber: measurement.measurementNumber,
|
||||
timepointId: {
|
||||
$ne: current.timepointId
|
||||
}
|
||||
};
|
||||
|
||||
const previousMeasurements = Collection.find(selector).fetch();
|
||||
if (previousMeasurements.length === 0) {
|
||||
newMeasurements.push(measurement);
|
||||
}
|
||||
})
|
||||
|
||||
// Concatenate new measurements of all measurement types
|
||||
data = data.concat(newMeasurements);
|
||||
})
|
||||
|
||||
const groupObject = _.groupBy(data, entry => { return entry.measurementNumber });
|
||||
|
||||
return Object.keys(groupObject).map(key => {
|
||||
return {
|
||||
measurementNumber: key,
|
||||
entries: groupObject[key]
|
||||
};
|
||||
});
|
||||
}
|
||||
});
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
@import "{design}/app"
|
||||
|
||||
.measurementTableView.scrollArea
|
||||
width: 100%
|
||||
height: 100%
|
||||
overflow-x: hidden
|
||||
overflow-y: auto
|
||||
margin-left: -6px
|
||||
margin-right: -16px
|
||||
padding-bottom: 100px
|
||||
padding-left: 6px
|
||||
|
||||
-webkit-overflow-scrolling: touch
|
||||
|
||||
&::-webkit-scrollbar
|
||||
display: none
|
||||
Reference in new issue
Block a user