Updated lesionTable to store measurement ID. Worked on refactoring functions in lesionTable.js to allow loading of series from a click on a row

This commit is contained in:
Erik Ziegler committed 2015-11-22 12:20:19 +01:00
1 parent a3c0048490
commit 9ad2ccaaaf
11 files changed
+254 -259

No files matched your search

@@ -199,9 +199,10 @@ Template.thumbnailEntry.onRendered(function() {
Template.thumbnailEntry.events({
// Touch drag/drop events
'touchstart .thumbnailEntry, mousedown .thumbnailEntry': function(e) {
var data = Template.parentData(2);
data.studyInstanceUid = this.stack.studyInstanceUid;
data.seriesInstanceUid = this.stack.seriesInstanceUid;
var data = {
studyInstanceUid: this.stack.studyInstanceUid,
seriesInstanceUid: this.stack.seriesInstanceUid
};
thumbnailDragStartHandler(e, data);
},
'touchmove .thumbnailEntry': function(e) {
@@ -146,16 +146,6 @@ function loadSeriesIntoViewport(data) {
// Start loading the image.
cornerstone.loadAndCacheImage(imageId).then(function(image) {
// Fire an event to give notice that a new series was loaded in the viewport
var eventType = "ViewerBaseSeriesLoaded";
var eventData = {
element: element,
stack: stack,
study: data.study,
series: data.series
};
$(document).trigger(eventType, eventData);
// If there is a saved object containing Cornerstone viewport data
// (e.g. scale, invert, window settings) in the input data, apply it now.
//
@@ -311,6 +301,11 @@ function loadSeriesIntoViewport(data) {
if (viewportIndex === Session.get('activeViewport')) {
enablePrefetchOnElement(element);
}
// Run any renderedCallback that exists in the data context
if (data.renderedCallback && typeof data.renderedCallback === "function") {
data.renderedCallback(element);
}
}, function(error) {
// If something goes wrong while loading the image, fire the error handler.
errorLoadingHandler(element, imageId, error);
@@ -392,7 +387,7 @@ Template.imageViewerViewport.onRendered(function() {
// If no seriesInstanceUid or studyInstanceUid were supplied, display the drag/drop
// instructions and then stop here since we don't know what to display in the viewport.
if (this.data.seriesInstanceUid === undefined || this.data.studyInstanceUid === undefined) {
if (!this.data.seriesInstanceUid || !this.data.studyInstanceUid) {
element.classList.add('empty');
$(element).siblings('.imageViewerLoadingIndicator').css('display', 'none');
$(element).siblings('.viewportInstructions').show();
@@ -5,8 +5,9 @@
*
* @param element
* @param data An object containing a seriesIndex and studyIndex for a study to load into this viewport
* @function renderedCallback An optional callback to be executed after the new template is rendered
*/
rerenderViewportWithNewSeries = function(element, data) {
rerenderViewportWithNewSeries = function(element, data, renderedCallback) {
// Get the container and index of the current viewport.
// The parent container is identified because it is later removed from the DOM
var container = $(element).parents('.viewportContainer').get(0);
@@ -37,6 +38,11 @@ rerenderViewportWithNewSeries = function(element, data) {
container.appendChild(newViewportContainer);
// Pass the renderedCallback to the imageViewerViewport template
if (renderedCallback && typeof renderedCallback === "function") {
data.renderedCallback = renderedCallback;
}
// Render and insert the template
UI.renderWithData(Template.imageViewerViewport, data, newViewportContainer);
};
+66 -54
View File
@@ -1,5 +1,7 @@
var activeTool;
var alwaysEnabledTools;
var tools = {};
var initialized = false;
@@ -72,6 +74,9 @@ toolManager = {
addTool: function(name, base) {
tools[name] = base;
},
setAlwaysEnabledTools: function(tools) {
alwaysEnabledTools = tools;
},
setActiveTool: function(tool) {
if (!initialized) {
toolManager.init();
@@ -83,61 +88,68 @@ toolManager = {
$('.imageViewerViewport').each(function(index, element) {
var canvases = $(element).find('canvas');
if (!element.classList.contains('empty') && canvases.length > 0) {
// First, deactivate the current active tool
tools[activeTool].mouse.deactivate(element, 1);
if (tools[activeTool].touch) {
tools[activeTool].touch.deactivate(element);
}
// First, get the stack toolData
var toolData = cornerstoneTools.getToolState(element, 'stack');
if (!toolData || !toolData.data || !toolData.data.length) {
return;
}
// Get the imageIds for this element
var imageIds = toolData.data[0].imageIds;
// Deactivate all the middle mouse, right click, and scroll wheel tools
cornerstoneTools.pan.deactivate(element);
cornerstoneTools.zoom.deactivate(element);
cornerstoneTools.zoomWheel.deactivate(element);
cornerstoneTools.stackScrollWheel.deactivate(element);
// Reactivate the relevant scrollwheel tool for this element
if (imageIds.length > 1) {
// scroll is the default tool for middle mouse wheel for stacks
cornerstoneTools.stackScrollWheel.activate(element);
} else {
// zoom is the default tool for middle mouse wheel for single images (non stacks)
cornerstoneTools.zoomWheel.activate(element);
}
// This block ensures that the middle mouse and scroll tools keep working
if (tool === 'pan') {
cornerstoneTools.pan.activate(element, 3); // 3 means left mouse button and middle mouse button
cornerstoneTools.zoom.activate(element, 4); // zoom is the default tool for right mouse button
} else if (tool === 'zoom') {
cornerstoneTools.pan.activate(element, 2); // pan is the default tool for middle mouse button
cornerstoneTools.zoom.activate(element, 5); // 5 means left mouse button and right mouse button
} else {
// Reactivate the middle mouse and right click tools
cornerstoneTools.pan.activate(element, 2); // pan is the default tool for middle mouse button
cornerstoneTools.zoom.activate(element, 4); // zoom is the default tool for right mouse button
// Activate the chosen tool
tools[tool].mouse.activate(element, 1);
}
if (tools[tool].touch) {
tools[tool].touch.activate(element);
}
cornerstoneTools.zoomTouchPinch.activate(element);
cornerstoneTools.panMultiTouch.activate(element);
if (element.classList.contains('empty') || !canvases.length) {
return;
}
// First, deactivate the current active tool
tools[activeTool].mouse.deactivate(element, 1);
if (tools[activeTool].touch) {
tools[activeTool].touch.deactivate(element);
}
// Enable any tools set as 'Always enabled'
alwaysEnabledTools.forEach(function(toolType) {
cornerstoneTools[toolType].enable(element);
});
// Get the stack toolData
var toolData = cornerstoneTools.getToolState(element, 'stack');
if (!toolData || !toolData.data || !toolData.data.length) {
return;
}
// Get the imageIds for this element
var imageIds = toolData.data[0].imageIds;
// Deactivate all the middle mouse, right click, and scroll wheel tools
cornerstoneTools.pan.deactivate(element);
cornerstoneTools.zoom.deactivate(element);
cornerstoneTools.zoomWheel.deactivate(element);
cornerstoneTools.stackScrollWheel.deactivate(element);
// Reactivate the relevant scrollwheel tool for this element
if (imageIds.length > 1) {
// scroll is the default tool for middle mouse wheel for stacks
cornerstoneTools.stackScrollWheel.activate(element);
} else {
// zoom is the default tool for middle mouse wheel for single images (non stacks)
cornerstoneTools.zoomWheel.activate(element);
}
// This block ensures that the middle mouse and scroll tools keep working
if (tool === 'pan') {
cornerstoneTools.pan.activate(element, 3); // 3 means left mouse button and middle mouse button
cornerstoneTools.zoom.activate(element, 4); // zoom is the default tool for right mouse button
} else if (tool === 'zoom') {
cornerstoneTools.pan.activate(element, 2); // pan is the default tool for middle mouse button
cornerstoneTools.zoom.activate(element, 5); // 5 means left mouse button and right mouse button
} else {
// Reactivate the middle mouse and right click tools
cornerstoneTools.pan.activate(element, 2); // pan is the default tool for middle mouse button
cornerstoneTools.zoom.activate(element, 4); // zoom is the default tool for right mouse button
// Activate the chosen tool
tools[tool].mouse.activate(element, 1);
}
if (tools[tool].touch) {
tools[tool].touch.activate(element);
}
cornerstoneTools.zoomTouchPinch.activate(element);
cornerstoneTools.panMultiTouch.activate(element);
});
activeTool = tool;
},
+4 -2
View File
@@ -86,7 +86,7 @@ function getMammoHangingProtocol() {
SelectorCSValue: 'R CC',
FilterByCategory: 'SERIES_DESCRIPTION',
FilterByOperator: 'MEMBER_OF'
}],
}]
}, {
// Right side image (L MLO Current)
ImageSetNumber: 1,
@@ -102,7 +102,9 @@ function getMammoHangingProtocol() {
FilterByCategory: 'SERIES_DESCRIPTION',
FilterByOperator: 'MEMBER_OF'
}]
}, {
},
// Stage 3
{
// Left side image (R MLO Current)
ImageSetNumber: 1,
DisplaySetNumber: 1,