WIP reorganization
This commit is contained in:
1 parent
6706dfe634
commit
054e37dfb7
266 files changed
+98
-620
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
import { measurementTools } from './measurementTools';
|
||||
import { retrieveMeasurements, storeMeasurements, retrieveTimepoints, storeTimepoints, removeTimepoint, updateTimepoint, disassociateStudy } from './dataExchange';
|
||||
import { validateMeasurements } from './dataValidation';
|
||||
import { FieldLesionLocation, FieldLesionLocationResponse } from 'meteor/ohif:lesiontracker/both/schema/fields';
|
||||
|
||||
OHIF.measurements.MeasurementApi.setConfiguration({
|
||||
measurementTools,
|
||||
newLesions: [{
|
||||
id: 'newTargets',
|
||||
name: 'New Targets',
|
||||
toolGroupId: 'targets'
|
||||
}, {
|
||||
id: 'newNonTargets',
|
||||
name: 'New Non-Targets',
|
||||
toolGroupId: 'nonTargets'
|
||||
}],
|
||||
dataExchange: {
|
||||
retrieve: retrieveMeasurements,
|
||||
store: storeMeasurements
|
||||
},
|
||||
dataValidation: {
|
||||
validation: validateMeasurements
|
||||
},
|
||||
schema: {
|
||||
nonTargetLocation: FieldLesionLocation,
|
||||
nonTargetResponse: FieldLesionLocationResponse
|
||||
}
|
||||
});
|
||||
|
||||
OHIF.measurements.TimepointApi.setConfiguration({
|
||||
dataExchange: {
|
||||
retrieve: retrieveTimepoints,
|
||||
store: storeTimepoints,
|
||||
remove: removeTimepoint,
|
||||
update: updateTimepoint,
|
||||
disassociate: disassociateStudy
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,113 @@
|
||||
import { measurementTools } from './measurementTools';
|
||||
|
||||
export const retrieveMeasurements = (patientId, timepointIds) => {
|
||||
console.log('retrieveMeasurements');
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('retrieveMeasurements', patientId, timepointIds, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
console.log(response);
|
||||
|
||||
/*measurementTools.forEach(tool => {
|
||||
console.log('Retrieving tool: ' + tool.id);
|
||||
});*/
|
||||
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const storeMeasurements = (measurementData, timepointIds) => {
|
||||
console.log('storeMeasurements');
|
||||
|
||||
// Here is where we should do any required data transformation and API calls
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('storeMeasurements', measurementData, timepointIds, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const retrieveTimepoints = filter => {
|
||||
console.log('retrieveTimepoints');
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('retrieveTimepoints', filter, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const storeTimepoints = (timepointData) => {
|
||||
console.log('storeTimepoints');
|
||||
console.log(timepointData);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('storeTimepoints', timepointData, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const updateTimepoint = (timepointData, query) => {
|
||||
console.log('updateTimepoint');
|
||||
console.log(timepointData);
|
||||
console.log(query);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('updateTimepoint', timepointData, query, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const removeTimepoint = timepointId => {
|
||||
console.log('removeTimepoint');
|
||||
console.log(timepointId);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('removeTimepoint', timepointId, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const disassociateStudy = (timepointIds, studyInstanceUid) => {
|
||||
console.log('disassociateStudy');
|
||||
console.log(timepointIds);
|
||||
console.log(studyInstanceUid);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('disassociateStudy', timepointIds, studyInstanceUid, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
export const validateMeasurements = () => {
|
||||
console.log('validateMeasurements');
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
import './measurementTools.js';
|
||||
import './dataExchange.js';
|
||||
import './dataValidation.js';
|
||||
import './configuration.js';
|
||||
@@ -0,0 +1,9 @@
|
||||
import { targets } from './toolGroups/targets';
|
||||
import { nonTargets } from './toolGroups/nonTargets';
|
||||
import { temp } from './toolGroups/temp';
|
||||
|
||||
export const measurementTools = [
|
||||
targets,
|
||||
nonTargets,
|
||||
temp
|
||||
];
|
||||
@@ -0,0 +1,29 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
|
||||
export const ToolGroupBaseSchema = new SimpleSchema({
|
||||
toolId: {
|
||||
type: String,
|
||||
label: 'Tool ID',
|
||||
optional: true
|
||||
},
|
||||
toolItemId: {
|
||||
type: String,
|
||||
label: 'Tool Item ID',
|
||||
optional: true
|
||||
},
|
||||
createdAt: {
|
||||
type: Date
|
||||
},
|
||||
studyInstanceUid: {
|
||||
type: String,
|
||||
label: 'Study Instance UID'
|
||||
},
|
||||
timepointId: {
|
||||
type: String,
|
||||
label: 'Timepoint ID'
|
||||
},
|
||||
measurementNumber: {
|
||||
type: Number,
|
||||
label: 'Measurement Number'
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
import { ToolGroupBaseSchema } from './baseSchema';
|
||||
import { nonTarget } from '../tools/nonTarget';
|
||||
|
||||
export const nonTargets = {
|
||||
id: 'nonTargets',
|
||||
name: 'Non-Targets',
|
||||
childTools: [nonTarget],
|
||||
schema: ToolGroupBaseSchema
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
import { ToolGroupBaseSchema } from './baseSchema';
|
||||
import { bidirectional } from '../tools/bidirectional';
|
||||
import { targetCR } from '../tools/targetCR';
|
||||
import { targetUN } from '../tools/targetUN';
|
||||
|
||||
export const targets = {
|
||||
id: 'targets',
|
||||
name: 'Targets',
|
||||
childTools: [bidirectional, targetCR, targetUN],
|
||||
schema: ToolGroupBaseSchema
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import { ToolGroupBaseSchema } from './baseSchema';
|
||||
import { length } from '../tools/length';
|
||||
import { ellipse } from '../tools/ellipse';
|
||||
|
||||
export const temp = {
|
||||
id: 'temp',
|
||||
name: 'Temporary',
|
||||
childTools: [length, ellipse],
|
||||
schema: ToolGroupBaseSchema
|
||||
};
|
||||
@@ -0,0 +1,98 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements';
|
||||
|
||||
const { CornerstoneHandleSchema } = MeasurementSchemaTypes;
|
||||
|
||||
const BidirectionalHandleSchema = new SimpleSchema([CornerstoneHandleSchema, {
|
||||
selected: {
|
||||
type: Boolean,
|
||||
label: 'Selected',
|
||||
optional: true,
|
||||
defaultValue: false
|
||||
}
|
||||
}]);
|
||||
|
||||
const BidirectionalHandlesSchema = new SimpleSchema({
|
||||
start: {
|
||||
type: BidirectionalHandleSchema,
|
||||
label: 'Start'
|
||||
},
|
||||
end: {
|
||||
type: BidirectionalHandleSchema,
|
||||
label: 'End'
|
||||
},
|
||||
perpendicularStart: {
|
||||
type: BidirectionalHandleSchema,
|
||||
label: 'Perpendicular Start'
|
||||
},
|
||||
perpendicularEnd: {
|
||||
type: BidirectionalHandleSchema,
|
||||
label: 'Perpendicular End'
|
||||
},
|
||||
textBox: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Text Box'
|
||||
},
|
||||
});
|
||||
|
||||
const BidirectionalSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, {
|
||||
handles: {
|
||||
type: BidirectionalHandlesSchema,
|
||||
label: 'Handles'
|
||||
},
|
||||
measurementNumber: {
|
||||
type: Number,
|
||||
label: 'Measurement Number'
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
label: 'Location',
|
||||
optional: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
label: 'Description',
|
||||
optional: true
|
||||
},
|
||||
longestDiameter: {
|
||||
type: Number,
|
||||
label: 'Longest Diameter',
|
||||
decimal: true
|
||||
},
|
||||
shortestDiameter: {
|
||||
type: Number,
|
||||
label: 'Shortest Diameter',
|
||||
decimal: true
|
||||
},
|
||||
isSplitLesion: {
|
||||
type: Boolean,
|
||||
label: 'Is Split Lesion',
|
||||
optional: true,
|
||||
defaultValue: false
|
||||
}
|
||||
}]);
|
||||
|
||||
const displayFunction = data => {
|
||||
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: 'bidirectional',
|
||||
name: 'Target',
|
||||
toolGroup: 'targets',
|
||||
cornerstoneToolType: 'bidirectional',
|
||||
schema: BidirectionalSchema,
|
||||
options: {
|
||||
measurementTable: {
|
||||
displayFunction
|
||||
},
|
||||
caseProgress: {
|
||||
include: true
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements';
|
||||
|
||||
const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema;
|
||||
|
||||
const EllipseHandlesSchema = new SimpleSchema({
|
||||
start: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Start'
|
||||
},
|
||||
end: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'End'
|
||||
},
|
||||
textBox: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Text Box'
|
||||
},
|
||||
});
|
||||
|
||||
const EllipseSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, {
|
||||
handles: {
|
||||
type: EllipseHandlesSchema,
|
||||
label: 'Handles'
|
||||
}
|
||||
}]);
|
||||
|
||||
export const ellipse = {
|
||||
id: 'ellipticalRoi',
|
||||
name: 'Ellipse',
|
||||
toolGroup: 'temp',
|
||||
cornerstoneToolType: 'ellipticalRoi',
|
||||
schema: EllipseSchema
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements';
|
||||
|
||||
const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema;
|
||||
|
||||
const LengthHandlesSchema = new SimpleSchema({
|
||||
start: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Start'
|
||||
},
|
||||
end: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'End'
|
||||
},
|
||||
textBox: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Text Box'
|
||||
}
|
||||
});
|
||||
|
||||
const LengthSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, {
|
||||
handles: {
|
||||
type: LengthHandlesSchema,
|
||||
label: 'Handles'
|
||||
}
|
||||
}]);
|
||||
|
||||
export const length = {
|
||||
id: 'length',
|
||||
name: 'Length',
|
||||
toolGroup: 'temp',
|
||||
cornerstoneToolType: 'length',
|
||||
schema: LengthSchema
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements';
|
||||
|
||||
const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema;
|
||||
|
||||
const NonTargetHandlesSchema = new SimpleSchema({
|
||||
start: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Start'
|
||||
},
|
||||
end: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'End'
|
||||
},
|
||||
textBox: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Text Box'
|
||||
}
|
||||
});
|
||||
|
||||
const NonTargetSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, {
|
||||
handles: {
|
||||
type: NonTargetHandlesSchema,
|
||||
label: 'Handles'
|
||||
},
|
||||
measurementNumber: {
|
||||
type: Number,
|
||||
label: 'Measurement Number'
|
||||
},
|
||||
response: {
|
||||
type: String,
|
||||
label: 'Response',
|
||||
optional: true // Optional because it is added after initial drawing, via a callback
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
label: 'Location',
|
||||
optional: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
label: 'Description',
|
||||
optional: true
|
||||
}
|
||||
}]);
|
||||
|
||||
export const nonTarget = {
|
||||
id: 'nonTarget',
|
||||
name: 'Non-Target',
|
||||
toolGroup: 'nonTargets',
|
||||
cornerstoneToolType: 'nonTarget',
|
||||
schema: NonTargetSchema,
|
||||
options: {
|
||||
measurementTable: {
|
||||
displayFunction: data => data.response
|
||||
},
|
||||
caseProgress: {
|
||||
include: true
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements';
|
||||
|
||||
const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema;
|
||||
|
||||
const TargetCRHandlesSchema = new SimpleSchema({
|
||||
start: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Start'
|
||||
},
|
||||
end: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'End'
|
||||
},
|
||||
textBox: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Text Box'
|
||||
}
|
||||
});
|
||||
|
||||
const TargetCRSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, {
|
||||
handles: {
|
||||
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',
|
||||
optional: true
|
||||
}
|
||||
}]);
|
||||
|
||||
export const targetCR = {
|
||||
id: 'targetCR',
|
||||
name: 'CR Target',
|
||||
toolGroup: 'targets',
|
||||
cornerstoneToolType: 'targetCR',
|
||||
schema: TargetCRSchema,
|
||||
options: {
|
||||
measurementTable: {
|
||||
displayFunction: data => data.response
|
||||
},
|
||||
caseProgress: {
|
||||
include: true
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements';
|
||||
|
||||
const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema;
|
||||
|
||||
const TargetUNHandlesSchema = new SimpleSchema({
|
||||
start: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Start'
|
||||
},
|
||||
end: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'End'
|
||||
},
|
||||
textBox: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Text Box'
|
||||
}
|
||||
});
|
||||
|
||||
const TargetUNSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, {
|
||||
handles: {
|
||||
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',
|
||||
optional: true
|
||||
}
|
||||
}]);
|
||||
|
||||
export const targetUN = {
|
||||
id: 'targetUN',
|
||||
name: 'UN Target',
|
||||
toolGroup: 'targets',
|
||||
cornerstoneToolType: 'targetUN',
|
||||
schema: TargetUNSchema,
|
||||
options: {
|
||||
measurementTable: {
|
||||
displayFunction: data => data.response
|
||||
},
|
||||
caseProgress: {
|
||||
include: true
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user