PWV-3: Refactoring MeasurementConfiguration and TimepointsConfiguration
This commit is contained in:
parent
151837d8d1
commit
f3f32518c6
@ -1,16 +1,10 @@
|
|||||||
import { OHIF } from 'meteor/ohif:core';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
import { TimepointsConfiguration } from 'meteor/ohif:measurements/both/configuration/timepoints';
|
|
||||||
import { MeasurementsConfiguration } from 'meteor/ohif:measurements/both/configuration/measurements';
|
|
||||||
import { MeasurementHandlers } from 'meteor/ohif:measurements/client/lib/MeasurementHandlers';
|
import { MeasurementHandlers } from 'meteor/ohif:measurements/client/lib/MeasurementHandlers';
|
||||||
|
|
||||||
Session.set('TimepointsReady', false);
|
Session.set('TimepointsReady', false);
|
||||||
Session.set('MeasurementsReady', false);
|
Session.set('MeasurementsReady', false);
|
||||||
|
|
||||||
Template.viewer.onCreated(() => {
|
Template.viewer.onCreated(() => {
|
||||||
const TimepointApi = TimepointsConfiguration.getTimepointsApi();
|
|
||||||
const MeasurementApi = MeasurementsConfiguration.getMeasurementsApi();
|
|
||||||
|
|
||||||
OHIF.viewer = OHIF.viewer || {};
|
|
||||||
ViewerData = window.ViewerData || ViewerData;
|
ViewerData = window.ViewerData || ViewerData;
|
||||||
|
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
@ -68,19 +62,19 @@ Template.viewer.onCreated(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (instance.data.currentTimepointId) {
|
if (instance.data.currentTimepointId) {
|
||||||
instance.data.timepointApi = new TimepointApi(instance.data.currentTimepointId);
|
instance.data.timepointApi = new OHIF.measurements.TimepointApi(instance.data.currentTimepointId);
|
||||||
const timepointsPromise = instance.data.timepointApi.retrieveTimepoints();
|
const timepointsPromise = instance.data.timepointApi.retrieveTimepoints();
|
||||||
timepointsPromise.then(() => {
|
timepointsPromise.then(() => {
|
||||||
Session.set('TimepointsReady', true);
|
Session.set('TimepointsReady', true);
|
||||||
})
|
});
|
||||||
|
|
||||||
instance.data.measurementApi = new MeasurementApi(instance.data.currentTimepointId);
|
instance.data.measurementApi = new OHIF.measurements.MeasurementApi(instance.data.currentTimepointId);
|
||||||
const measurementsPromise = instance.data.measurementApi.retrieveMeasurements();
|
const measurementsPromise = instance.data.measurementApi.retrieveMeasurements();
|
||||||
measurementsPromise.then(() => {
|
measurementsPromise.then(() => {
|
||||||
Session.set('MeasurementsReady', true);
|
Session.set('MeasurementsReady', true);
|
||||||
|
|
||||||
instance.data.measurementApi.syncMeasurementsAndToolData();
|
instance.data.measurementApi.syncMeasurementsAndToolData();
|
||||||
})
|
});
|
||||||
|
|
||||||
// Provide the necessary data to the Measurement API and Timepoint API
|
// Provide the necessary data to the Measurement API and Timepoint API
|
||||||
const prior = instance.data.timepointApi.prior();
|
const prior = instance.data.timepointApi.prior();
|
||||||
@ -89,7 +83,7 @@ Template.viewer.onCreated(() => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.warn('No current timepoint specified');
|
console.warn('No current timepoint specified');
|
||||||
instance.data.measurementApi = new MeasurementApi();
|
instance.data.measurementApi = new OHIF.measurements.MeasurementApi();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -98,7 +92,7 @@ Template.viewer.helpers({
|
|||||||
// TODO: Find a better way to do this
|
// TODO: Find a better way to do this
|
||||||
return Session.get('TimepointsReady') && Session.get('MeasurementsReady');
|
return Session.get('TimepointsReady') && Session.get('MeasurementsReady');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
Template.viewer.events({
|
Template.viewer.events({
|
||||||
'CornerstoneToolsMeasurementAdded .imageViewerViewport'(event, instance, eventData) {
|
'CornerstoneToolsMeasurementAdded .imageViewerViewport'(event, instance, eventData) {
|
||||||
|
|||||||
@ -5,8 +5,6 @@ import { MeasurementHandlers } from 'meteor/ohif:measurements/client/lib/Measure
|
|||||||
Session.set('MeasurementsReady', false);
|
Session.set('MeasurementsReady', false);
|
||||||
|
|
||||||
Template.viewer.onCreated(() => {
|
Template.viewer.onCreated(() => {
|
||||||
const MeasurementApi = MeasurementsConfiguration.getMeasurementsApi();
|
|
||||||
|
|
||||||
OHIF.viewer = OHIF.viewer || {};
|
OHIF.viewer = OHIF.viewer || {};
|
||||||
|
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
@ -39,7 +37,7 @@ Template.viewer.onCreated(() => {
|
|||||||
ViewerStudies.insert(study);
|
ViewerStudies.insert(study);
|
||||||
});
|
});
|
||||||
|
|
||||||
instance.data.measurementApi = new MeasurementApi();
|
instance.data.measurementApi = new OHIF.measurements.MeasurementApi();
|
||||||
const measurementsPromise = instance.data.measurementApi.retrieveMeasurements();
|
const measurementsPromise = instance.data.measurementApi.retrieveMeasurements();
|
||||||
measurementsPromise.then(() => {
|
measurementsPromise.then(() => {
|
||||||
Session.set('MeasurementsReady', true);
|
Session.set('MeasurementsReady', true);
|
||||||
|
|||||||
@ -2,7 +2,10 @@
|
|||||||
* Defines the base OHIF object
|
* Defines the base OHIF object
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const OHIF = {};
|
const OHIF = {
|
||||||
|
viewer: {},
|
||||||
|
measurements: {}
|
||||||
|
};
|
||||||
|
|
||||||
// Expose the OHIF object to the client if it is on development mode
|
// Expose the OHIF object to the client if it is on development mode
|
||||||
if (Meteor.isDevelopment && Meteor.isClient) {
|
if (Meteor.isDevelopment && Meteor.isClient) {
|
||||||
|
|||||||
@ -1,32 +1,31 @@
|
|||||||
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
|
|
||||||
import { measurementTools } from './measurementTools';
|
import { measurementTools } from './measurementTools';
|
||||||
import { retrieveMeasurements, storeMeasurements, retrieveTimepoints, storeTimepoints } from './dataExchange';
|
import { retrieveMeasurements, storeMeasurements, retrieveTimepoints, storeTimepoints } from './dataExchange';
|
||||||
import { validateMeasurements } from './dataValidation';
|
import { validateMeasurements } from './dataValidation';
|
||||||
|
|
||||||
import { MeasurementsConfiguration } from 'meteor/ohif:measurements/both/configuration/measurements';
|
|
||||||
import { TimepointsConfiguration } from 'meteor/ohif:measurements/both/configuration/timepoints';
|
|
||||||
|
|
||||||
console.log('OHIF-LesionTracker: Defining Configuration for Measurements');
|
console.log('OHIF-LesionTracker: Defining Configuration for Measurements');
|
||||||
|
|
||||||
const newMeasurementTool = {
|
const newMeasurementTool = {
|
||||||
id: 'newLesions',
|
id: 'newLesions',
|
||||||
name: 'New Lesions'
|
name: 'New Lesions'
|
||||||
};
|
};
|
||||||
|
|
||||||
MeasurementsConfiguration.setConfiguration({
|
OHIF.measurements.MeasurementApi.setConfiguration({
|
||||||
measurementTools: measurementTools,
|
measurementTools: measurementTools,
|
||||||
newMeasurementTool: newMeasurementTool,
|
newMeasurementTool: newMeasurementTool,
|
||||||
dataExchange: {
|
dataExchange: {
|
||||||
retrieve: retrieveMeasurements,
|
retrieve: retrieveMeasurements,
|
||||||
store: storeMeasurements
|
store: storeMeasurements
|
||||||
},
|
},
|
||||||
dataValidation: {
|
dataValidation: {
|
||||||
validation: validateMeasurements
|
validation: validateMeasurements
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
TimepointsConfiguration.setConfiguration({
|
OHIF.measurements.TimepointApi.setConfiguration({
|
||||||
dataExchange: {
|
dataExchange: {
|
||||||
retrieve: retrieveTimepoints,
|
retrieve: retrieveTimepoints,
|
||||||
store: storeTimepoints
|
store: storeTimepoints
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,66 +1,66 @@
|
|||||||
import { measurementTools } from './measurementTools';
|
import { measurementTools } from './measurementTools';
|
||||||
|
|
||||||
export const retrieveMeasurements = () => {
|
export const retrieveMeasurements = () => {
|
||||||
console.log('retrieveMeasurements');
|
console.log('retrieveMeasurements');
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
Meteor.call("retrieveMeasurements", (error, response) => {
|
Meteor.call('retrieveMeasurements', (error, response) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
} else {
|
} else {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
|
||||||
/*measurementTools.forEach(tool => {
|
/*measurementTools.forEach(tool => {
|
||||||
console.log('Retrieving tool: ' + tool.id);
|
console.log('Retrieving tool: ' + tool.id);
|
||||||
});*/
|
});*/
|
||||||
|
|
||||||
resolve(response);
|
resolve(response);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const storeMeasurements = (measurementData) => {
|
export const storeMeasurements = (measurementData) => {
|
||||||
console.log('storeMeasurements');
|
console.log('storeMeasurements');
|
||||||
|
|
||||||
// Here is where we should do any required data transformation and API calls
|
// Here is where we should do any required data transformation and API calls
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
Meteor.call("storeMeasurements", measurementData, (error, response) => {
|
Meteor.call('storeMeasurements', measurementData, (error, response) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
} else {
|
} else {
|
||||||
resolve(response);
|
resolve(response);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const retrieveTimepoints = () => {
|
export const retrieveTimepoints = () => {
|
||||||
console.log('retrieveTimepoints');
|
console.log('retrieveTimepoints');
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
Meteor.call("retrieveTimepoints", (error, response) => {
|
Meteor.call('retrieveTimepoints', (error, response) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
} else {
|
} else {
|
||||||
resolve(response);
|
resolve(response);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const storeTimepoints = (timepointData) => {
|
export const storeTimepoints = (timepointData) => {
|
||||||
console.log('storeTimepoints');
|
console.log('storeTimepoints');
|
||||||
console.log(timepointData);
|
console.log(timepointData);
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
Meteor.call("storeTimepoints", timepointData, (error, response) => {
|
Meteor.call('storeTimepoints', timepointData, (error, response) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
} else {
|
} else {
|
||||||
resolve(response);
|
resolve(response);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
import { TimepointsConfiguration } from 'meteor/ohif:measurements/both/configuration/timepoints';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
const TimepointApi = TimepointsConfiguration.getTimepointsApi();
|
|
||||||
|
|
||||||
Meteor.startup(function() {
|
Meteor.startup(function() {
|
||||||
StudyList.callbacks['dblClickOnStudy'] = dblClickOnStudy;
|
StudyList.callbacks['dblClickOnStudy'] = dblClickOnStudy;
|
||||||
StudyList.callbacks['middleClickOnStudy'] = dblClickOnStudy;
|
StudyList.callbacks['middleClickOnStudy'] = dblClickOnStudy;
|
||||||
|
|
||||||
StudyList.timepointApi = new TimepointApi();
|
StudyList.timepointApi = new OHIF.measurements.TimepointApi();
|
||||||
StudyList.timepointApi.retrieveTimepoints();
|
StudyList.timepointApi.retrieveTimepoints();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -17,7 +16,7 @@ function dblClickOnStudy(data) {
|
|||||||
let title = formatPN(data.patientName);
|
let title = formatPN(data.patientName);
|
||||||
|
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
|
|
||||||
// Find the relevant timepoint given the clicked-on study
|
// Find the relevant timepoint given the clicked-on study
|
||||||
const timepointApi = StudyList.timepointApi;
|
const timepointApi = StudyList.timepointApi;
|
||||||
if (!timepointApi) {
|
if (!timepointApi) {
|
||||||
|
|||||||
@ -1,109 +1,107 @@
|
|||||||
let Configuration = {};
|
import { Mongo } from 'meteor/mongo';
|
||||||
|
import { _ } from 'meteor/underscore';
|
||||||
|
|
||||||
function setConfiguration(config) {
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
Configuration = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getConfiguration() {
|
let configuration = {};
|
||||||
return Configuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getMeasurementsApi() {
|
class MeasurementApi {
|
||||||
console.log('OHIF-Measurements: Defining MeasurementApi');
|
static setConfiguration(config) {
|
||||||
const config = Configuration;
|
configuration = config;
|
||||||
|
}
|
||||||
|
|
||||||
class MeasurementApi {
|
static getConfiguration() {
|
||||||
constructor(currentTimepointId) {
|
return configuration;
|
||||||
if (currentTimepointId) {
|
}
|
||||||
this.currentTimepointId = currentTimepointId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
retrieveMeasurements(timepointId) {
|
constructor(currentTimepointId, configuration) {
|
||||||
if (!timepointId) {
|
if (currentTimepointId) {
|
||||||
timepointId = this.currentTimepointId;
|
this.currentTimepointId = currentTimepointId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const retrievalFn = config.dataExchange.retrieve;
|
this.config = configuration || MeasurementApi.getConfiguration();
|
||||||
if (!_.isFunction(retrievalFn)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
this.config.measurementTools.forEach(tool => {
|
||||||
retrievalFn().then(measurementData => {
|
const measurementTypeId = tool.id;
|
||||||
console.log('Measurement data retrieval');
|
|
||||||
console.log(measurementData);
|
|
||||||
|
|
||||||
Object.keys(measurementData).forEach(measurementTypeId => {
|
this[measurementTypeId] = new Mongo.Collection(null);
|
||||||
const measurements = measurementData[measurementTypeId];
|
this[measurementTypeId].attachSchema(tool.schema);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
measurements.forEach(measurement => {
|
retrieveMeasurements(timepointId) {
|
||||||
delete measurement._id;
|
if (!timepointId) {
|
||||||
this[measurementTypeId].insert(measurement);
|
timepointId = this.currentTimepointId;
|
||||||
})
|
}
|
||||||
});
|
|
||||||
|
|
||||||
resolve();
|
const retrievalFn = this.config.dataExchange.retrieve;
|
||||||
});
|
if (!_.isFunction(retrievalFn)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
retrievalFn().then(measurementData => {
|
||||||
|
// TODO: implement converter here
|
||||||
|
|
||||||
|
console.log('Measurement data retrieval');
|
||||||
|
console.log(measurementData);
|
||||||
|
|
||||||
|
Object.keys(measurementData).forEach(measurementTypeId => {
|
||||||
|
const measurements = measurementData[measurementTypeId];
|
||||||
|
|
||||||
|
measurements.forEach(measurement => {
|
||||||
|
delete measurement._id;
|
||||||
|
this[measurementTypeId].insert(measurement);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
|
||||||
storeMeasurements(timepointId) {
|
storeMeasurements(timepointId) {
|
||||||
const storeFn = config.dataExchange.store;
|
const storeFn = this.config.dataExchange.store;
|
||||||
if (!_.isFunction(storeFn)) {
|
if (!_.isFunction(storeFn)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let measurementData = {};
|
let measurementData = {};
|
||||||
config.measurementTools.forEach(tool => {
|
this.config.measurementTools.forEach(tool => {
|
||||||
const measurementTypeId = tool.id;
|
const measurementTypeId = tool.id;
|
||||||
measurementData[measurementTypeId] = this[measurementTypeId].find().fetch();
|
measurementData[measurementTypeId] = this[measurementTypeId].find().fetch();
|
||||||
});
|
});
|
||||||
|
|
||||||
storeFn(measurementData).then(() => {
|
storeFn(measurementData).then(() => {
|
||||||
console.log('Measurement storage completed');
|
console.log('Measurement storage completed');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
validateMeasurements() {
|
validateMeasurements() {
|
||||||
const validateFn = config.dataValidation.validateMeasurements;
|
const validateFn = this.config.dataValidation.validateMeasurements;
|
||||||
if (validateFn && validateFn instanceof Function) {
|
if (validateFn && validateFn instanceof Function) {
|
||||||
validateFn();
|
validateFn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
syncMeasurementsAndToolData() {
|
syncMeasurementsAndToolData() {
|
||||||
config.measurementTools.forEach(tool => {
|
this.config.measurementTools.forEach(tool => {
|
||||||
const measurements = this[tool.id].find().fetch();
|
const measurements = this[tool.id].find().fetch();
|
||||||
measurements.forEach(measurement => {
|
measurements.forEach(measurement => {
|
||||||
syncMeasurementAndToolData(measurement);
|
syncMeasurementAndToolData(measurement);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
config.measurementTools.forEach(tool => {
|
fetch(measurementTypeId, selector, options) {
|
||||||
const measurementTypeId = tool.id;
|
if (!this[measurementTypeId]) {
|
||||||
|
throw 'MeasurementApi: No Collection with the id: ' + measurementTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
MeasurementApi.prototype[measurementTypeId] = new Mongo.Collection(null);
|
selector = selector || {};
|
||||||
MeasurementApi.prototype[measurementTypeId].attachSchema(tool.schema);
|
options = options || {};
|
||||||
|
return this[measurementTypeId].find(selector, options).fetch();
|
||||||
MeasurementApi.prototype.fetch = (measurementTypeId, selector, options) => {
|
}
|
||||||
if (!this[measurementTypeId]) {
|
|
||||||
throw 'MeasurementApi: No Collection with the id: ' + measurementTypeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
selector = selector || {};
|
|
||||||
options = options || {};
|
|
||||||
return this[measurementTypeId].find(selector, options).fetch();
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
return MeasurementApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MeasurementsConfiguration = {
|
OHIF.measurements.MeasurementApi = MeasurementApi;
|
||||||
setConfiguration: setConfiguration,
|
|
||||||
getConfiguration: getConfiguration,
|
|
||||||
getMeasurementsApi: getMeasurementsApi
|
|
||||||
};
|
|
||||||
|
|||||||
@ -1,230 +1,225 @@
|
|||||||
|
import { Mongo } from 'meteor/mongo';
|
||||||
|
import { _ } from 'meteor/underscore';
|
||||||
|
|
||||||
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
|
|
||||||
import { schema as TimepointSchema } from 'meteor/ohif:measurements/both/schema/timepoints';
|
import { schema as TimepointSchema } from 'meteor/ohif:measurements/both/schema/timepoints';
|
||||||
|
|
||||||
let Configuration = {};
|
let configuration = {};
|
||||||
|
|
||||||
function setConfiguration(config) {
|
|
||||||
Configuration = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getConfiguration() {
|
|
||||||
return Configuration;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function getTimepointsApi() {
|
|
||||||
console.log('OHIF-Measurements: Defining TimepointsApi');
|
|
||||||
const config = Configuration;
|
|
||||||
|
|
||||||
class TimepointApi {
|
|
||||||
constructor(currentTimepointId) {
|
|
||||||
if (currentTimepointId) {
|
|
||||||
this.currentTimepointId = currentTimepointId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
retrieveTimepoints() {
|
|
||||||
this.timepoints = new Mongo.Collection(null);
|
|
||||||
this.timepoints.attachSchema(TimepointSchema);
|
|
||||||
this.timepoints._debugName = 'Timepoints';
|
|
||||||
|
|
||||||
const retrievalFn = config.dataExchange.retrieve;
|
|
||||||
if (!_.isFunction(retrievalFn)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
retrievalFn().then(timepointData => {
|
|
||||||
console.log('Timepoint data retrieval');
|
|
||||||
console.log(timepointData);
|
|
||||||
timepointData.forEach(timepoint => {
|
|
||||||
delete timepoint._id;
|
|
||||||
this.timepoints.insert(timepoint);
|
|
||||||
});
|
|
||||||
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
storeTimepoints() {
|
|
||||||
const storeFn = config.dataExchange.store;
|
|
||||||
if (!_.isFunction(storeFn)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const timepointData = this.timepoints.find().fetch();
|
|
||||||
console.log('Preparing to store timepoints');
|
|
||||||
console.log(JSON.stringify(timepointData, null, 2));
|
|
||||||
|
|
||||||
storeFn(timepointData).then(() => {
|
|
||||||
console.log('Timepoint storage completed');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return all timepoints
|
|
||||||
all() {
|
|
||||||
return this.timepoints.find().fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return only the current timepoint
|
|
||||||
current() {
|
|
||||||
return this.timepoints.findOne({
|
|
||||||
timepointId: this.currentTimepointId
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the prior timepoint
|
|
||||||
lock() {
|
|
||||||
this.timepoints.update(current._id, {
|
|
||||||
$set: {
|
|
||||||
locked: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
prior() {
|
|
||||||
const current = this.current();
|
|
||||||
if (!current) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const latestDate = current.latestDate;
|
|
||||||
return this.timepoints.findOne({
|
|
||||||
latestDate: {
|
|
||||||
$lt: latestDate
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
sort: {
|
|
||||||
latestDate: -1
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return only the current and prior Timepoints
|
|
||||||
currentAndPrior() {
|
|
||||||
const timepoints = [];
|
|
||||||
|
|
||||||
const current = this.current();
|
|
||||||
if (current) {
|
|
||||||
timepoints.push(current);
|
|
||||||
}
|
|
||||||
|
|
||||||
const prior = this.prior();
|
|
||||||
if (current && prior && prior._id !== current._id) {
|
|
||||||
timepoints.push(prior);
|
|
||||||
}
|
|
||||||
|
|
||||||
return timepoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return only the baseline timepoint
|
|
||||||
baseline() {
|
|
||||||
return this.timepoints.findOne({
|
|
||||||
timepointType: 'baseline'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return only the key timepoints (current, prior, nadir and baseline)
|
|
||||||
key() {
|
|
||||||
// Create a new Mini Mongo Collection to store the result
|
|
||||||
const result = new Mongo.Collection(null);
|
|
||||||
|
|
||||||
// Get all the timepoints
|
|
||||||
const all = this.all();
|
|
||||||
|
|
||||||
// Iterate over each timepoint and insert the key ones in the result
|
|
||||||
_.each(all, (timepoint, index) => {
|
|
||||||
if (index < 2 || index === (all.length - 1)) {
|
|
||||||
result.insert(timepoint);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Return the resulting timepoints
|
|
||||||
return result.find().fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return only the timepoints for the given study
|
|
||||||
study(studyInstanceUid) {
|
|
||||||
// Create a new Mini Mongo Collection to store the result
|
|
||||||
const result = new Mongo.Collection(null);
|
|
||||||
|
|
||||||
// Iterate over each timepoint and insert the key ones in the result
|
|
||||||
_.each(this.all(), (timepoint, index) => {
|
|
||||||
if (_.contains(timepoint.studyInstanceUids, studyInstanceUid)) {
|
|
||||||
result.insert(timepoint);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Return the resulting timepoints
|
|
||||||
return result.find().fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the timepoint's name
|
|
||||||
name(timepoint) {
|
|
||||||
// Check if this is a Baseline timepoint, if it is, return 'Baseline'
|
|
||||||
if (timepoint.timepointType === 'baseline') {
|
|
||||||
return 'Baseline';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Retrieve all of the relevant follow-up timepoints for this patient
|
|
||||||
var followupTimepoints = this.timepoints.find({
|
|
||||||
patientId: timepoint.patientId,
|
|
||||||
timepointType: timepoint.timepointType
|
|
||||||
}, {
|
|
||||||
sort: {
|
|
||||||
latestDate: 1
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create an array of just timepointIds, so we can use indexOf
|
|
||||||
// on it to find the current timepoint's relative position
|
|
||||||
var followupTimepointIds = followupTimepoints.map(function(timepoint) {
|
|
||||||
return timepoint.timepointId;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Calculate the index of the current timepoint in the array of all
|
|
||||||
// relevant follow-up timepoints
|
|
||||||
var index = followupTimepointIds.indexOf(timepoint.timepointId) + 1;
|
|
||||||
|
|
||||||
// If index is 0, it means that the current timepoint was not in the list
|
|
||||||
// Log a warning and return here
|
|
||||||
if (!index) {
|
|
||||||
log.warn('Current follow-up was not in the list of relevant follow-ups?');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the timepoint name as 'Follow-up N'
|
|
||||||
return 'Follow-up ' + index;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build the timepoint title based on its date
|
|
||||||
title(timepoint) {
|
|
||||||
const timepointName = this.name(timepoint);
|
|
||||||
|
|
||||||
const all = this.all();
|
|
||||||
let index = -1;
|
|
||||||
_.each(all, (currentTimepoint, currentIndex) => {
|
|
||||||
if (currentTimepoint.timepointId === timepoint.timepointId) {
|
|
||||||
index = currentIndex;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const states = {
|
|
||||||
0: '(Current)',
|
|
||||||
1: '(Prior)'
|
|
||||||
};
|
|
||||||
// TODO: [design] find out how to define the nadir timepoint
|
|
||||||
const parenthesis = states[index] || '';
|
|
||||||
return `${timepointName} ${parenthesis}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
class TimepointApi {
|
||||||
|
static setConfiguration(config) {
|
||||||
|
configuration = config;
|
||||||
|
}
|
||||||
|
|
||||||
|
static getConfiguration() {
|
||||||
|
return configuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(currentTimepointId, configuration) {
|
||||||
|
if (currentTimepointId) {
|
||||||
|
this.currentTimepointId = currentTimepointId;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.config = configuration || MeasurementApi.getConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
retrieveTimepoints() {
|
||||||
|
this.timepoints = new Mongo.Collection(null);
|
||||||
|
this.timepoints.attachSchema(TimepointSchema);
|
||||||
|
this.timepoints._debugName = 'Timepoints';
|
||||||
|
|
||||||
|
const retrievalFn = this.config.dataExchange.retrieve;
|
||||||
|
if (!_.isFunction(retrievalFn)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
retrievalFn().then(timepointData => {
|
||||||
|
console.log('Timepoint data retrieval');
|
||||||
|
console.log(timepointData);
|
||||||
|
timepointData.forEach(timepoint => {
|
||||||
|
delete timepoint._id;
|
||||||
|
this.timepoints.insert(timepoint);
|
||||||
|
});
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
storeTimepoints() {
|
||||||
|
const storeFn = this.config.dataExchange.store;
|
||||||
|
if (!_.isFunction(storeFn)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const timepointData = this.timepoints.find().fetch();
|
||||||
|
console.log('Preparing to store timepoints');
|
||||||
|
console.log(JSON.stringify(timepointData, null, 2));
|
||||||
|
|
||||||
|
storeFn(timepointData).then(() => {
|
||||||
|
console.log('Timepoint storage completed');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return all timepoints
|
||||||
|
all() {
|
||||||
|
return this.timepoints.find().fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return only the current timepoint
|
||||||
|
current() {
|
||||||
|
return this.timepoints.findOne({
|
||||||
|
timepointId: this.currentTimepointId
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the prior timepoint
|
||||||
|
lock() {
|
||||||
|
this.timepoints.update(current._id, {
|
||||||
|
$set: {
|
||||||
|
locked: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
prior() {
|
||||||
|
const current = this.current();
|
||||||
|
if (!current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const latestDate = current.latestDate;
|
||||||
|
return this.timepoints.findOne({
|
||||||
|
latestDate: {
|
||||||
|
$lt: latestDate
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
sort: {
|
||||||
|
latestDate: -1
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return only the current and prior Timepoints
|
||||||
|
currentAndPrior() {
|
||||||
|
const timepoints = [];
|
||||||
|
|
||||||
|
const current = this.current();
|
||||||
|
if (current) {
|
||||||
|
timepoints.push(current);
|
||||||
|
}
|
||||||
|
|
||||||
|
const prior = this.prior();
|
||||||
|
if (current && prior && prior._id !== current._id) {
|
||||||
|
timepoints.push(prior);
|
||||||
|
}
|
||||||
|
|
||||||
|
return timepoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return only the baseline timepoint
|
||||||
|
baseline() {
|
||||||
|
return this.timepoints.findOne({
|
||||||
|
timepointType: 'baseline'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return only the key timepoints (current, prior, nadir and baseline)
|
||||||
|
key() {
|
||||||
|
// Create a new Mini Mongo Collection to store the result
|
||||||
|
const result = new Mongo.Collection(null);
|
||||||
|
|
||||||
|
// Get all the timepoints
|
||||||
|
const all = this.all();
|
||||||
|
|
||||||
|
// Iterate over each timepoint and insert the key ones in the result
|
||||||
|
_.each(all, (timepoint, index) => {
|
||||||
|
if (index < 2 || index === (all.length - 1)) {
|
||||||
|
result.insert(timepoint);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Return the resulting timepoints
|
||||||
|
return result.find().fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return only the timepoints for the given study
|
||||||
|
study(studyInstanceUid) {
|
||||||
|
// Create a new Mini Mongo Collection to store the result
|
||||||
|
const result = new Mongo.Collection(null);
|
||||||
|
|
||||||
|
// Iterate over each timepoint and insert the key ones in the result
|
||||||
|
_.each(this.all(), (timepoint, index) => {
|
||||||
|
if (_.contains(timepoint.studyInstanceUids, studyInstanceUid)) {
|
||||||
|
result.insert(timepoint);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Return the resulting timepoints
|
||||||
|
return result.find().fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the timepoint's name
|
||||||
|
name(timepoint) {
|
||||||
|
// Check if this is a Baseline timepoint, if it is, return 'Baseline'
|
||||||
|
if (timepoint.timepointType === 'baseline') {
|
||||||
|
return 'Baseline';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve all of the relevant follow-up timepoints for this patient
|
||||||
|
var followupTimepoints = this.timepoints.find({
|
||||||
|
patientId: timepoint.patientId,
|
||||||
|
timepointType: timepoint.timepointType
|
||||||
|
}, {
|
||||||
|
sort: {
|
||||||
|
latestDate: 1
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create an array of just timepointIds, so we can use indexOf
|
||||||
|
// on it to find the current timepoint's relative position
|
||||||
|
var followupTimepointIds = followupTimepoints.map(function(timepoint) {
|
||||||
|
return timepoint.timepointId;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Calculate the index of the current timepoint in the array of all
|
||||||
|
// relevant follow-up timepoints
|
||||||
|
var index = followupTimepointIds.indexOf(timepoint.timepointId) + 1;
|
||||||
|
|
||||||
|
// If index is 0, it means that the current timepoint was not in the list
|
||||||
|
// Log a warning and return here
|
||||||
|
if (!index) {
|
||||||
|
log.warn('Current follow-up was not in the list of relevant follow-ups?');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the timepoint name as 'Follow-up N'
|
||||||
|
return 'Follow-up ' + index;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build the timepoint title based on its date
|
||||||
|
title(timepoint) {
|
||||||
|
const timepointName = this.name(timepoint);
|
||||||
|
|
||||||
|
const all = this.all();
|
||||||
|
let index = -1;
|
||||||
|
_.each(all, (currentTimepoint, currentIndex) => {
|
||||||
|
if (currentTimepoint.timepointId === timepoint.timepointId) {
|
||||||
|
index = currentIndex;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const states = {
|
||||||
|
0: '(Current)',
|
||||||
|
1: '(Prior)'
|
||||||
|
};
|
||||||
|
// TODO: [design] find out how to define the nadir timepoint
|
||||||
|
const parenthesis = states[index] || '';
|
||||||
|
return `${timepointName} ${parenthesis}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TimepointApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TimepointsConfiguration = {
|
OHIF.measurements.TimepointApi = TimepointApi;
|
||||||
setConfiguration: setConfiguration,
|
|
||||||
getConfiguration: getConfiguration,
|
|
||||||
getTimepointsApi: getTimepointsApi
|
|
||||||
};
|
|
||||||
|
|||||||
@ -1,7 +1,3 @@
|
|||||||
import { MeasurementsConfiguration } from 'meteor/ohif:measurements/both/configuration/measurements';
|
|
||||||
|
|
||||||
const config = MeasurementsConfiguration.getConfiguration();
|
|
||||||
|
|
||||||
Template.caseProgress.onCreated(() => {
|
Template.caseProgress.onCreated(() => {
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { MeasurementsConfiguration } from 'meteor/ohif:measurements/both/configuration/measurements';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
|
|
||||||
Template.measurementTableTimepointCell.helpers({
|
Template.measurementTableTimepointCell.helpers({
|
||||||
hasDataAtThisTimepoint() {
|
hasDataAtThisTimepoint() {
|
||||||
@ -9,14 +9,14 @@ Template.measurementTableTimepointCell.helpers({
|
|||||||
|
|
||||||
if (this.timepointId) {
|
if (this.timepointId) {
|
||||||
const dataAtThisTimepoint = _.where(rowItem.entries, {timepointId: this.timepointId});
|
const dataAtThisTimepoint = _.where(rowItem.entries, {timepointId: this.timepointId});
|
||||||
return dataAtThisTimepoint.length > 0;
|
return dataAtThisTimepoint.length > 0;
|
||||||
} else {
|
} else {
|
||||||
return rowItem.entries.length > 0;
|
return rowItem.entries.length > 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
displayData() {
|
displayData() {
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
|
|
||||||
const rowItem = instance.data.rowItem;
|
const rowItem = instance.data.rowItem;
|
||||||
let data;
|
let data;
|
||||||
if (this.timepointId) {
|
if (this.timepointId) {
|
||||||
@ -29,7 +29,7 @@ Template.measurementTableTimepointCell.helpers({
|
|||||||
data = rowItem.entries[0];
|
data = rowItem.entries[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = MeasurementsConfiguration.getConfiguration();
|
const config = OHIF.measurements.MeasurementApi.getConfiguration();
|
||||||
const measurementTools = config.measurementTools;
|
const measurementTools = config.measurementTools;
|
||||||
|
|
||||||
const tool = _.where(measurementTools, {id: rowItem.measurementTypeId})[0];
|
const tool = _.where(measurementTools, {id: rowItem.measurementTypeId})[0];
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { MeasurementsConfiguration } from 'meteor/ohif:measurements/both/configuration/measurements';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
|
|
||||||
Template.measurementTableView.helpers({
|
Template.measurementTableView.helpers({
|
||||||
isFollowup() {
|
isFollowup() {
|
||||||
@ -11,7 +11,7 @@ Template.measurementTableView.helpers({
|
|||||||
const api = Template.instance().data.measurementApi;
|
const api = Template.instance().data.measurementApi;
|
||||||
const Collection = api[measurementTypeId];
|
const Collection = api[measurementTypeId];
|
||||||
const data = Collection.find().fetch();
|
const data = Collection.find().fetch();
|
||||||
|
|
||||||
const groupObject = _.groupBy(data, entry => { return entry.measurementNumber });
|
const groupObject = _.groupBy(data, entry => { return entry.measurementNumber });
|
||||||
|
|
||||||
return Object.keys(groupObject).map(key => {
|
return Object.keys(groupObject).map(key => {
|
||||||
@ -33,7 +33,7 @@ Template.measurementTableView.helpers({
|
|||||||
|
|
||||||
const api = instance.data.measurementApi;
|
const api = instance.data.measurementApi;
|
||||||
|
|
||||||
const config = MeasurementsConfiguration.getConfiguration();
|
const config = OHIF.measurements.MeasurementApi.getConfiguration();
|
||||||
const measurementTools = config.measurementTools;
|
const measurementTools = config.measurementTools;
|
||||||
|
|
||||||
// If this is a baseline, stop here since there are no new measurements to display
|
// If this is a baseline, stop here since there are no new measurements to display
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import { MeasurementsConfiguration } from 'meteor/ohif:measurements/both/configuration/measurements';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
|
|
||||||
Template.registerHelper('measurementConfiguration', () => {
|
Template.registerHelper('measurementConfiguration', () => {
|
||||||
//console.log('helper:measurementTools');
|
//console.log('helper:measurementTools');
|
||||||
if (!MeasurementsConfiguration) {
|
if (!OHIF.measurements.MeasurementApi) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = MeasurementsConfiguration.getConfiguration();
|
const config = OHIF.measurements.MeasurementApi.getConfiguration();
|
||||||
return config;
|
return config;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { MeasurementsConfiguration } from 'meteor/ohif:measurements/both/configuration/measurements';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
import { MeasurementManager } from 'meteor/ohif:measurements/client/lib/MeasurementManager';
|
import { MeasurementManager } from 'meteor/ohif:measurements/client/lib/MeasurementManager';
|
||||||
|
|
||||||
let MeasurementHandlers = {};
|
let MeasurementHandlers = {};
|
||||||
@ -6,7 +6,7 @@ let MeasurementHandlers = {};
|
|||||||
MeasurementHandlers.onAdded = (e, instance, eventData) => {
|
MeasurementHandlers.onAdded = (e, instance, eventData) => {
|
||||||
const measurementData = eventData.measurementData;
|
const measurementData = eventData.measurementData;
|
||||||
|
|
||||||
const config = MeasurementsConfiguration.getConfiguration();
|
const config = OHIF.measurements.MeasurementApi.getConfiguration();
|
||||||
const toolTypes = config.measurementTools.map(tool => {
|
const toolTypes = config.measurementTools.map(tool => {
|
||||||
return tool.cornerstoneToolType;
|
return tool.cornerstoneToolType;
|
||||||
});
|
});
|
||||||
@ -63,7 +63,7 @@ MeasurementHandlers.onAdded = (e, instance, eventData) => {
|
|||||||
const numCurrentMeasurementsInStudy = Collection.find({
|
const numCurrentMeasurementsInStudy = Collection.find({
|
||||||
studyInstanceUid: study.studyInstanceUid
|
studyInstanceUid: study.studyInstanceUid
|
||||||
}).count();
|
}).count();
|
||||||
measurement.measurementNumber = numCurrentMeasurementsInStudy + 1;
|
measurement.measurementNumber = numCurrentMeasurementsInStudy + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean the measurement according to the Schema
|
// Clean the measurement according to the Schema
|
||||||
@ -76,7 +76,7 @@ MeasurementHandlers.onAdded = (e, instance, eventData) => {
|
|||||||
MeasurementHandlers.onModified = (e, instance, eventData) => {
|
MeasurementHandlers.onModified = (e, instance, eventData) => {
|
||||||
const measurementData = eventData.measurementData;
|
const measurementData = eventData.measurementData;
|
||||||
|
|
||||||
const config = MeasurementsConfiguration.getConfiguration();
|
const config = MeasurementApi.getConfiguration();
|
||||||
const toolTypes = config.measurementTools.map(tool => {
|
const toolTypes = config.measurementTools.map(tool => {
|
||||||
return tool.cornerstoneToolType;
|
return tool.cornerstoneToolType;
|
||||||
});
|
});
|
||||||
@ -131,7 +131,7 @@ MeasurementHandlers.onModified = (e, instance, eventData) => {
|
|||||||
MeasurementHandlers.onRemoved = (e, instance, eventData) => {
|
MeasurementHandlers.onRemoved = (e, instance, eventData) => {
|
||||||
const measurementData = eventData.measurementData;
|
const measurementData = eventData.measurementData;
|
||||||
|
|
||||||
const config = MeasurementsConfiguration.getConfiguration();
|
const config = OHIF.measurements.MeasurementApi.getConfiguration();
|
||||||
const toolTypes = config.measurementTools.map(tool => {
|
const toolTypes = config.measurementTools.map(tool => {
|
||||||
return tool.cornerstoneToolType;
|
return tool.cornerstoneToolType;
|
||||||
});
|
});
|
||||||
@ -150,4 +150,4 @@ MeasurementHandlers.onRemoved = (e, instance, eventData) => {
|
|||||||
Collection.remove(measurementData.id);
|
Collection.remove(measurementData.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
export { MeasurementHandlers };
|
export { MeasurementHandlers };
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { MeasurementsConfiguration } from 'meteor/ohif:measurements/both/configuration/measurements';
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
|
|
||||||
export clearTools = () => {
|
export const clearTools = () => {
|
||||||
const config = MeasurementsConfiguration.getConfiguration();
|
const config = OHIF.measurements.MeasurementApi.getConfiguration();
|
||||||
const toolTypes = config.measurementTools.map(tool => {
|
const toolTypes = config.measurementTools.map(tool => {
|
||||||
return tool.cornerstoneToolType;
|
return tool.cornerstoneToolType;
|
||||||
});
|
});
|
||||||
@ -20,7 +20,7 @@ export clearTools = () => {
|
|||||||
if (!series) {
|
if (!series) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
seriesInstanceUids.push(series.seriesInstanceUid);
|
seriesInstanceUids.push(series.seriesInstanceUid);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -39,7 +39,6 @@ export clearTools = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (seriesInstanceUids.indexOf(series.seriesInstanceUid) === -1) {
|
if (seriesInstanceUids.indexOf(series.seriesInstanceUid) === -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,6 +116,4 @@ Package.onUse(function(api) {
|
|||||||
api.addFiles('client/lib/getTimepointObject.js', 'client');
|
api.addFiles('client/lib/getTimepointObject.js', 'client');
|
||||||
|
|
||||||
api.export('MeasurementSchemaTypes', ['client', 'server']);
|
api.export('MeasurementSchemaTypes', ['client', 'server']);
|
||||||
api.export('MeasurementsConfiguration', ['client', 'server']);
|
|
||||||
api.export('TimepointsConfiguration', ['client', 'server']);
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,17 +1,17 @@
|
|||||||
|
import { OHIF } from 'meteor/ohif:core';
|
||||||
|
|
||||||
import { measurementTools } from './measurementTools';
|
import { measurementTools } from './measurementTools';
|
||||||
import { retrieveMeasurements, storeMeasurements } from './dataExchange';
|
import { retrieveMeasurements, storeMeasurements } from './dataExchange';
|
||||||
import { validateMeasurements } from './dataValidation';
|
import { validateMeasurements } from './dataValidation';
|
||||||
|
|
||||||
import { MeasurementsConfiguration } from 'meteor/ohif:measurements/both/configuration/measurements';
|
|
||||||
|
|
||||||
console.log('OHIF-PET SUV: Defining Configuration for Measurements');
|
console.log('OHIF-PET SUV: Defining Configuration for Measurements');
|
||||||
MeasurementsConfiguration.setConfiguration({
|
OHIF.measurements.MeasurementApi.setConfiguration({
|
||||||
measurementTools: measurementTools,
|
measurementTools: measurementTools,
|
||||||
dataExchange: {
|
dataExchange: {
|
||||||
retrieve: retrieveMeasurements,
|
retrieve: retrieveMeasurements,
|
||||||
store: storeMeasurements
|
store: storeMeasurements
|
||||||
},
|
},
|
||||||
dataValidation: {
|
dataValidation: {
|
||||||
validation: validateMeasurements
|
validation: validateMeasurements
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user