Creating sidebar templates for studies/timepoints browsers

This commit is contained in:
Bruno Alves de Faria committed 2017-10-25 22:18:42 -02:00
1 parent d787ed2cb9
commit 3b629f9816
22 files changed
+261 -125

No files matched your search

@@ -1,2 +1,4 @@
import './loadStudy';
import './retrieveStudiesMetadata';
import './retrieveStudyMetadata';
import './searchStudies';
@@ -0,0 +1,20 @@
import { OHIF } from 'meteor/ohif:core';
/**
* Load the study metadata and store its information locally
*
* @param {String} studyInstanceUid The UID of the Study to be loaded
* @returns {Promise} that will be resolved with the study metadata or rejected with an error
*/
OHIF.studies.loadStudy = studyInstanceUid => new Promise((resolve, reject) => {
OHIF.studies.retrieveStudyMetadata(studyInstanceUid).then(study => {
// Double check to make sure this study wasn't already inserted into OHIF.viewer.Studies
// so we don't cause duplicate entry errors
const loaded = OHIF.viewer.Studies.findBy({ studyInstanceUid: study.studyInstanceUid });
if (!loaded) {
OHIF.viewer.Studies.insert(study);
}
resolve(study);
}).catch(reject);
});
@@ -0,0 +1,18 @@
import { Meteor } from 'meteor/meteor';
import { OHIF } from 'meteor/ohif:core';
/**
* Search for studies information by the given filter
*
* @param {Object} filter Filter that will be used on search
* @returns {Promise} resolved with an array of studies information or rejected with an error
*/
OHIF.studies.searchStudies = filter => new Promise((resolve, reject) => {
Meteor.call('StudyListSearch', filter, (error, studiesData) => {
if (error) {
reject(error);
} else {
resolve(studiesData);
}
});
});