* NOTASK: PoC for loading data from Healthcare API * NOTASK: PoC for loading data from Healthcare API fix * Add sample dialog for loading test dicom-picker * Fix incorrect promise resolving * NOTASK: PoC for loading dicom store * Add web-components as git submodules. (Probably will be changed later) * Add rough dicomStore picker * Add dataset selector * NOTASK: QIDO metadata first draft * NOTASK: Not Implemented error for color images * NOTASK: clean-up * Dicom files uploader intermediate version * NOTASK: Accept header * NOTASK: docker configs * NOTASK: fix * NOTASK: howTo * Add draft of DICOM uploader * Add missing files * Fix error with missing clientId * Update submodule * NOTASK: HowTo * NOTASK: config for dev * NOTASK: new docker file * clean-up * Update GCP web-components * Add integration with async web components * Fix errors in nginx.conf * Structured reports views basic implementation * NOTASK: qido -> wado * NOTASK: config fix * NOTASK: dirty copy-paste implementation * Add "Change dicom store" button. Add an ability to clear date. Fix bug, when OAuth dosn't work if URL is not / * Fix studylist filtering * Fix dockerfile * NOTASK: meteor update * NOTASK: fix of package structure * NOTASK: merge fix * improvements Move check for now SR into SR modal Use simple button to open SR modal Remove button styling cleanup * copy SR data retrieval to wado * make search of SR simpler * Codestyle fix * NOTASK: palette color error message * Fix date filter. Fix server settings on first loading. Add SR and PS buttons * NOTASK: PS is now hidden by default * NOTASK: dirty solution * NOTASK: new wadoimage lib version * Fix PS and SR buttons * Make modal dialogs vertically centered * Update web components. Quick UI fixes * Add missing files to the previous commit * NOTASK: show-hide for PS * NOTASK: show-hide for PS * NOTASK: fix of min-max PixelValue bug * Add "sign out" functionality for Google OAuth. Update web-components. * intermediate commit * Add demo signin page * Beautifying demo sign in page * NOTASK: merge * NOTASK: clean-up * Use npm for getting healthcare-api-adapter instead of git submodule. * NOTASK: clean-up * meteor update * clean-up * clean-up * Clean up code * Update healthcare-api-adapter version. Add location to dicom store path. Fix buttons style. * Downgrade meteor and packages to master version. Use meteor-build-client-fixed2
132 lines
4.5 KiB
JavaScript
132 lines
4.5 KiB
JavaScript
import { OHIF } from 'meteor/ohif:core';
|
|
import { Session } from 'meteor/session';
|
|
import { configureApis } from './configuration/configuration'
|
|
|
|
class MeasurementTable {
|
|
constructor() {
|
|
configureApis();
|
|
|
|
Session.set('TimepointsReady', false);
|
|
Session.set('MeasurementsReady', false);
|
|
}
|
|
|
|
async onCreated(instance) {
|
|
const { TimepointApi, MeasurementApi } = OHIF.measurements;
|
|
|
|
OHIF.viewer.data.currentTimepointId = 'TimepointId';
|
|
|
|
const timepointApi = new TimepointApi(OHIF.viewer.data.currentTimepointId);
|
|
const measurementApi = new MeasurementApi(timepointApi);
|
|
const apis = {
|
|
timepointApi,
|
|
measurementApi
|
|
};
|
|
|
|
Object.assign(OHIF.viewer, apis);
|
|
Object.assign(instance.data, apis);
|
|
|
|
const patientId = instance.data.studies[0].patientId;
|
|
|
|
await timepointApi.retrieveTimepoints({ patientId });
|
|
Session.set('TimepointsReady', true);
|
|
|
|
await measurementApi.retrieveMeasurements(patientId, [OHIF.viewer.data.currentTimepointId]);
|
|
Session.set('MeasurementsReady', false);
|
|
|
|
measurementApi.syncMeasurementsAndToolData();
|
|
this.jumpToFirstMeasurement();
|
|
|
|
const viewportUtils = OHIF.viewerbase.viewportUtils;
|
|
this.firstMeasurementActivated = false;
|
|
this.dataIsavalible = false;
|
|
instance.autorun(() => {
|
|
if (!Session.get('TimepointsReady') ||
|
|
!Session.get('MeasurementsReady') ||
|
|
!Session.get('ViewerReady') ||
|
|
this.firstMeasurementActivated) {
|
|
if (this.dataIsavalible) {
|
|
viewportUtils.hideTools();
|
|
this.dataIsavalible = false;
|
|
}
|
|
return;
|
|
}
|
|
if(!this.dataIsavalible){
|
|
viewportUtils.unhideTools();
|
|
this.dataIsavalible = true;
|
|
}
|
|
|
|
});
|
|
|
|
instance.measurementModifiedHandler = _.throttle((event, instance) => {
|
|
OHIF.measurements.MeasurementHandlers.onModified(event, instance);
|
|
}, 300);
|
|
}
|
|
|
|
onDestroyed() {
|
|
Session.set('TimepointsReady', false);
|
|
Session.set('MeasurementsReady', false);
|
|
}
|
|
|
|
jumpToFirstMeasurement() {
|
|
// Find and activate the first measurement by Lesion Number
|
|
// NOTE: This is inefficient, we should be using a hanging protocol
|
|
// to hang the first measurement's imageId immediately, rather
|
|
// than changing images after initial loading...
|
|
const config = OHIF.measurements.MeasurementApi.getConfiguration();
|
|
const tools = config.measurementTools[0].childTools;
|
|
const firstTool = tools[Object.keys(tools)[0]];
|
|
const measurementTypeId = firstTool.id;
|
|
|
|
const collection = OHIF.viewer.measurementApi.tools[measurementTypeId];
|
|
const sorting = {
|
|
sort: {
|
|
measurementNumber: -1
|
|
}
|
|
};
|
|
|
|
const data = collection.find({}, sorting).fetch();
|
|
|
|
// TODO: Clean this up, it's probably an inefficient way to get what we need
|
|
const groupObject = _.groupBy(data, m => m.measurementNumber);
|
|
|
|
// Reformat the data
|
|
const rows = Object.keys(groupObject).map(key => ({
|
|
measurementTypeId: measurementTypeId,
|
|
measurementNumber: key,
|
|
entries: groupObject[key]
|
|
}));
|
|
|
|
const rowItem = rows[0];
|
|
const timepoints = [
|
|
OHIF.viewer.timepointApi.current()
|
|
];
|
|
|
|
if (rowItem) {
|
|
OHIF.measurements.jumpToRowItem(rowItem, timepoints);
|
|
}
|
|
|
|
this.firstMeasurementActivated = true;
|
|
}
|
|
|
|
static measurementEvents = {
|
|
'cornerstonetoolsmeasurementadded .imageViewerViewport'(event, instance) {
|
|
const originalEvent = event.originalEvent;
|
|
OHIF.measurements.MeasurementHandlers.onAdded(originalEvent, instance);
|
|
},
|
|
|
|
'cornerstonetoolsmeasurementmodified .imageViewerViewport'(event, instance) {
|
|
const originalEvent = event.originalEvent;
|
|
instance.measurementModifiedHandler(originalEvent, instance);
|
|
},
|
|
|
|
'cornerstonemeasurementremoved .imageViewerViewport'(event, instance) {
|
|
const originalEvent = event.originalEvent;
|
|
OHIF.measurements.MeasurementHandlers.onRemoved(originalEvent, instance);
|
|
}
|
|
};
|
|
};
|
|
|
|
export {
|
|
MeasurementTable
|
|
}
|