Fixed bug LT-85 (Location Response Selections). Work on LT-9 and LT-12
This commit is contained in:
1 parent
28cee350ff
commit
220ff065dc
44 files changed
+1515
-824
No files matched your search
@@ -1,4 +1,4 @@
|
||||
/*! cornerstoneTools - v0.7.7 - 2015-11-26 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstoneTools */
|
||||
/*! cornerstoneTools - v0.7.7 - 2015-12-18 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstoneTools */
|
||||
// Begin Source: src/header.js
|
||||
if (typeof cornerstone === 'undefined') {
|
||||
cornerstone = {};
|
||||
@@ -56,6 +56,9 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
var mouseWheelEvents = 'mousewheel DOMMouseScroll';
|
||||
|
||||
function enable(element) {
|
||||
// Prevent handlers from being attached multiple times
|
||||
disable(element);
|
||||
|
||||
$(element).on(mouseWheelEvents, mouseWheel);
|
||||
}
|
||||
|
||||
@@ -897,6 +900,13 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
handleMover = cornerstoneTools.moveNewHandle;
|
||||
}
|
||||
|
||||
var preventHandleOutsideImage;
|
||||
if (mouseToolInterface.options.preventHandleOutsideImage !== undefined) {
|
||||
preventHandleOutsideImage = mouseToolInterface.options.preventHandleOutsideImage;
|
||||
} else {
|
||||
preventHandleOutsideImage = false;
|
||||
}
|
||||
|
||||
handleMover(mouseEventData, mouseToolInterface.toolType, measurementData, measurementData.handles.end, function() {
|
||||
measurementData.active = false;
|
||||
measurementData.invalidated = true;
|
||||
@@ -914,7 +924,7 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
}
|
||||
|
||||
cornerstone.updateImage(element);
|
||||
});
|
||||
}, preventHandleOutsideImage);
|
||||
}
|
||||
|
||||
function mouseDownActivateCallback(e, eventData) {
|
||||
@@ -994,6 +1004,14 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
|
||||
// now check to see if there is a handle we can move
|
||||
if (toolData) {
|
||||
|
||||
var preventHandleOutsideImage;
|
||||
if (mouseToolInterface.options && mouseToolInterface.options.preventHandleOutsideImage !== undefined) {
|
||||
preventHandleOutsideImage = mouseToolInterface.options.preventHandleOutsideImage;
|
||||
} else {
|
||||
preventHandleOutsideImage = false;
|
||||
}
|
||||
|
||||
for (i = 0; i < toolData.data.length; i++) {
|
||||
data = toolData.data[i];
|
||||
var distanceSq = 25;
|
||||
@@ -1001,7 +1019,7 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
if (handle) {
|
||||
$(element).off('CornerstoneToolsMouseMove', mouseToolInterface.mouseMoveCallback || mouseMoveCallback);
|
||||
data.active = true;
|
||||
cornerstoneTools.moveHandle(eventData, mouseToolInterface.toolType, data, handle, handleDoneMove);
|
||||
cornerstoneTools.moveHandle(eventData, mouseToolInterface.toolType, data, handle, handleDoneMove, preventHandleOutsideImage);
|
||||
e.stopImmediatePropagation();
|
||||
return false;
|
||||
}
|
||||
@@ -1011,7 +1029,7 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
// Now check to see if there is a line we can move
|
||||
// now check to see if we have a tool that we can move
|
||||
if (toolData && mouseToolInterface.pointNearTool) {
|
||||
var options = {
|
||||
var options = mouseToolInterface.options || {
|
||||
deleteIfHandleOutsideImage: true,
|
||||
preventHandleOutsideImage: false
|
||||
};
|
||||
@@ -2452,7 +2470,14 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
startLoadingHandler(targetElement);
|
||||
}
|
||||
|
||||
cornerstone.loadAndCacheImage(stackData.imageIds[newImageIdIndex]).then(function(image) {
|
||||
var loader;
|
||||
if (stackData.preventCache === true) {
|
||||
loader = cornerstone.loadImage(stackData.imageIds[newImageIdIndex]);
|
||||
} else {
|
||||
loader = cornerstone.loadAndCacheImage(stackData.imageIds[newImageIdIndex]);
|
||||
}
|
||||
|
||||
loader.then(function(image) {
|
||||
var viewport = cornerstone.getViewport(targetElement);
|
||||
stackData.currentImageIdIndex = newImageIdIndex;
|
||||
cornerstone.displayImage(targetElement, image, viewport);
|
||||
@@ -3214,8 +3239,13 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
var data = toolData.data[config.currentTool];
|
||||
|
||||
// Set the mouseLocation handle
|
||||
config.mouseLocation.handles.start.x = eventData.currentPoints.image.x;
|
||||
config.mouseLocation.handles.start.y = eventData.currentPoints.image.y;
|
||||
var x = Math.max(eventData.currentPoints.image.x, 0);
|
||||
x = Math.min(x, eventData.image.width);
|
||||
config.mouseLocation.handles.start.x = x;
|
||||
|
||||
var y = Math.max(eventData.currentPoints.image.y, 0);
|
||||
y = Math.min(y, eventData.image.height);
|
||||
config.mouseLocation.handles.start.y = y;
|
||||
|
||||
var currentHandle = config.currentHandle;
|
||||
|
||||
@@ -5943,29 +5973,33 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
|
||||
function keyPress(e) {
|
||||
var element = e.currentTarget;
|
||||
var startingCoords = cornerstone.pageToPixel(element, mouseX, mouseY);
|
||||
|
||||
e = window.event || e; // old IE support
|
||||
|
||||
var keyPressData = {
|
||||
event: window.event || e, // old IE support
|
||||
element: element,
|
||||
viewport: cornerstone.getViewport(element),
|
||||
image: cornerstone.getEnabledElement(element).image,
|
||||
pageX: mouseX,
|
||||
pageY: mouseY,
|
||||
imageX: startingCoords.x,
|
||||
imageY: startingCoords.y,
|
||||
currentPoints: {
|
||||
page: {
|
||||
x: mouseX,
|
||||
y: mouseY
|
||||
},
|
||||
image: cornerstone.pageToPixel(element, mouseX, mouseY),
|
||||
},
|
||||
keyCode: e.keyCode,
|
||||
which: e.which
|
||||
};
|
||||
|
||||
if (e.type === 'keydown') {
|
||||
$(element).trigger('CornerstoneToolsKeyDown', keyPressData);
|
||||
} else if (e.type === 'keypress') {
|
||||
$(element).trigger('CornerstoneToolsKeyPress', keyPressData);
|
||||
} else if (e.type === 'keyup') {
|
||||
$(element).trigger('CornerstoneToolsKeyUp', keyPressData);
|
||||
}
|
||||
keyPressData.currentPoints.canvas = cornerstone.pixelToCanvas(element, keyPressData.currentPoints.image);
|
||||
|
||||
var keyPressEvents = {
|
||||
keydown: 'CornerstoneToolsKeyDown',
|
||||
keypress: 'CornerstoneToolsKeyPress',
|
||||
keyup: 'CornerstoneToolsKeyUp',
|
||||
|
||||
};
|
||||
|
||||
$(element).trigger(keyPressEvents[e.type], keyPressData);
|
||||
}
|
||||
|
||||
function mouseMove(e) {
|
||||
@@ -5976,12 +6010,16 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
var keyboardEvent = 'keydown keypress keyup';
|
||||
|
||||
function enable(element) {
|
||||
$(element).bind(keyboardEvent, keyPress);
|
||||
// Prevent handlers from being attached multiple times
|
||||
disable(element);
|
||||
|
||||
$(element).on(keyboardEvent, keyPress);
|
||||
$(element).on('mousemove', mouseMove);
|
||||
}
|
||||
|
||||
function disable(element) {
|
||||
$(element).unbind(keyboardEvent, keyPress);
|
||||
$(element).off(keyboardEvent, keyPress);
|
||||
$(element).off('mousemove', mouseMove);
|
||||
}
|
||||
|
||||
// module exports
|
||||
@@ -7097,7 +7135,7 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
|
||||
function requestPoolManager() {
|
||||
|
||||
function addRequest(element, imageId, type, doneCallback, failCallback) {
|
||||
function addRequest(element, imageId, type, preventCache, doneCallback, failCallback) {
|
||||
if (!requestPool.hasOwnProperty(type)) {
|
||||
throw 'Request type must be one of interaction, thumbnail, or prefetch';
|
||||
}
|
||||
@@ -7110,6 +7148,7 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
var requestDetails = {
|
||||
type: type,
|
||||
imageId: imageId,
|
||||
preventCache: preventCache,
|
||||
doneCallback: doneCallback,
|
||||
failCallback: failCallback
|
||||
};
|
||||
@@ -7154,7 +7193,6 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
setTimeout(function() {
|
||||
var requestDetails = getNextRequest();
|
||||
if (!requestDetails) {
|
||||
awake = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7191,8 +7229,15 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var loader;
|
||||
if (requestDetails.preventCache === true) {
|
||||
loader = cornerstone.loadImage(imageId);
|
||||
} else {
|
||||
loader = cornerstone.loadAndCacheImage(imageId);
|
||||
}
|
||||
|
||||
// Load and cache the image
|
||||
cornerstone.loadAndCacheImage(imageId).then(function(image) {
|
||||
loader.then(function(image) {
|
||||
numRequests[type]--;
|
||||
// console.log(numRequests);
|
||||
doneCallback(image);
|
||||
@@ -7366,7 +7411,15 @@ if (typeof cornerstoneTools === 'undefined') {
|
||||
}
|
||||
|
||||
var viewport = cornerstone.getViewport(element);
|
||||
cornerstone.loadAndCacheImage(stackData.imageIds[newImageIdIndex]).then(function(image) {
|
||||
|
||||
var loader;
|
||||
if (stackData.preventCache === true) {
|
||||
loader = cornerstone.loadImage(stackData.imageIds[newImageIdIndex]);
|
||||
} else {
|
||||
loader = cornerstone.loadAndCacheImage(stackData.imageIds[newImageIdIndex]);
|
||||
}
|
||||
|
||||
loader.then(function(image) {
|
||||
stackData.currentImageIdIndex = newImageIdIndex;
|
||||
cornerstone.displayImage(element, image, viewport);
|
||||
if (endLoadingHandler) {
|
||||
@@ -7611,7 +7664,8 @@ Display scroll progress bar across bottom of image.
|
||||
var nearest = nearestIndex(stackPrefetch.indicesToRequest, stack.currentImageIdIndex);
|
||||
|
||||
var imageId,
|
||||
nextImageIdIndex;
|
||||
nextImageIdIndex,
|
||||
preventCache = false;
|
||||
|
||||
// Prefetch images around the current image (before and after)
|
||||
var lowerIndex = nearest.low;
|
||||
@@ -7620,13 +7674,13 @@ Display scroll progress bar across bottom of image.
|
||||
if (lowerIndex >= 0 ) {
|
||||
nextImageIdIndex = stackPrefetch.indicesToRequest[lowerIndex--];
|
||||
imageId = stack.imageIds[nextImageIdIndex];
|
||||
requestPoolManager.addRequest(element, imageId, requestType, doneCallback, failCallback);
|
||||
requestPoolManager.addRequest(element, imageId, requestType, preventCache, doneCallback, failCallback);
|
||||
}
|
||||
|
||||
if (higherIndex < stackPrefetch.indicesToRequest.length) {
|
||||
nextImageIdIndex = stackPrefetch.indicesToRequest[higherIndex++];
|
||||
imageId = stack.imageIds[nextImageIdIndex];
|
||||
requestPoolManager.addRequest(element, imageId, requestType, doneCallback, failCallback);
|
||||
requestPoolManager.addRequest(element, imageId, requestType, preventCache, doneCallback, failCallback);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7702,6 +7756,12 @@ Display scroll progress bar across bottom of image.
|
||||
|
||||
var stack = stackData.data[0];
|
||||
|
||||
// Check if we are allowed to cache images in this stack
|
||||
if (stack.preventCache === true) {
|
||||
console.warn('A stack that should not be cached was given the stackPrefetch');
|
||||
return;
|
||||
}
|
||||
|
||||
// Use the currentImageIdIndex from the stack as the initalImageIdIndex
|
||||
var stackPrefetchData = {
|
||||
indicesToRequest: range(0, stack.imageIds.length - 1),
|
||||
@@ -8765,7 +8825,14 @@ Display scroll progress bar across bottom of image.
|
||||
startLoadingHandler(targetElement);
|
||||
}
|
||||
|
||||
cornerstone.loadAndCacheImage(targetStackData.imageIds[newImageIdIndex]).then(function(image) {
|
||||
var loader;
|
||||
if (targetStackData.preventCache === true) {
|
||||
loader = cornerstone.loadImage(targetStackData.imageIds[newImageIdIndex]);
|
||||
} else {
|
||||
loader = cornerstone.loadAndCacheImage(targetStackData.imageIds[newImageIdIndex]);
|
||||
}
|
||||
|
||||
loader.then(function(image) {
|
||||
var viewport = cornerstone.getViewport(targetElement);
|
||||
targetStackData.currentImageIdIndex = newImageIdIndex;
|
||||
synchronizer.displayImage(targetElement, image, viewport);
|
||||
@@ -8843,7 +8910,14 @@ Display scroll progress bar across bottom of image.
|
||||
startLoadingHandler(targetElement);
|
||||
}
|
||||
|
||||
cornerstone.loadAndCacheImage(stackData.imageIds[newImageIdIndex]).then(function(image) {
|
||||
var loader;
|
||||
if (stackData.preventCache === true) {
|
||||
loader = cornerstone.loadImage(stackData.imageIds[newImageIdIndex]);
|
||||
} else {
|
||||
loader = cornerstone.loadAndCacheImage(stackData.imageIds[newImageIdIndex]);
|
||||
}
|
||||
|
||||
loader.then(function(image) {
|
||||
var viewport = cornerstone.getViewport(targetElement);
|
||||
stackData.currentImageIdIndex = newImageIdIndex;
|
||||
synchronizer.displayImage(targetElement, image, viewport);
|
||||
@@ -8913,7 +8987,14 @@ Display scroll progress bar across bottom of image.
|
||||
}
|
||||
|
||||
if (newImageIdIndex !== -1) {
|
||||
cornerstone.loadAndCacheImage(stackData.imageIds[newImageIdIndex]).then(function(image) {
|
||||
var loader;
|
||||
if (stackData.preventCache === true) {
|
||||
loader = cornerstone.loadImage(stackData.imageIds[newImageIdIndex]);
|
||||
} else {
|
||||
loader = cornerstone.loadAndCacheImage(stackData.imageIds[newImageIdIndex]);
|
||||
}
|
||||
|
||||
loader.then(function(image) {
|
||||
var viewport = cornerstone.getViewport(targetElement);
|
||||
stackData.currentImageIdIndex = newImageIdIndex;
|
||||
synchronizer.displayImage(targetElement, image, viewport);
|
||||
@@ -8977,7 +9058,14 @@ Display scroll progress bar across bottom of image.
|
||||
startLoadingHandler(targetElement);
|
||||
}
|
||||
|
||||
cornerstone.loadAndCacheImage(stackData.imageIds[newImageIdIndex]).then(function(image) {
|
||||
var loader;
|
||||
if (stackData.preventCache === true) {
|
||||
loader = cornerstone.loadImage(stackData.imageIds[newImageIdIndex]);
|
||||
} else {
|
||||
loader = cornerstone.loadAndCacheImage(stackData.imageIds[newImageIdIndex]);
|
||||
}
|
||||
|
||||
loader.then(function(image) {
|
||||
var viewport = cornerstone.getViewport(targetElement);
|
||||
stackData.currentImageIdIndex = newImageIdIndex;
|
||||
synchronizer.displayImage(targetElement, image, viewport);
|
||||
@@ -9348,7 +9436,14 @@ Display scroll progress bar across bottom of image.
|
||||
var samples = [];
|
||||
|
||||
measurementData.timeSeries.stacks.forEach(function(stack) {
|
||||
cornerstone.loadAndCacheImage(stack.imageIds[measurementData.imageIdIndex]).then(function(image) {
|
||||
var loader;
|
||||
if (stack.preventCache === true) {
|
||||
loader = cornerstone.loadImage(stack.imageIds[measurementData.imageIdIndex]);
|
||||
} else {
|
||||
loader = cornerstone.loadAndCacheImage(stack.imageIds[measurementData.imageIdIndex]);
|
||||
}
|
||||
|
||||
loader.then(function(image) {
|
||||
var offset = Math.round(measurementData.handles.end.x) + Math.round(measurementData.handles.end.y) * image.width;
|
||||
var sample = image.getPixelData()[offset];
|
||||
samples.push(sample);
|
||||
@@ -9484,7 +9579,14 @@ Display scroll progress bar across bottom of image.
|
||||
startLoadingHandler(element);
|
||||
}
|
||||
|
||||
cornerstone.loadAndCacheImage(newStack.imageIds[currentImageIdIndex]).then(function(image) {
|
||||
var loader;
|
||||
if (newStack.preventCache === true) {
|
||||
loader = cornerstone.loadImage(newStack.imageIds[currentImageIdIndex]);
|
||||
} else {
|
||||
loader = cornerstone.loadAndCacheImage(newStack.imageIds[currentImageIdIndex]);
|
||||
}
|
||||
|
||||
loader.then(function(image) {
|
||||
if (timeSeriesData.currentImageIdIndex !== currentImageIdIndex) {
|
||||
newStack.currentImageIdIndex = currentImageIdIndex;
|
||||
timeSeriesData.currentStackIndex = newStackIndex;
|
||||
@@ -10373,7 +10475,10 @@ Display scroll progress bar across bottom of image.
|
||||
|
||||
cornerstoneTools.requestPoolManager.clearRequestStack(type);
|
||||
|
||||
requestPoolManager.addRequest(element, newImageId, type, doneCallback, failCallback);
|
||||
// Convert the preventCache value in stack data to a boolean
|
||||
var preventCache = !!stackData.preventCache;
|
||||
|
||||
requestPoolManager.addRequest(element, newImageId, type, preventCache, doneCallback, failCallback);
|
||||
requestPoolManager.startGrabbing();
|
||||
|
||||
$(element).trigger('CornerstoneStackScroll', eventData);
|
||||
|
||||
Reference in new issue
Block a user