Adding studies and timepoints to quickSwitch
This commit is contained in:
1 parent
0417bbd0ff
commit
89f6bd4610
15 files changed
+204
-34
No files matched your search
@@ -1,7 +1,9 @@
|
||||
import './list.html';
|
||||
import './list.styl';
|
||||
import './item.html';
|
||||
import './item.js';
|
||||
import './list.html';
|
||||
import './list.styl';
|
||||
import './quickSwitch.html';
|
||||
import './quickSwitch.js';
|
||||
import './series.html';
|
||||
import './series.js';
|
||||
import './sidebar.html';
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<template name="studyBrowserQuickSwitch">
|
||||
{{>studyBrowserList studyBrowserData}}
|
||||
</template>
|
||||
@@ -0,0 +1,43 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { ReactiveVar } from 'meteor/reactive-var';
|
||||
import { Tracker } from 'meteor/tracker';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
Template.studyBrowserQuickSwitch.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
instance.studiesInformation = new ReactiveVar();
|
||||
const filter = { studyInstanceUid: OHIF.viewer.data.studyInstanceUids };
|
||||
OHIF.studies.searchStudies(filter).then(studies => instance.studiesInformation.set(studies));
|
||||
});
|
||||
|
||||
Template.studyBrowserQuickSwitch.onRendered(() => {
|
||||
const instance = Template.instance();
|
||||
instance.autorun(() => {
|
||||
instance.studiesInformation.dep.depend();
|
||||
const currentStudy = instance.data.currentStudy.get();
|
||||
const studyInstanceUid = (currentStudy && currentStudy.studyInstanceUid) || '';
|
||||
Tracker.afterFlush(() => {
|
||||
const $studyBrowserItems = instance.$('.study-browser-item');
|
||||
$studyBrowserItems.removeClass('active');
|
||||
$studyBrowserItems.filter(`[data-uid="${studyInstanceUid}"]`).addClass('active');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Template.studyBrowserQuickSwitch.events({
|
||||
'ohif.studies.study.click'(event, instance, studyInformation) {
|
||||
const { studyInstanceUid } = studyInformation;
|
||||
const study = OHIF.viewer.Studies.findBy({ studyInstanceUid });
|
||||
instance.data.currentStudy.set(study);
|
||||
const $studySwitch = $(event.currentTarget).closest('.study-switch');
|
||||
$studySwitch.siblings('.series-switch').trigger('rescale');
|
||||
}
|
||||
});
|
||||
|
||||
Template.studyBrowserQuickSwitch.helpers({
|
||||
studyBrowserData() {
|
||||
const instance = Template.instance();
|
||||
const studiesInformation = instance.studiesInformation.get();
|
||||
return { studiesInformation };
|
||||
}
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
<template name="studyBrowserSidebar">
|
||||
{{#scrollArea class='full-height' class='fit' scrollableClass='p-a-1' scrollStep=191}}
|
||||
{{#scrollArea class='fit' scrollableClass='p-a-1' scrollStep=191}}
|
||||
{{>studyBrowserList (clone this studyChildTemplate='studyBrowserSeries')}}
|
||||
{{/scrollArea}}
|
||||
</template>
|
||||
@@ -1,18 +1,29 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
const studySearchPromises = new Map();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
});
|
||||
});
|
||||
OHIF.studies.searchStudies = filter => {
|
||||
const promiseKey = JSON.stringify(filter);
|
||||
if (studySearchPromises.has(promiseKey)) {
|
||||
return studySearchPromises.get(promiseKey);
|
||||
} else {
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
Meteor.call('StudyListSearch', filter, (error, studiesData) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(studiesData);
|
||||
}
|
||||
});
|
||||
});
|
||||
studySearchPromises.set(promiseKey, promise);
|
||||
return promise;
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user