Fixed loaded study indicator. Closes LT-91

This commit is contained in:
Erik Ziegler 2016-01-11 12:01:11 +01:00
parent 90a16a8059
commit 571eb90eb8
3 changed files with 68 additions and 62 deletions

View File

@ -103,11 +103,17 @@
Meteor: true, Meteor: true,
Template: true, Template: true,
UI: true, UI: true,
Session: true,
// loglevel package // loglevel package
log: true, log: true,
// OHIF-package specific Globals // OHIF-package specific Globals
OHIF: true,
toolManager: true,
ViewerData: true,
ViewerStudies: true,
LesionManager: true,
Timepoints: true, Timepoints: true,
Measurements: true Measurements: true
} }

View File

@ -71,19 +71,18 @@ Template.lesionTable.onRendered(function() {
// Put a visual indicator (<) in timepoint header in lesion table for active timepoints // Put a visual indicator (<) in timepoint header in lesion table for active timepoints
// timepointLoaded property is used to put indicator for loaded timepoints in viewport // timepointLoaded property is used to put indicator for loaded timepoints in viewport
self.autorun(function() { self.autorun(function() {
var ViewerData = Session.get('ViewerData'); // Temporary until we have a real window manager with events for series/study changed
var contentId = Session.get('activeContentId'); Session.get('NewSeriesLoaded');
if (contentId) {
var viewerData = ViewerData[contentId]; console.log('ViewerData changed, check for displayed timepoints');
if (viewerData) {
if (viewerData.loadedSeriesData) {
// Get study dates of imageViewerViewport elements // Get study dates of imageViewerViewport elements
var loadedStudyDates = { var loadedStudyDates = {
patientId: '', patientId: '',
dates: [] dates: []
}; };
$('.imageViewerViewport').each(function(viewportIndex, element) { var viewports = $('.imageViewerViewport').not('.empty');
viewports.each(function(index, element) {
var enabledElement = cornerstone.getEnabledElement(element); var enabledElement = cornerstone.getEnabledElement(element);
if (!enabledElement || !enabledElement.image) { if (!enabledElement || !enabledElement.image) {
return; return;
@ -102,10 +101,13 @@ Template.lesionTable.onRendered(function() {
// If study date is loaded into viewport, set timepointLoaded property in Timepoints collection as true // If study date is loaded into viewport, set timepointLoaded property in Timepoints collection as true
// Else set timepointLoaded property as false // Else set timepointLoaded property as false
if (loadedStudyDates.dates.length) { if (!loadedStudyDates.dates.length) {
return;
}
var timepoints = Timepoints.find({ var timepoints = Timepoints.find({
patientId: loadedStudyDates.patientId patientId: loadedStudyDates.patientId
}).fetch(); });
timepoints.forEach(function(timepoint) { timepoints.forEach(function(timepoint) {
var timepointLoaded = false; var timepointLoaded = false;
@ -119,10 +121,5 @@ Template.lesionTable.onRendered(function() {
} }
}); });
}); });
}
}
}
}
}); });
}); });

View File

@ -10,7 +10,7 @@ var allCornerstoneEvents = 'CornerstoneToolsMouseDown CornerstoneToolsMouseDownA
* @param data {object} Object containing the study, series, and viewport element to be used * @param data {object} Object containing the study, series, and viewport element to be used
*/ */
function loadSeriesIntoViewport(data, templateData) { function loadSeriesIntoViewport(data, templateData) {
log.info("imageViewerViewport loadSeriesIntoViewport"); log.info('imageViewerViewport loadSeriesIntoViewport');
// Make sure we have all the data required to render the series // Make sure we have all the data required to render the series
if (!data.study || !data.series || !data.element) { if (!data.study || !data.series || !data.element) {
@ -20,7 +20,7 @@ function loadSeriesIntoViewport(data, templateData) {
// Get the current element and it's index in the list of all viewports // Get the current element and it's index in the list of all viewports
// The viewport index is often used to store information about a viewport element // The viewport index is often used to store information about a viewport element
var element = data.element; var element = data.element;
var viewportIndex = $(".imageViewerViewport").index(element); var viewportIndex = $('.imageViewerViewport').index(element);
// Get the contentID of the current worklist tab, if the viewport is running // Get the contentID of the current worklist tab, if the viewport is running
// alongside the worklist package // alongside the worklist package
@ -262,7 +262,6 @@ function loadSeriesIntoViewport(data, templateData) {
$(element).on('CornerstoneStackScroll', OnStackScroll); $(element).on('CornerstoneStackScroll', OnStackScroll);
} }
// Define a function to trigger an event whenever a new viewport is being used // Define a function to trigger an event whenever a new viewport is being used
// This is used to update the value of the "active viewport", when the user interacts // This is used to update the value of the "active viewport", when the user interacts
// with a new viewport element // with a new viewport element
@ -272,7 +271,7 @@ function loadSeriesIntoViewport(data, templateData) {
// If it was, no changes are necessary, so stop here. // If it was, no changes are necessary, so stop here.
var element = eventData.element; var element = eventData.element;
var activeViewportIndex = Session.get('activeViewport'); var activeViewportIndex = Session.get('activeViewport');
var viewportIndex = $(".imageViewerViewport").index(element); var viewportIndex = $('.imageViewerViewport').index(element);
// Reset the focus, even if we don't need to re-enable reference lines or prefetching // Reset the focus, even if we don't need to re-enable reference lines or prefetching
$(element).focus(); $(element).focus();
@ -323,13 +322,16 @@ function loadSeriesIntoViewport(data, templateData) {
} }
// Run any renderedCallback that exists in the data context // Run any renderedCallback that exists in the data context
if (data.renderedCallback && typeof data.renderedCallback === "function") { if (data.renderedCallback && typeof data.renderedCallback === 'function') {
data.renderedCallback(element); data.renderedCallback(element);
} }
}, function(error) { }, function(error) {
// If something goes wrong while loading the image, fire the error handler. // If something goes wrong while loading the image, fire the error handler.
errorLoadingHandler(element, imageId, error); errorLoadingHandler(element, imageId, error);
}); });
// Temporary until we have a real window manager with events for series/study changed
Session.set('NewSeriesLoaded', Random.id());
} }
/** /**
@ -351,6 +353,7 @@ function setSeries(data, seriesInstanceUid, templateData) {
data.series = series; data.series = series;
return false; return false;
} }
return true; return true;
}); });
@ -378,7 +381,6 @@ function getKeysByValue(object, value) {
}); });
} }
Meteor.startup(function() { Meteor.startup(function() {
// On Meteor startup, define the global objects used to store loading imageIds // On Meteor startup, define the global objects used to store loading imageIds
// by viewport / thumbnail element // by viewport / thumbnail element
@ -410,10 +412,10 @@ Meteor.startup(function() {
Template.imageViewerViewport.onRendered(function() { Template.imageViewerViewport.onRendered(function() {
var templateData = Template.currentData(); var templateData = Template.currentData();
log.info("imageViewerViewport onRendered"); log.info('imageViewerViewport onRendered');
// When the imageViewerViewport template is rendered // When the imageViewerViewport template is rendered
var element = this.find(".imageViewerViewport"); var element = this.find('.imageViewerViewport');
// Display the loading indicator for this element // Display the loading indicator for this element
$(element).siblings('.imageViewerLoadingIndicator').css('display', 'block'); $(element).siblings('.imageViewerLoadingIndicator').css('display', 'block');
@ -458,6 +460,7 @@ Template.imageViewerViewport.onRendered(function() {
if (!study) { if (!study) {
return; return;
} }
sortStudy(study); sortStudy(study);
data.study = study; data.study = study;
@ -470,10 +473,10 @@ Template.imageViewerViewport.onRendered(function() {
}); });
Template.imageViewerViewport.onDestroyed(function() { Template.imageViewerViewport.onDestroyed(function() {
log.info("imageViewerViewport onDestroyed"); log.info('imageViewerViewport onDestroyed');
// When a viewport element is being destroyed // When a viewport element is being destroyed
var element = this.find(".imageViewerViewport"); var element = this.find('.imageViewerViewport');
// Try to stop any currently playing clips // Try to stop any currently playing clips
// Otherwise the interval will continuously throw errors // Otherwise the interval will continuously throw errors
@ -491,7 +494,7 @@ Template.imageViewerViewport.onDestroyed(function() {
Template.imageViewerViewport.events({ Template.imageViewerViewport.events({
'ActivateViewport .imageViewerViewport': function(e) { 'ActivateViewport .imageViewerViewport': function(e) {
log.info("imageViewerViewport ActivateViewport"); log.info('imageViewerViewport ActivateViewport');
setActiveViewport(e.currentTarget); setActiveViewport(e.currentTarget);
} }
}); });