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,10 +1,9 @@
|
|||||||
|
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 = {
|
||||||
@ -12,7 +11,7 @@ const newMeasurementTool = {
|
|||||||
name: 'New Lesions'
|
name: 'New Lesions'
|
||||||
};
|
};
|
||||||
|
|
||||||
MeasurementsConfiguration.setConfiguration({
|
OHIF.measurements.MeasurementApi.setConfiguration({
|
||||||
measurementTools: measurementTools,
|
measurementTools: measurementTools,
|
||||||
newMeasurementTool: newMeasurementTool,
|
newMeasurementTool: newMeasurementTool,
|
||||||
dataExchange: {
|
dataExchange: {
|
||||||
@ -24,7 +23,7 @@ MeasurementsConfiguration.setConfiguration({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
TimepointsConfiguration.setConfiguration({
|
OHIF.measurements.TimepointApi.setConfiguration({
|
||||||
dataExchange: {
|
dataExchange: {
|
||||||
retrieve: retrieveTimepoints,
|
retrieve: retrieveTimepoints,
|
||||||
store: storeTimepoints
|
store: storeTimepoints
|
||||||
|
|||||||
@ -4,7 +4,7 @@ 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 {
|
||||||
@ -26,7 +26,7 @@ export const storeMeasurements = (measurementData) => {
|
|||||||
// 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 {
|
||||||
@ -40,7 +40,7 @@ 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 {
|
||||||
@ -55,7 +55,7 @@ export const storeTimepoints = (timepointData) => {
|
|||||||
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 {
|
||||||
|
|||||||
@ -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();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,22 +1,32 @@
|
|||||||
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(currentTimepointId, configuration) {
|
||||||
if (currentTimepointId) {
|
if (currentTimepointId) {
|
||||||
this.currentTimepointId = currentTimepointId;
|
this.currentTimepointId = currentTimepointId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.config = configuration || MeasurementApi.getConfiguration();
|
||||||
|
|
||||||
|
this.config.measurementTools.forEach(tool => {
|
||||||
|
const measurementTypeId = tool.id;
|
||||||
|
|
||||||
|
this[measurementTypeId] = new Mongo.Collection(null);
|
||||||
|
this[measurementTypeId].attachSchema(tool.schema);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
retrieveMeasurements(timepointId) {
|
retrieveMeasurements(timepointId) {
|
||||||
@ -24,13 +34,15 @@ function getMeasurementsApi() {
|
|||||||
timepointId = this.currentTimepointId;
|
timepointId = this.currentTimepointId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const retrievalFn = config.dataExchange.retrieve;
|
const retrievalFn = this.config.dataExchange.retrieve;
|
||||||
if (!_.isFunction(retrievalFn)) {
|
if (!_.isFunction(retrievalFn)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
retrievalFn().then(measurementData => {
|
retrievalFn().then(measurementData => {
|
||||||
|
// TODO: implement converter here
|
||||||
|
|
||||||
console.log('Measurement data retrieval');
|
console.log('Measurement data retrieval');
|
||||||
console.log(measurementData);
|
console.log(measurementData);
|
||||||
|
|
||||||
@ -40,7 +52,7 @@ function getMeasurementsApi() {
|
|||||||
measurements.forEach(measurement => {
|
measurements.forEach(measurement => {
|
||||||
delete measurement._id;
|
delete measurement._id;
|
||||||
this[measurementTypeId].insert(measurement);
|
this[measurementTypeId].insert(measurement);
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
@ -49,13 +61,13 @@ function getMeasurementsApi() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
});
|
});
|
||||||
@ -66,29 +78,22 @@ function getMeasurementsApi() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
MeasurementApi.prototype[measurementTypeId] = new Mongo.Collection(null);
|
|
||||||
MeasurementApi.prototype[measurementTypeId].attachSchema(tool.schema);
|
|
||||||
|
|
||||||
MeasurementApi.prototype.fetch = (measurementTypeId, selector, options) => {
|
|
||||||
if (!this[measurementTypeId]) {
|
if (!this[measurementTypeId]) {
|
||||||
throw 'MeasurementApi: No Collection with the id: ' + measurementTypeId;
|
throw 'MeasurementApi: No Collection with the id: ' + measurementTypeId;
|
||||||
}
|
}
|
||||||
@ -96,14 +101,7 @@ function getMeasurementsApi() {
|
|||||||
selector = selector || {};
|
selector = selector || {};
|
||||||
options = options || {};
|
options = options || {};
|
||||||
return this[measurementTypeId].find(selector, options).fetch();
|
return this[measurementTypeId].find(selector, options).fetch();
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
|
||||||
return MeasurementApi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MeasurementsConfiguration = {
|
OHIF.measurements.MeasurementApi = MeasurementApi;
|
||||||
setConfiguration: setConfiguration,
|
|
||||||
getConfiguration: getConfiguration,
|
|
||||||
getMeasurementsApi: getMeasurementsApi
|
|
||||||
};
|
|
||||||
|
|||||||
@ -1,25 +1,27 @@
|
|||||||
|
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) {
|
class TimepointApi {
|
||||||
Configuration = config;
|
static setConfiguration(config) {
|
||||||
}
|
configuration = config;
|
||||||
|
}
|
||||||
|
|
||||||
function getConfiguration() {
|
static getConfiguration() {
|
||||||
return Configuration;
|
return configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constructor(currentTimepointId, configuration) {
|
||||||
function getTimepointsApi() {
|
|
||||||
console.log('OHIF-Measurements: Defining TimepointsApi');
|
|
||||||
const config = Configuration;
|
|
||||||
|
|
||||||
class TimepointApi {
|
|
||||||
constructor(currentTimepointId) {
|
|
||||||
if (currentTimepointId) {
|
if (currentTimepointId) {
|
||||||
this.currentTimepointId = currentTimepointId;
|
this.currentTimepointId = currentTimepointId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.config = configuration || MeasurementApi.getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
retrieveTimepoints() {
|
retrieveTimepoints() {
|
||||||
@ -27,7 +29,7 @@ function getTimepointsApi() {
|
|||||||
this.timepoints.attachSchema(TimepointSchema);
|
this.timepoints.attachSchema(TimepointSchema);
|
||||||
this.timepoints._debugName = 'Timepoints';
|
this.timepoints._debugName = 'Timepoints';
|
||||||
|
|
||||||
const retrievalFn = config.dataExchange.retrieve;
|
const retrievalFn = this.config.dataExchange.retrieve;
|
||||||
if (!_.isFunction(retrievalFn)) {
|
if (!_.isFunction(retrievalFn)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -47,7 +49,7 @@ function getTimepointsApi() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
storeTimepoints() {
|
storeTimepoints() {
|
||||||
const storeFn = config.dataExchange.store;
|
const storeFn = this.config.dataExchange.store;
|
||||||
if (!_.isFunction(storeFn)) {
|
if (!_.isFunction(storeFn)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -218,13 +220,6 @@ function getTimepointsApi() {
|
|||||||
return `${timepointName} ${parenthesis}`;
|
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() {
|
||||||
@ -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() {
|
||||||
@ -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;
|
||||||
});
|
});
|
||||||
@ -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;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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;
|
||||||
});
|
});
|
||||||
@ -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,11 +1,11 @@
|
|||||||
|
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,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user