Work from Medken branch

This commit is contained in:
Erik Ziegler committed 2016-03-13 16:38:43 +01:00
1 parent bee1e38044
commit 31d34a3fb5
12 files changed
+944 -557

No files matched your search

@@ -1,6 +1,6 @@
<template name="hangingProtocolButtons">
<button id="previousPresentationGroup" type="button"
class="imageViewerCommand btn btn-sm btn-default"
class="btn btn-sm btn-default"
data-container="body"
data-toggle="tooltip"
data-placement="bottom"
@@ -9,7 +9,7 @@
<span class="fa fa-step-backward"></span>
</button>
<button id="nextPresentationGroup" type="button"
class="imageViewerCommand btn btn-sm btn-default"
class="btn btn-sm btn-default"
data-container="body"
data-toggle="tooltip"
data-placement="bottom"
@@ -1,7 +1,7 @@
Template.hangingProtocolButtons.helpers({
isNextAvailable: function() {
var presentationGroup = Session.get('WindowManagerPresentationGroup');
var numPresentationGroups = WindowManager.getNumPresentationGroups();
var numPresentationGroups = Session.get('WindowManagerNumPresentationGroups');
return presentationGroup < numPresentationGroups;
},
isPreviousAvailable: function() {
@@ -9,3 +9,14 @@ Template.hangingProtocolButtons.helpers({
return presentationGroup > 1;
}
});
Template.hangingProtocolButtons.events({
'click #previousPresentationGroup': function(e) {
$(e.currentTarget).tooltip('hide');
WindowManager.previousPresentationGroup();
},
'click #nextPresentationGroup': function(e) {
$(e.currentTarget).tooltip('hide');
WindowManager.nextPresentationGroup();
}
});
@@ -138,13 +138,35 @@ function loadSeriesIntoViewport(data, templateData) {
// If there is a saved object containing Cornerstone viewport data
// (e.g. scale, invert, window settings) in the input data, apply it now.
//
// Otherwise, display the loaded image in the viewport element with the
// default viewport settings.
if (data.viewport) {
// Check if there are default viewport settings for this modality
enabledElement.image = image;
enabledElement.viewport = cornerstone.getDefaultViewport(enabledElement.canvas, image);
var modalityViewport = getModalityDefaultViewport(series, enabledElement, image.imageId);
// If no default viewport settings or modality-specific settings exists,
// display the loaded image in the viewport element with no loaded viewport
// settings.
if (modalityViewport) {
cornerstone.displayImage(element, image, modalityViewport);
// Mark that this element should not be fit to the window in the resize listeners
enabledElement.fitToWindow = false;
// Resize the canvas to fit the current viewport element size.
cornerstone.resize(element, false);
} else if (data.viewport) {
cornerstone.displayImage(element, image, data.viewport);
// Resize the canvas to fit the current viewport element size.
cornerstone.resize(element, true);
} else {
cornerstone.displayImage(element, image);
// Resize the canvas to fit the current viewport element size. Fit the displayed
// image to the canvas dimensions.
cornerstone.resize(element, true);
}
// Remove the data for this viewport from the ViewportLoading object
@@ -155,10 +177,6 @@ function loadSeriesIntoViewport(data, templateData) {
// (e.g. hide the progress text box)
endLoadingHandler(element);
// Resize the canvas to fit the current viewport element size. Fit the displayed
// image to the canvas dimensions.
cornerstone.resize(element, true);
// Remove the 'empty' class from the viewport to hide any instruction text
element.classList.remove('empty');
@@ -1,6 +1,10 @@
ViewerWindows = new Meteor.Collection(null);
ViewerWindows._debugName = 'ViewerWindows';
Template.imageViewerViewports.onCreated(function() {
WindowManager.init();
});
Template.imageViewerViewports.helpers({
height: function() {
var viewportRows = this.viewportRows || 1;
@@ -136,10 +140,9 @@ var savedSeriesData,
savedViewportColumns;
Template.imageViewerViewports.events({
'CornerstoneMouseDoubleClick .imageViewerViewport': function(e) {
var container = $('.viewerMain').get(0);
'dblclick .imageViewerViewport': function(e) {
var data;
var contentId = this.contentId || $('#viewer').parents('.tab-pane.active').attr('id');
var contentId = Session.get('activeContentId');
// If there is more than one viewport on screen
// And one of them is double-clicked, it should be rendered alone
@@ -159,8 +162,7 @@ Template.imageViewerViewports.events({
};
// Render the imageViewerViewports template with these settings
$('#imageViewerViewports').remove();
UI.renderWithData(Template.imageViewerViewports, data, container);
WindowManager.updateWindows(data);
// Remove the 'zoomed' class from any viewports
$('.imageViewerViewport').removeClass('zoomed');
@@ -191,8 +193,7 @@ Template.imageViewerViewports.events({
};
// Render the imageViewerViewports template with these settings
$('#imageViewerViewports').remove();
UI.renderWithData(Template.imageViewerViewports, data, container);
WindowManager.updateWindows(data);
// Add the 'zoomed' class to the lone remaining viewport
$('.imageViewerViewport').eq(0).addClass('zoomed');
@@ -33,8 +33,6 @@ Template.layoutChooser.events({
highlightCells(evt.currentTarget);
},
'click .layoutChooser table td': function(evt) {
$('#imageViewerViewports').remove();
var currentCell = $(evt.currentTarget);
var rowIndex = currentCell.closest('tr').index();
var columnIndex = currentCell.index();
@@ -42,10 +40,9 @@ Template.layoutChooser.events({
// Add 1 because the indices start from zero
var data = {
viewportRows: rowIndex + 1,
viewportColumns: columnIndex + 1,
viewportColumns: columnIndex + 1
};
var container = $(".viewerMain").get(0);
UI.renderWithData(Template.imageViewerViewports, data, container);
WindowManager.setLayout(data);
}
});