LT-115: Grouping tools schemas
This commit is contained in:
parent
0e857d3520
commit
bd748eae32
@ -1,15 +1,9 @@
|
||||
import { target } from './target';
|
||||
import { targetCR } from './targetCR';
|
||||
import { targetUN } from './targetUN';
|
||||
import { nonTarget } from './nonTarget';
|
||||
import { length } from './length';
|
||||
import { ellipse } from './ellipse';
|
||||
import { targets } from './toolGroups/targets';
|
||||
import { nonTargets } from './toolGroups/nonTargets';
|
||||
import { temp } from './toolGroups/temp';
|
||||
|
||||
export const measurementTools = [
|
||||
target,
|
||||
targetCR,
|
||||
targetUN,
|
||||
nonTarget,
|
||||
length,
|
||||
ellipse
|
||||
targets,
|
||||
nonTargets,
|
||||
temp
|
||||
];
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { nonTarget } from '../tools/nonTarget';
|
||||
|
||||
const NonTargetSchema = new SimpleSchema({
|
||||
toolId: {
|
||||
type: String,
|
||||
label: 'Tool ID'
|
||||
},
|
||||
toolItemUid: {
|
||||
type: String,
|
||||
label: 'Tool Item UID'
|
||||
}
|
||||
});
|
||||
|
||||
export const nonTargets = {
|
||||
id: 'nonTargets',
|
||||
name: 'Non-Targets',
|
||||
childTools: [nonTarget],
|
||||
schema: NonTargetSchema
|
||||
};
|
||||
@ -0,0 +1,22 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { bidirectional } from '../tools/bidirectional';
|
||||
import { targetCR } from '../tools/targetCR';
|
||||
import { targetUN } from '../tools/targetUN';
|
||||
|
||||
const TargetSchema = new SimpleSchema({
|
||||
toolId: {
|
||||
type: String,
|
||||
label: 'Tool ID'
|
||||
},
|
||||
toolItemUid: {
|
||||
type: String,
|
||||
label: 'Tool Item UID'
|
||||
}
|
||||
});
|
||||
|
||||
export const targets = {
|
||||
id: 'targets',
|
||||
name: 'Targets',
|
||||
childTools: [bidirectional, targetCR, targetUN],
|
||||
schema: TargetSchema
|
||||
};
|
||||
@ -0,0 +1,21 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { length } from '../tools/length';
|
||||
import { ellipse } from '../tools/ellipse';
|
||||
|
||||
const TempSchema = new SimpleSchema({
|
||||
toolId: {
|
||||
type: String,
|
||||
label: 'Tool ID'
|
||||
},
|
||||
toolItemUid: {
|
||||
type: String,
|
||||
label: 'Tool Item UID'
|
||||
}
|
||||
});
|
||||
|
||||
export const temp = {
|
||||
id: 'temp',
|
||||
name: 'Temporary',
|
||||
childTools: [length, ellipse],
|
||||
schema: TempSchema
|
||||
};
|
||||
@ -3,7 +3,7 @@ import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/mea
|
||||
|
||||
const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema;
|
||||
|
||||
const TargetHandlesSchema = new SimpleSchema({
|
||||
const BidirectionalHandlesSchema = new SimpleSchema({
|
||||
start: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Start'
|
||||
@ -26,11 +26,15 @@ const TargetHandlesSchema = new SimpleSchema({
|
||||
},
|
||||
});
|
||||
|
||||
const TargetSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, {
|
||||
const BidirectionalSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, {
|
||||
handles: {
|
||||
type: TargetHandlesSchema,
|
||||
type: BidirectionalHandlesSchema,
|
||||
label: 'Handles'
|
||||
},
|
||||
measurementNumber: {
|
||||
type: Number,
|
||||
label: 'Measurement Number'
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
label: 'Location',
|
||||
@ -58,7 +62,7 @@ const TargetSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMea
|
||||
}
|
||||
}]);
|
||||
|
||||
function displayFunction(data) {
|
||||
const displayFunction = data => {
|
||||
// Check whether this is a Nodal or Extranodal Measurement
|
||||
// const targetType = 'target';
|
||||
// const nodalType = data.isNodal ? 'nodal' : 'extraNodal';
|
||||
@ -79,19 +83,18 @@ function displayFunction(data) {
|
||||
}
|
||||
|
||||
return data.longestDiameter;
|
||||
}
|
||||
};
|
||||
|
||||
export const target = {
|
||||
id: 'targets',
|
||||
name: 'Targets',
|
||||
export const bidirectional = {
|
||||
toolGroup: 'targets',
|
||||
cornerstoneToolType: 'bidirectional',
|
||||
schema: TargetSchema,
|
||||
schema: BidirectionalSchema,
|
||||
options: {
|
||||
showInMeasurementTable: true,
|
||||
measurementTableOptions: {
|
||||
key: 'targets',
|
||||
displayFunction: displayFunction
|
||||
measurementTable: {
|
||||
displayFunction
|
||||
},
|
||||
includeInCaseProgress: true,
|
||||
caseProgress: {
|
||||
include: true
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -23,6 +23,10 @@ const NonTargetSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneTool
|
||||
type: NonTargetHandlesSchema,
|
||||
label: 'Handles'
|
||||
},
|
||||
measurementNumber: {
|
||||
type: Number,
|
||||
label: 'Measurement Number'
|
||||
},
|
||||
response: {
|
||||
type: String,
|
||||
label: 'Response',
|
||||
@ -40,21 +44,16 @@ const NonTargetSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneTool
|
||||
}
|
||||
}]);
|
||||
|
||||
function displayFunction(data) {
|
||||
return data.response;
|
||||
}
|
||||
|
||||
export const nonTarget = {
|
||||
id: 'nonTargets',
|
||||
name: 'Non-Targets',
|
||||
toolGroup: 'nonTargets',
|
||||
cornerstoneToolType: 'nonTarget',
|
||||
schema: NonTargetSchema,
|
||||
displayFunction: displayFunction,
|
||||
options: {
|
||||
showInMeasurementTable: true,
|
||||
measurementTableOptions: {
|
||||
displayFunction: displayFunction
|
||||
measurementTable: {
|
||||
displayFunction: data => data.response
|
||||
},
|
||||
includeInCaseProgress: true,
|
||||
caseProgress: {
|
||||
include: true
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -23,11 +23,20 @@ const TargetCRSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolM
|
||||
type: TargetCRHandlesSchema,
|
||||
label: 'Handles'
|
||||
},
|
||||
measurementNumber: {
|
||||
type: Number,
|
||||
label: 'Measurement Number'
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
label: 'Location',
|
||||
optional: true
|
||||
},
|
||||
response: {
|
||||
type: String,
|
||||
label: 'Response',
|
||||
optional: true // Optional because it is added after initial drawing, via a callback
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
label: 'Description',
|
||||
@ -40,17 +49,16 @@ const TargetCRSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolM
|
||||
}
|
||||
}]);
|
||||
|
||||
function displayFunction(data) {
|
||||
return data.location;
|
||||
}
|
||||
|
||||
export const targetCR = {
|
||||
id: 'targetsCR',
|
||||
memberOf: 'targets',
|
||||
name: 'CR Targets',
|
||||
toolGroup: 'targets',
|
||||
cornerstoneToolType: 'targetCR',
|
||||
schema: TargetCRSchema,
|
||||
options: {
|
||||
includeInCaseProgress: true,
|
||||
measurementTable: {
|
||||
displayFunction: data => data.response
|
||||
},
|
||||
caseProgress: {
|
||||
include: true
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -23,11 +23,20 @@ const TargetUNSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolM
|
||||
type: TargetUNHandlesSchema,
|
||||
label: 'Handles'
|
||||
},
|
||||
measurementNumber: {
|
||||
type: Number,
|
||||
label: 'Measurement Number'
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
label: 'Location',
|
||||
optional: true
|
||||
},
|
||||
response: {
|
||||
type: String,
|
||||
label: 'Response',
|
||||
optional: true // Optional because it is added after initial drawing, via a callback
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
label: 'Description',
|
||||
@ -40,17 +49,16 @@ const TargetUNSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolM
|
||||
}
|
||||
}]);
|
||||
|
||||
function displayFunction(data) {
|
||||
return data.location;
|
||||
}
|
||||
|
||||
export const targetUN = {
|
||||
id: 'targetsUN',
|
||||
memberOf: 'targets',
|
||||
name: 'UN Targets',
|
||||
toolGroup: 'targets',
|
||||
cornerstoneToolType: 'targetUN',
|
||||
schema: TargetUNSchema,
|
||||
options: {
|
||||
includeInCaseProgress: true,
|
||||
measurementTable: {
|
||||
displayFunction: data => data.response
|
||||
},
|
||||
caseProgress: {
|
||||
include: true
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -134,7 +134,7 @@ class MeasurementApi {
|
||||
$nin: numbers
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return collection.find(filter).fetch();
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ class MeasurementApi {
|
||||
const hasNoDataAtTimepoint = this.hasNoDataAtTimepoint;
|
||||
|
||||
const includedTools = tools.filter(tool => {
|
||||
return (tool.options && tool.options.includeInCaseProgress === true);
|
||||
return (tool.options && tool.options.caseProgress && tool.options.caseProgress.include);
|
||||
});
|
||||
|
||||
let overallMeasurementNumber = 1;
|
||||
@ -227,7 +227,7 @@ class MeasurementApi {
|
||||
|
||||
// Next, handle New Measurements (i.e. no baseline data)
|
||||
// Note that this cannot be combined with the loop above due to the incrementing of the overallMeasurementNumber
|
||||
includedTools.forEach(tool => {
|
||||
includedTools.forEach(tool => {
|
||||
const collection = this[tool.id];
|
||||
const toolType = tool.cornerstoneToolType;
|
||||
const measurements = hasNoDataAtTimepoint(collection, baselineTimepointId);
|
||||
|
||||
@ -66,7 +66,7 @@ Template.caseProgress.onRendered(() => {
|
||||
|
||||
const config = OHIF.measurements.MeasurementApi.getConfiguration();
|
||||
const tools = config.measurementTools;
|
||||
const toolsToInclude = tools.filter(tool => tool.options && tool.options.includeInCaseProgress);
|
||||
const toolsToInclude = tools.filter(tool => tool.options && tool.options.caseProgress && tool.options.caseProgress.include);
|
||||
const toolIds = toolsToInclude.map(tool => tool.id);
|
||||
const api = instance.data.measurementApi;
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ Template.measurementTableTimepointCell.helpers({
|
||||
// TODO: Figure out what is going on here?
|
||||
console.warn('Something went wrong?');
|
||||
}
|
||||
const displayFunction = tool.options.measurementTableOptions.displayFunction;
|
||||
const displayFunction = tool.options.measurementTable.displayFunction;
|
||||
return displayFunction(data);
|
||||
}
|
||||
});
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<div class="measurementTableView scrollArea">
|
||||
{{#let config=measurementConfiguration}}
|
||||
{{#each measurementType in config.measurementTools}}
|
||||
{{#if measurementType.options.showInMeasurementTable}}
|
||||
{{#if measurementType.options.measurementTable.displayFunction}}
|
||||
{{#let collection=(groupByMeasurementNumber measurementType.id)}}
|
||||
{{>measurementTableHeaderRow
|
||||
measurementType=measurementType
|
||||
|
||||
Loading…
Reference in New Issue
Block a user