2017-03-15 11:55:38 +01:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
2016-09-20 17:23:57 +02:00
|
|
|
import { OHIF } from 'meteor/ohif:core';
|
2016-08-15 15:34:36 +02:00
|
|
|
|
|
|
|
|
Meteor.startup(function() {
|
2017-03-15 11:55:38 +01:00
|
|
|
StudyList.callbacks.dblClickOnStudy = dblClickOnStudy;
|
|
|
|
|
StudyList.callbacks.middleClickOnStudy = dblClickOnStudy;
|
2016-08-15 15:34:36 +02:00
|
|
|
|
2016-09-20 17:23:57 +02:00
|
|
|
StudyList.timepointApi = new OHIF.measurements.TimepointApi();
|
2016-08-15 15:34:36 +02:00
|
|
|
StudyList.timepointApi.retrieveTimepoints();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Lesion Tracker method including Timepoints / other studies
|
|
|
|
|
*/
|
2017-03-15 11:55:38 +01:00
|
|
|
const dblClickOnStudy = data => {
|
2016-08-15 15:34:36 +02:00
|
|
|
// Find the relevant timepoint given the clicked-on study
|
|
|
|
|
const timepointApi = StudyList.timepointApi;
|
|
|
|
|
if (!timepointApi) {
|
2017-03-15 11:55:38 +01:00
|
|
|
OHIF.log.warn('No timepoint api on dbl-clicked study?');
|
2016-08-15 15:34:36 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const timepoint = timepointApi.study(data.studyInstanceUid)[0];
|
|
|
|
|
if (timepoint) {
|
2017-03-15 11:55:38 +01:00
|
|
|
OHIF.lesiontracker.openNewTabWithTimepoint(timepoint.timepointId);
|
2016-08-15 15:34:36 +02:00
|
|
|
} else {
|
2017-03-15 11:55:38 +01:00
|
|
|
openTab(data.studyInstanceUid);
|
2016-08-15 15:34:36 +02:00
|
|
|
}
|
2017-03-15 11:55:38 +01:00
|
|
|
};
|
2016-08-15 15:34:36 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Opens a study
|
|
|
|
|
*
|
|
|
|
|
* @param studyInstanceUid The UID of the Study to be opened
|
|
|
|
|
* @param title The title to be used for the tab heading
|
|
|
|
|
*/
|
2017-03-15 11:55:38 +01:00
|
|
|
const openTab = studyInstanceUid => {
|
2017-01-18 16:59:03 +01:00
|
|
|
const contentId = 'viewerTab';
|
2016-08-15 15:34:36 +02:00
|
|
|
|
|
|
|
|
ViewerData = window.ViewerData || ViewerData;
|
|
|
|
|
|
|
|
|
|
// Update the ViewerData global object
|
2017-01-18 16:59:03 +01:00
|
|
|
ViewerData[contentId] = {
|
|
|
|
|
contentId: contentId,
|
2016-11-10 02:35:08 +01:00
|
|
|
isUnassociatedStudy: true,
|
2016-08-15 15:34:36 +02:00
|
|
|
studyInstanceUids: [studyInstanceUid]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Switch to the new tab
|
2017-01-18 16:59:03 +01:00
|
|
|
switchToTab(contentId);
|
2017-03-15 11:55:38 +01:00
|
|
|
};
|