LT-275: Retrieving timepoint associations properly from backend
This commit is contained in:
parent
2d291251e9
commit
60b72683d5
@ -63,7 +63,13 @@ Template.viewer.onCreated(() => {
|
||||
});
|
||||
|
||||
instance.data.timepointApi = new OHIF.measurements.TimepointApi(instance.data.currentTimepointId);
|
||||
const timepointsPromise = instance.data.timepointApi.retrieveTimepoints();
|
||||
|
||||
const patientId = instance.data.studies[0].patientId;
|
||||
const filter = {
|
||||
'patientId': patientId
|
||||
};
|
||||
|
||||
const timepointsPromise = instance.data.timepointApi.retrieveTimepoints(filter);
|
||||
timepointsPromise.then(() => {
|
||||
const timepoints = instance.data.timepointApi.all();
|
||||
|
||||
@ -85,7 +91,7 @@ Template.viewer.onCreated(() => {
|
||||
});
|
||||
|
||||
instance.data.measurementApi = new OHIF.measurements.MeasurementApi(instance.data.currentTimepointId);
|
||||
const measurementsPromise = instance.data.measurementApi.retrieveMeasurements();
|
||||
const measurementsPromise = instance.data.measurementApi.retrieveMeasurements(filter);
|
||||
measurementsPromise.then(() => {
|
||||
Session.set('MeasurementsReady', true);
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
@import "{design}/app"
|
||||
|
||||
$height = 25px
|
||||
$textColorButtonActive = #2D2D2D
|
||||
|
||||
.roundedButtonGroup
|
||||
|
||||
@ -64,7 +63,7 @@ $textColorButtonActive = #2D2D2D
|
||||
&.active .roundedButton
|
||||
theme('background-color', '$activeColor')
|
||||
theme('border-color', '$uiBorderColorActive')
|
||||
color: $textColorButtonActive
|
||||
theme('color', '$uiGrayDark')
|
||||
|
||||
&:hover .roundedButton
|
||||
&.active .roundedButton
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { measurementTools } from './measurementTools';
|
||||
|
||||
export const retrieveMeasurements = () => {
|
||||
export const retrieveMeasurements = (filter) => {
|
||||
console.log('retrieveMeasurements');
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('retrieveMeasurements', (error, response) => {
|
||||
Meteor.call('retrieveMeasurements', filter, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
@ -36,11 +36,11 @@ export const storeMeasurements = (measurementData) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const retrieveTimepoints = () => {
|
||||
export const retrieveTimepoints = (filter) => {
|
||||
console.log('retrieveTimepoints');
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('retrieveTimepoints', (error, response) => {
|
||||
Meteor.call('retrieveTimepoints', filter, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
|
||||
@ -37,9 +37,9 @@ Meteor.methods({
|
||||
});
|
||||
},
|
||||
|
||||
retrieveTimepoints() {
|
||||
retrieveTimepoints(filter = {}) {
|
||||
OHIF.log.info('Retrieving Timepoints from the Server');
|
||||
return Timepoints.find().fetch();
|
||||
return Timepoints.find(filter).fetch();
|
||||
},
|
||||
|
||||
storeMeasurements(measurementData) {
|
||||
@ -60,12 +60,13 @@ Meteor.methods({
|
||||
});
|
||||
},
|
||||
|
||||
retrieveMeasurements() {
|
||||
retrieveMeasurements(filter = {}) {
|
||||
OHIF.log.info('Retrieving Measurements from the Server');
|
||||
let measurementData = {};
|
||||
|
||||
|
||||
measurementTools.forEach(tool => {
|
||||
measurementData[tool.id] = MeasurementCollections[tool.id].find().fetch();
|
||||
measurementData[tool.id] = MeasurementCollections[tool.id].find(filter).fetch();
|
||||
});
|
||||
|
||||
return measurementData;
|
||||
|
||||
@ -33,6 +33,10 @@ Template.measurementTableTimepointCell.helpers({
|
||||
const measurementTools = config.measurementTools;
|
||||
|
||||
const tool = _.where(measurementTools, {id: rowItem.measurementTypeId})[0];
|
||||
if (!tool) {
|
||||
// TODO: Figure out what is going on here?
|
||||
console.warn('Something went wrong?');
|
||||
}
|
||||
const displayFunction = tool.options.measurementTableOptions.displayFunction;
|
||||
return displayFunction(data);
|
||||
}
|
||||
|
||||
@ -12,9 +12,6 @@ Template.imageThumbnail.onRendered(() => {
|
||||
// Disable cornerstone for thumbnail element and remove its canvas
|
||||
cornerstone.disable(element);
|
||||
|
||||
// Enable cornerstone for thumbnail element again creating a new canvas
|
||||
cornerstone.enable(element);
|
||||
|
||||
// Get the image ID
|
||||
const stack = instance.data.thumbnail.stack;
|
||||
const thumbnailIndex = instance.data.thumbnail.thumbnailIndex;
|
||||
@ -29,6 +26,9 @@ Template.imageThumbnail.onRendered(() => {
|
||||
|
||||
// Define a handler for success on image load
|
||||
const loadSuccess = image => {
|
||||
// Enable cornerstone for thumbnail element again creating a new canvas
|
||||
cornerstone.enable(element);
|
||||
|
||||
cornerstone.displayImage(element, image);
|
||||
delete ThumbnailLoading[thumbnailIndex];
|
||||
$loading.css('display', 'none');
|
||||
@ -52,7 +52,7 @@ Template.imageThumbnail.onRendered(() => {
|
||||
instance.data.currentStudy.dep.depend();
|
||||
}
|
||||
|
||||
// Wait for the new data and reresh the image thumbnail
|
||||
// Wait for the new data and refresh the image thumbnail
|
||||
Tracker.afterFlush(() => {
|
||||
instance.refreshImage();
|
||||
});
|
||||
|
||||
@ -13,14 +13,20 @@ Template.studySeriesQuickSwitch.onCreated(() => {
|
||||
// Gets the current viewport data
|
||||
const viewportIndex = instance.data.viewportIndex;
|
||||
const viewportData = instance.getViewportData(viewportIndex);
|
||||
if (!viewportData) {
|
||||
return;
|
||||
|
||||
let study;
|
||||
if (viewportData) {
|
||||
// Finds the current study and return it
|
||||
study = ViewerStudies.findOne({
|
||||
studyInstanceUid: viewportData.studyInstanceUid
|
||||
});
|
||||
} else {
|
||||
study = ViewerStudies.findOne();
|
||||
}
|
||||
|
||||
// Finds the current study and return it
|
||||
const study = ViewerStudies.findOne({
|
||||
studyInstanceUid: viewportData.studyInstanceUid
|
||||
});
|
||||
if (!study) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Change the current study to update the thumbnails
|
||||
instance.data.currentStudy.set(study);
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
|
||||
Template.studyTimepoint.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
|
||||
Template.studyTimepointBrowser.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user