ohif-viewer/Packages/ohif-lesiontracker/both/configuration/bidirectional.js
Erik Ziegler ab4d4c9008 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
2016-11-15 08:21:46 +01:00

86 lines
2.2 KiB
JavaScript

import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements';
const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema;
const BidirectionalHandlesSchema = new SimpleSchema({
start: {
type: CornerstoneHandleSchema,
label: 'Start'
},
end: {
type: CornerstoneHandleSchema,
label: 'End'
},
perpendicularStart: {
type: CornerstoneHandleSchema,
label: 'Perpendicular Start'
},
perpendicularEnd: {
type: CornerstoneHandleSchema,
label: 'Perpendicular End'
},
textBox: {
type: CornerstoneHandleSchema,
label: 'Text Box'
},
});
const BidirectionalSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, {
handles: {
type: BidirectionalHandlesSchema,
label: 'Handles'
},
longestDiameter: {
type: Number,
label: 'Longest Diameter',
decimal: true
},
shortestDiameter: {
type: Number,
label: 'Shortest Diameter',
decimal: true
},
locationUid: {
type: String,
label: 'Location UID',
optional: true // Optional because it is added after initial drawing, via a callback
}
}]);
function displayFunction(data) {
// Check whether this is a Nodal or Extranodal Measurement
const targetType = 'target';
const nodalType = data.isNodal ? 'nodal' : 'extraNodal';
// Get criteria types
const criteriaTypes = TrialCriteriaTypes.find({
selected: true
}).map(criteria => {
return criteria.id;
});
const currentConstraints = getTrialCriteriaConstraints(criteriaTypes, data.imageId);
if (data.shortestDiameter) {
// TODO: Make this check criteria again to see if we should display
// shortest x longest
return data.longestDiameter + ' x ' + data.shortestDiameter;
}
return data.longestDiameter;
}
export const bidirectional = {
id: 'targets',
name: 'Targets',
cornerstoneToolType: 'bidirectional',
schema: BidirectionalSchema,
options: {
showInMeasurementTable: true,
measurementTableOptions: {
displayFunction: displayFunction
},
includeInCaseProgress: true,
},
}