Fix syncing bug LT-177, update Cornerstone package libraries
This commit is contained in:
parent
f7e24b8b10
commit
b624d12762
@ -1,8 +1,5 @@
|
|||||||
Session.setDefault('activeViewport', false);
|
Session.setDefault('activeViewport', false);
|
||||||
|
|
||||||
ViewerStudies = new Meteor.Collection(null);
|
|
||||||
ViewerStudies._debugName = 'ViewerStudies';
|
|
||||||
|
|
||||||
Template.viewer.onCreated(function() {
|
Template.viewer.onCreated(function() {
|
||||||
// Attach the Window resize listener
|
// Attach the Window resize listener
|
||||||
$(window).on('resize', handleResize);
|
$(window).on('resize', handleResize);
|
||||||
@ -73,8 +70,6 @@ Template.viewer.onCreated(function() {
|
|||||||
|
|
||||||
OHIF.viewer.updateImageSynchronizer = new cornerstoneTools.Synchronizer('CornerstoneNewImage', cornerstoneTools.updateImageSynchronizer);
|
OHIF.viewer.updateImageSynchronizer = new cornerstoneTools.Synchronizer('CornerstoneNewImage', cornerstoneTools.updateImageSynchronizer);
|
||||||
|
|
||||||
log.info('viewer onCreated');
|
|
||||||
|
|
||||||
if (ViewerData[contentId].loadedSeriesData) {
|
if (ViewerData[contentId].loadedSeriesData) {
|
||||||
log.info('Reloading previous loadedSeriesData');
|
log.info('Reloading previous loadedSeriesData');
|
||||||
OHIF.viewer.loadedSeriesData = ViewerData[contentId].loadedSeriesData;
|
OHIF.viewer.loadedSeriesData = ViewerData[contentId].loadedSeriesData;
|
||||||
@ -122,7 +117,7 @@ Template.viewer.onCreated(function() {
|
|||||||
self.subscribe('singlePatientMeasurements', dataContext.studies[0].patientId);
|
self.subscribe('singlePatientMeasurements', dataContext.studies[0].patientId);
|
||||||
|
|
||||||
var subscriptionsReady = self.subscriptionsReady();
|
var subscriptionsReady = self.subscriptionsReady();
|
||||||
console.log('autorun viewer.js. Ready: ' + subscriptionsReady);
|
log.info('autorun viewer.js. Ready: ' + subscriptionsReady);
|
||||||
|
|
||||||
if (subscriptionsReady) {
|
if (subscriptionsReady) {
|
||||||
TrialResponseCriteria.validateAllDelayed();
|
TrialResponseCriteria.validateAllDelayed();
|
||||||
@ -150,16 +145,19 @@ Template.viewer.onCreated(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// This is used to re-add tools from the database into the
|
|
||||||
// Cornerstone ToolData structure
|
|
||||||
var syncTimeout,
|
|
||||||
syncDelay = 50;
|
|
||||||
Measurements.find().observe({
|
Measurements.find().observe({
|
||||||
added: function(data) {
|
added: function(data) {
|
||||||
if (data.toolDataInsertedManually === true) {
|
if (data.clientId === ClientId) {
|
||||||
|
TrialResponseCriteria.validateAllDelayed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info('Measurement added');
|
||||||
|
|
||||||
|
// This is used to re-add tools from the database into the
|
||||||
|
// Cornerstone ToolData structure
|
||||||
|
syncMeasurementAndToolData(data);
|
||||||
|
|
||||||
// Activate first measurements in image box as default if exists
|
// Activate first measurements in image box as default if exists
|
||||||
if (!firstMeasurementsActivated) {
|
if (!firstMeasurementsActivated) {
|
||||||
var templateData = {
|
var templateData = {
|
||||||
@ -171,9 +169,6 @@ Template.viewer.onCreated(function() {
|
|||||||
firstMeasurementsActivated = true;
|
firstMeasurementsActivated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info('Measurement added');
|
|
||||||
syncMeasurementAndToolData(data);
|
|
||||||
|
|
||||||
// Update each displayed viewport
|
// Update each displayed viewport
|
||||||
var viewports = $('.imageViewerViewport').not('.empty');
|
var viewports = $('.imageViewerViewport').not('.empty');
|
||||||
viewports.each(function(index, element) {
|
viewports.each(function(index, element) {
|
||||||
@ -181,11 +176,15 @@ Template.viewer.onCreated(function() {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
changed: function(data) {
|
changed: function(data) {
|
||||||
if (OHIF.viewer.manuallyModifyingMeasurement === true) {
|
if (data.clientId === ClientId) {
|
||||||
|
TrialResponseCriteria.validateAllDelayed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info('Measurement changed');
|
log.info('Measurement changed');
|
||||||
|
|
||||||
|
// This is used to update changed tools from the database
|
||||||
|
// in the Cornerstone ToolData structure
|
||||||
syncMeasurementAndToolData(data);
|
syncMeasurementAndToolData(data);
|
||||||
|
|
||||||
// Update each displayed viewport
|
// Update each displayed viewport
|
||||||
@ -258,9 +257,6 @@ Template.viewer.onRendered(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Template.viewer.onDestroyed(function() {
|
Template.viewer.onDestroyed(function() {
|
||||||
log.info('onDestroyed');
|
|
||||||
console.log('viewer destroyed!');
|
|
||||||
|
|
||||||
// Remove the Window resize listener
|
// Remove the Window resize listener
|
||||||
$(window).off('resize', handleResize);
|
$(window).off('resize', handleResize);
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/*! cornerstone - v0.8.4 - 2015-10-09 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstone */
|
/*! cornerstone - v0.9.0 - 2016-02-04 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstone */
|
||||||
if(typeof cornerstone === 'undefined'){
|
if(typeof cornerstone === 'undefined'){
|
||||||
cornerstone = {
|
cornerstone = {
|
||||||
internal : {},
|
internal : {},
|
||||||
@ -482,8 +482,11 @@ if(typeof cornerstone === 'undefined'){
|
|||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
// dictionary of imageId to cachedImage objects
|
||||||
var imageCache = {};
|
var imageCache = {};
|
||||||
|
// dictionary of sharedCacheKeys to number of imageId's in cache with this shared cache key
|
||||||
|
var sharedCacheKeys = {};
|
||||||
|
// array of cachedImage objects
|
||||||
var cachedImages = [];
|
var cachedImages = [];
|
||||||
|
|
||||||
var maximumSizeInBytes = 1024 * 1024 * 1024; // 1 GB
|
var maximumSizeInBytes = 1024 * 1024 * 1024; // 1 GB
|
||||||
@ -549,6 +552,7 @@ if(typeof cornerstone === 'undefined'){
|
|||||||
var cachedImage = {
|
var cachedImage = {
|
||||||
loaded : false,
|
loaded : false,
|
||||||
imageId : imageId,
|
imageId : imageId,
|
||||||
|
sharedCacheKey: undefined, // the sharedCacheKey for this imageId. undefined by default
|
||||||
imagePromise : imagePromise,
|
imagePromise : imagePromise,
|
||||||
timeStamp : new Date(),
|
timeStamp : new Date(),
|
||||||
sizeInBytes: 0
|
sizeInBytes: 0
|
||||||
@ -566,8 +570,23 @@ if(typeof cornerstone === 'undefined'){
|
|||||||
if (image.sizeInBytes.toFixed === undefined) {
|
if (image.sizeInBytes.toFixed === undefined) {
|
||||||
throw "putImagePromise: image.sizeInBytes is not a number";
|
throw "putImagePromise: image.sizeInBytes is not a number";
|
||||||
}
|
}
|
||||||
cachedImage.sizeInBytes = image.sizeInBytes;
|
|
||||||
cacheSizeInBytes += cachedImage.sizeInBytes;
|
// If this image has a shared cache key, reference count it and only
|
||||||
|
// count the image size for the first one added with this sharedCacheKey
|
||||||
|
if(image.sharedCacheKey) {
|
||||||
|
cachedImage.sizeInBytes = image.sizeInBytes;
|
||||||
|
cachedImage.sharedCacheKey = image.sharedCacheKey;
|
||||||
|
if(sharedCacheKeys[image.sharedCacheKey]) {
|
||||||
|
sharedCacheKeys[image.sharedCacheKey]++;
|
||||||
|
} else {
|
||||||
|
sharedCacheKeys[image.sharedCacheKey] = 1;
|
||||||
|
cacheSizeInBytes += cachedImage.sizeInBytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cachedImage.sizeInBytes = image.sizeInBytes;
|
||||||
|
cacheSizeInBytes += cachedImage.sizeInBytes;
|
||||||
|
}
|
||||||
purgeCacheIfNecessary();
|
purgeCacheIfNecessary();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -595,9 +614,23 @@ if(typeof cornerstone === 'undefined'){
|
|||||||
throw "removeImagePromise: imageId must not be undefined";
|
throw "removeImagePromise: imageId must not be undefined";
|
||||||
}
|
}
|
||||||
cachedImages.splice( cachedImages.indexOf(cachedImage), 1);
|
cachedImages.splice( cachedImages.indexOf(cachedImage), 1);
|
||||||
cacheSizeInBytes -= cachedImage.sizeInBytes;
|
|
||||||
|
// If this is using a sharedCacheKey, decrement the cache size only
|
||||||
|
// if it is the last imageId in the cache with this sharedCacheKey
|
||||||
|
if(cachedImages.sharedCacheKey) {
|
||||||
|
if(sharedCacheKeys[cachedImages.sharedCacheKey] === 1) {
|
||||||
|
cacheSizeInBytes -= cachedImage.sizeInBytes;
|
||||||
|
delete sharedCacheKeys[cachedImages.sharedCacheKey];
|
||||||
|
} else {
|
||||||
|
sharedCacheKeys[cachedImages.sharedCacheKey]--;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cacheSizeInBytes -= cachedImage.sizeInBytes;
|
||||||
|
}
|
||||||
delete imageCache[imageId];
|
delete imageCache[imageId];
|
||||||
|
|
||||||
|
decache(cachedImage.imagePromise, cachedImage.imageId);
|
||||||
|
|
||||||
return cachedImage.imagePromise;
|
return cachedImage.imagePromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -609,15 +642,37 @@ if(typeof cornerstone === 'undefined'){
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function decache(imagePromise, imageId) {
|
||||||
|
imagePromise.then(function(image) {
|
||||||
|
if(image.decache) {
|
||||||
|
image.decache();
|
||||||
|
}
|
||||||
|
imagePromise.reject();
|
||||||
|
delete imageCache[imageId];
|
||||||
|
}).always(function() {
|
||||||
|
delete imageCache[imageId];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function purgeCache() {
|
function purgeCache() {
|
||||||
while (cachedImages.length > 0) {
|
while (cachedImages.length > 0) {
|
||||||
var removedCachedImage = cachedImages.pop();
|
var removedCachedImage = cachedImages.pop();
|
||||||
delete imageCache[removedCachedImage.imageId];
|
decache(removedCachedImage.imagePromise, removedCachedImage.imageId);
|
||||||
removedCachedImage.imagePromise.reject();
|
|
||||||
}
|
}
|
||||||
cacheSizeInBytes = 0;
|
cacheSizeInBytes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeImageIdCacheSize(imageId, newCacheSize) {
|
||||||
|
var cacheEntry = imageCache[imageId];
|
||||||
|
if(cacheEntry) {
|
||||||
|
cacheEntry.imagePromise.then(function(image) {
|
||||||
|
var cacheSizeDifference = newCacheSize - image.sizeInBytes;
|
||||||
|
image.sizeInBytes = newCacheSize;
|
||||||
|
cacheSizeInBytes += cacheSizeDifference;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// module exports
|
// module exports
|
||||||
cornerstone.imageCache = {
|
cornerstone.imageCache = {
|
||||||
putImagePromise : putImagePromise,
|
putImagePromise : putImagePromise,
|
||||||
@ -626,7 +681,8 @@ if(typeof cornerstone === 'undefined'){
|
|||||||
setMaximumSizeBytes: setMaximumSizeBytes,
|
setMaximumSizeBytes: setMaximumSizeBytes,
|
||||||
getCacheInfo : getCacheInfo,
|
getCacheInfo : getCacheInfo,
|
||||||
purgeCache: purgeCache,
|
purgeCache: purgeCache,
|
||||||
cachedImages: cachedImages
|
cachedImages: cachedImages,
|
||||||
|
changeImageIdCacheSize: changeImageIdCacheSize
|
||||||
};
|
};
|
||||||
|
|
||||||
}(cornerstone));
|
}(cornerstone));
|
||||||
@ -1522,38 +1578,39 @@ if(typeof cornerstone === 'undefined'){
|
|||||||
|
|
||||||
function getRenderCanvas(enabledElement, image, invalidated)
|
function getRenderCanvas(enabledElement, image, invalidated)
|
||||||
{
|
{
|
||||||
// apply the lut to the stored pixel data onto the render canvas
|
|
||||||
|
|
||||||
if(enabledElement.viewport.voi.windowWidth === enabledElement.image.windowWidth &&
|
// The ww/wc is identity and not inverted - get a canvas with the image rendered into it for
|
||||||
enabledElement.viewport.voi.windowCenter === enabledElement.image.windowCenter &&
|
// fast drawing
|
||||||
enabledElement.viewport.invert === false)
|
if(enabledElement.viewport.voi.windowWidth === 255 &&
|
||||||
|
enabledElement.viewport.voi.windowCenter === 128 &&
|
||||||
|
enabledElement.viewport.invert === false &&
|
||||||
|
image.getCanvas &&
|
||||||
|
image.getCanvas()
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// the color image voi/invert has not been modified, request the canvas that contains
|
|
||||||
// it so we can draw it directly to the display canvas
|
|
||||||
return image.getCanvas();
|
return image.getCanvas();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if(doesImageNeedToBeRendered(enabledElement, image) === false && invalidated !== true) {
|
|
||||||
return colorRenderCanvas;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If our render canvas does not match the size of this image reset it
|
// apply the lut to the stored pixel data onto the render canvas
|
||||||
// NOTE: This might be inefficient if we are updating multiple images of different
|
if(doesImageNeedToBeRendered(enabledElement, image) === false && invalidated !== true) {
|
||||||
// sizes frequently.
|
|
||||||
if(colorRenderCanvas.width !== image.width || colorRenderCanvas.height != image.height) {
|
|
||||||
initializeColorRenderCanvas(image);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the lut to use
|
|
||||||
var colorLut = getLut(image, enabledElement.viewport);
|
|
||||||
|
|
||||||
// the color image voi/invert has been modified - apply the lut to the underlying
|
|
||||||
// pixel data and put it into the renderCanvas
|
|
||||||
cornerstone.storedColorPixelDataToCanvasImageData(image, colorLut, colorRenderCanvasData.data);
|
|
||||||
colorRenderCanvasContext.putImageData(colorRenderCanvasData, 0, 0);
|
|
||||||
return colorRenderCanvas;
|
return colorRenderCanvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If our render canvas does not match the size of this image reset it
|
||||||
|
// NOTE: This might be inefficient if we are updating multiple images of different
|
||||||
|
// sizes frequently.
|
||||||
|
if(colorRenderCanvas.width !== image.width || colorRenderCanvas.height != image.height) {
|
||||||
|
initializeColorRenderCanvas(image);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the lut to use
|
||||||
|
var colorLut = getLut(image, enabledElement.viewport);
|
||||||
|
|
||||||
|
// the color image voi/invert has been modified - apply the lut to the underlying
|
||||||
|
// pixel data and put it into the renderCanvas
|
||||||
|
cornerstone.storedColorPixelDataToCanvasImageData(image, colorLut, colorRenderCanvasData.data);
|
||||||
|
colorRenderCanvasContext.putImageData(colorRenderCanvasData, 0, 0);
|
||||||
|
return colorRenderCanvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2148,7 +2205,7 @@ if(typeof cornerstone === 'undefined'){
|
|||||||
|
|
||||||
function initShaders() {
|
function initShaders() {
|
||||||
for (var id in cornerstone.webGL.shaders) {
|
for (var id in cornerstone.webGL.shaders) {
|
||||||
//console.log("WEBGL: Loading shader", id);
|
console.log("WEBGL: Loading shader", id);
|
||||||
var shader = cornerstone.webGL.shaders[ id ];
|
var shader = cornerstone.webGL.shaders[ id ];
|
||||||
shader.attributes = {};
|
shader.attributes = {};
|
||||||
shader.uniforms = {};
|
shader.uniforms = {};
|
||||||
@ -2168,13 +2225,13 @@ if(typeof cornerstone === 'undefined'){
|
|||||||
|
|
||||||
function initRenderer() {
|
function initRenderer() {
|
||||||
if (cornerstone.webGL.isWebGLInitialized === true) {
|
if (cornerstone.webGL.isWebGLInitialized === true) {
|
||||||
//console.log("WEBGL Renderer already initialized");
|
console.log("WEBGL Renderer already initialized");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( initWebGL( renderCanvas ) ) {
|
if ( initWebGL( renderCanvas ) ) {
|
||||||
initBuffers();
|
initBuffers();
|
||||||
initShaders();
|
initShaders();
|
||||||
//console.log("WEBGL Renderer initialized!");
|
console.log("WEBGL Renderer initialized!");
|
||||||
cornerstone.webGL.isWebGLInitialized = true;
|
cornerstone.webGL.isWebGLInitialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/*! cornerstoneMath - v0.1.2 - 2015-08-31 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstoneMath */
|
/*! cornerstoneMath - v0.1.3 - 2016-02-04 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstoneMath */
|
||||||
// Begin Source: src/vector3.js
|
// Begin Source: src/vector3.js
|
||||||
// Based on THREE.JS
|
// Based on THREE.JS
|
||||||
|
|
||||||
@ -1651,6 +1651,31 @@ var cornerstoneMath = (function (cornerstoneMath) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the closest source point to a target point
|
||||||
|
* given an array of source points.
|
||||||
|
*
|
||||||
|
* @param sources An Array of source Points
|
||||||
|
* @param target The target Point
|
||||||
|
* @returns Point The closest point from the points array
|
||||||
|
*/
|
||||||
|
function findClosestPoint(sources, target) {
|
||||||
|
var distances = [];
|
||||||
|
var minDistance;
|
||||||
|
sources.forEach(function(source, index) {
|
||||||
|
var distance = cornerstoneMath.point.distance(source, target);
|
||||||
|
distances.push(distance);
|
||||||
|
|
||||||
|
if (index === 0) {
|
||||||
|
minDistance = distance;
|
||||||
|
} else {
|
||||||
|
minDistance = Math.min(distance, minDistance);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var index = distances.indexOf(minDistance);
|
||||||
|
return sources[index];
|
||||||
|
}
|
||||||
|
|
||||||
// module exports
|
// module exports
|
||||||
cornerstoneMath.point =
|
cornerstoneMath.point =
|
||||||
@ -1660,7 +1685,8 @@ var cornerstoneMath = (function (cornerstoneMath) {
|
|||||||
pageToPoint: pageToPoint,
|
pageToPoint: pageToPoint,
|
||||||
distance: distance,
|
distance: distance,
|
||||||
distanceSquared: distanceSquared,
|
distanceSquared: distanceSquared,
|
||||||
insideRect: insideRect
|
insideRect: insideRect,
|
||||||
|
findClosestPoint: findClosestPoint
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1836,7 +1862,6 @@ var cornerstoneMath = (function (cornerstoneMath) {
|
|||||||
|
|
||||||
return (distance < maxDistance);
|
return (distance < maxDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
function distanceToPoint(rect, point)
|
function distanceToPoint(rect, point)
|
||||||
{
|
{
|
||||||
var minDistance = 655535;
|
var minDistance = 655535;
|
||||||
@ -1850,7 +1875,7 @@ var cornerstoneMath = (function (cornerstoneMath) {
|
|||||||
return minDistance;
|
return minDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns top-left and bottom-right of rectangle
|
// Returns top-left and bottom-right points of the rectangle
|
||||||
function rectToPoints (rect) {
|
function rectToPoints (rect) {
|
||||||
var rectPoints = {
|
var rectPoints = {
|
||||||
topLeft: {
|
topLeft: {
|
||||||
@ -1959,11 +1984,12 @@ var cornerstoneMath = (function (cornerstoneMath) {
|
|||||||
// module exports
|
// module exports
|
||||||
cornerstoneMath.rect =
|
cornerstoneMath.rect =
|
||||||
{
|
{
|
||||||
rectToLineSegments : distanceToPoint,
|
distanceToPoint : distanceToPoint,
|
||||||
getIntersectionRect : getIntersectionRect
|
getIntersectionRect : getIntersectionRect
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return cornerstoneMath;
|
return cornerstoneMath;
|
||||||
}(cornerstoneMath));
|
}(cornerstoneMath));
|
||||||
// End Source; src/rect.js
|
// End Source; src/rect.js
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
/*! cornerstone-wado-image-loader - v0.9.0 - 2016-02-08 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstoneWADOImageLoader */
|
/*! cornerstone-wado-image-loader - v0.9.1 - 2016-02-09 | (c) 2014 Chris Hafey | https://github.com/chafey/cornerstoneWADOImageLoader */
|
||||||
//
|
//
|
||||||
// This is a cornerstone image loader for WADO-URI requests. It has limited support for compressed
|
// This is a cornerstone image loader for WADO-URI requests. It has limited support for compressed
|
||||||
// transfer syntaxes, check here to see what is currently supported:
|
// transfer syntaxes, check here to see what is currently supported:
|
||||||
@ -4294,7 +4294,7 @@ var JpegImage = (function jpegImage() {
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// module exports
|
// module exports
|
||||||
cornerstoneWADOImageLoader.version = '0.9.0';
|
cornerstoneWADOImageLoader.version = '0.9.1';
|
||||||
|
|
||||||
}(cornerstoneWADOImageLoader));
|
}(cornerstoneWADOImageLoader));
|
||||||
(function ($, cornerstone, cornerstoneWADOImageLoader) {
|
(function ($, cornerstone, cornerstoneWADOImageLoader) {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/*! Hammer.JS - v2.0.4 - 2015-09-25
|
/*! Hammer.JS - v2.0.6 - 2015-12-23
|
||||||
* http://hammerjs.github.io/
|
* http://hammerjs.github.io/
|
||||||
*
|
*
|
||||||
* Copyright (c) 2015 Jorik Tangelder;
|
* Copyright (c) 2015 Jorik Tangelder;
|
||||||
@ -6,7 +6,7 @@
|
|||||||
(function(window, document, exportName, undefined) {
|
(function(window, document, exportName, undefined) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var VENDOR_PREFIXES = ['', 'webkit', 'moz', 'MS', 'ms', 'o'];
|
var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
|
||||||
var TEST_ELEMENT = document.createElement('div');
|
var TEST_ELEMENT = document.createElement('div');
|
||||||
|
|
||||||
var TYPE_FUNCTION = 'function';
|
var TYPE_FUNCTION = 'function';
|
||||||
@ -71,15 +71,69 @@ function each(obj, iterator, context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wrap a method with a deprecation warning and stack trace
|
||||||
|
* @param {Function} method
|
||||||
|
* @param {String} name
|
||||||
|
* @param {String} message
|
||||||
|
* @returns {Function} A new function wrapping the supplied method.
|
||||||
|
*/
|
||||||
|
function deprecate(method, name, message) {
|
||||||
|
var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n';
|
||||||
|
return function() {
|
||||||
|
var e = new Error('get-stack-trace');
|
||||||
|
var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '')
|
||||||
|
.replace(/^\s+at\s+/gm, '')
|
||||||
|
.replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';
|
||||||
|
|
||||||
|
var log = window.console && (window.console.warn || window.console.log);
|
||||||
|
if (log) {
|
||||||
|
log.call(window.console, deprecationMessage, stack);
|
||||||
|
}
|
||||||
|
return method.apply(this, arguments);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* extend object.
|
||||||
|
* means that properties in dest will be overwritten by the ones in src.
|
||||||
|
* @param {Object} target
|
||||||
|
* @param {...Object} objects_to_assign
|
||||||
|
* @returns {Object} target
|
||||||
|
*/
|
||||||
|
var assign;
|
||||||
|
if (typeof Object.assign !== 'function') {
|
||||||
|
assign = function assign(target) {
|
||||||
|
if (target === undefined || target === null) {
|
||||||
|
throw new TypeError('Cannot convert undefined or null to object');
|
||||||
|
}
|
||||||
|
|
||||||
|
var output = Object(target);
|
||||||
|
for (var index = 1; index < arguments.length; index++) {
|
||||||
|
var source = arguments[index];
|
||||||
|
if (source !== undefined && source !== null) {
|
||||||
|
for (var nextKey in source) {
|
||||||
|
if (source.hasOwnProperty(nextKey)) {
|
||||||
|
output[nextKey] = source[nextKey];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
assign = Object.assign;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* extend object.
|
* extend object.
|
||||||
* means that properties in dest will be overwritten by the ones in src.
|
* means that properties in dest will be overwritten by the ones in src.
|
||||||
* @param {Object} dest
|
* @param {Object} dest
|
||||||
* @param {Object} src
|
* @param {Object} src
|
||||||
* @param {Boolean} [merge]
|
* @param {Boolean=false} [merge]
|
||||||
* @returns {Object} dest
|
* @returns {Object} dest
|
||||||
*/
|
*/
|
||||||
function extend(dest, src, merge) {
|
var extend = deprecate(function extend(dest, src, merge) {
|
||||||
var keys = Object.keys(src);
|
var keys = Object.keys(src);
|
||||||
var i = 0;
|
var i = 0;
|
||||||
while (i < keys.length) {
|
while (i < keys.length) {
|
||||||
@ -89,7 +143,7 @@ function extend(dest, src, merge) {
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}, 'extend', 'Use `assign`.');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* merge the values from src in the dest.
|
* merge the values from src in the dest.
|
||||||
@ -98,9 +152,9 @@ function extend(dest, src, merge) {
|
|||||||
* @param {Object} src
|
* @param {Object} src
|
||||||
* @returns {Object} dest
|
* @returns {Object} dest
|
||||||
*/
|
*/
|
||||||
function merge(dest, src) {
|
var merge = deprecate(function merge(dest, src) {
|
||||||
return extend(dest, src, true);
|
return extend(dest, src, true);
|
||||||
}
|
}, 'merge', 'Use `assign`.');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* simple class inheritance
|
* simple class inheritance
|
||||||
@ -117,7 +171,7 @@ function inherit(child, base, properties) {
|
|||||||
childP._super = baseP;
|
childP._super = baseP;
|
||||||
|
|
||||||
if (properties) {
|
if (properties) {
|
||||||
extend(childP, properties);
|
assign(childP, properties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,7 +852,7 @@ var POINTER_ELEMENT_EVENTS = 'pointerdown';
|
|||||||
var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';
|
var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';
|
||||||
|
|
||||||
// IE10 has prefixed support, and case-sensitive
|
// IE10 has prefixed support, and case-sensitive
|
||||||
if (window.MSPointerEvent) {
|
if (window.MSPointerEvent && !window.PointerEvent) {
|
||||||
POINTER_ELEMENT_EVENTS = 'MSPointerDown';
|
POINTER_ELEMENT_EVENTS = 'MSPointerDown';
|
||||||
POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
|
POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
|
||||||
}
|
}
|
||||||
@ -1185,6 +1239,11 @@ TouchAction.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasPanX && hasPanY) {
|
||||||
|
// `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (hasNone ||
|
if (hasNone ||
|
||||||
(hasPanY && direction & DIRECTION_HORIZONTAL) ||
|
(hasPanY && direction & DIRECTION_HORIZONTAL) ||
|
||||||
(hasPanX && direction & DIRECTION_VERTICAL)) {
|
(hasPanX && direction & DIRECTION_VERTICAL)) {
|
||||||
@ -1216,9 +1275,12 @@ function cleanTouchActions(actions) {
|
|||||||
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
|
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
|
||||||
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
|
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
|
||||||
|
|
||||||
// pan-x and pan-y can be combined
|
// if both pan-x and pan-y are set (different recognizers
|
||||||
|
// for different directions, e.g. horizontal pan but vertical swipe?)
|
||||||
|
// we need none (as otherwise with pan-x pan-y combined none of these
|
||||||
|
// recognizers will work, since the browser would handle all panning
|
||||||
if (hasPanX && hasPanY) {
|
if (hasPanX && hasPanY) {
|
||||||
return TOUCH_ACTION_PAN_X + ' ' + TOUCH_ACTION_PAN_Y;
|
return TOUCH_ACTION_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pan-x OR pan-y
|
// pan-x OR pan-y
|
||||||
@ -1276,13 +1338,11 @@ var STATE_FAILED = 32;
|
|||||||
* @param {Object} options
|
* @param {Object} options
|
||||||
*/
|
*/
|
||||||
function Recognizer(options) {
|
function Recognizer(options) {
|
||||||
// make sure, options are copied over to a new object to prevent leaking it outside
|
this.options = assign({}, this.defaults, options || {});
|
||||||
options = extend({}, options || {});
|
|
||||||
|
|
||||||
this.id = uniqueId();
|
this.id = uniqueId();
|
||||||
|
|
||||||
this.manager = null;
|
this.manager = null;
|
||||||
this.options = merge(options, this.defaults);
|
|
||||||
|
|
||||||
// default is enable true
|
// default is enable true
|
||||||
this.options.enable = ifUndefined(this.options.enable, true);
|
this.options.enable = ifUndefined(this.options.enable, true);
|
||||||
@ -1306,7 +1366,7 @@ Recognizer.prototype = {
|
|||||||
* @return {Recognizer}
|
* @return {Recognizer}
|
||||||
*/
|
*/
|
||||||
set: function(options) {
|
set: function(options) {
|
||||||
extend(this.options, options);
|
assign(this.options, options);
|
||||||
|
|
||||||
// also update the touchAction, in case something changed about the directions/enabled state
|
// also update the touchAction, in case something changed about the directions/enabled state
|
||||||
this.manager && this.manager.touchAction.update();
|
this.manager && this.manager.touchAction.update();
|
||||||
@ -1467,7 +1527,7 @@ Recognizer.prototype = {
|
|||||||
recognize: function(inputData) {
|
recognize: function(inputData) {
|
||||||
// make a new copy of the inputData
|
// make a new copy of the inputData
|
||||||
// so we can change the inputData without messing up the other recognizers
|
// so we can change the inputData without messing up the other recognizers
|
||||||
var inputDataClone = extend({}, inputData);
|
var inputDataClone = assign({}, inputData);
|
||||||
|
|
||||||
// is is enabled and allow recognizing?
|
// is is enabled and allow recognizing?
|
||||||
if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
|
if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
|
||||||
@ -1654,10 +1714,10 @@ inherit(PanRecognizer, AttrRecognizer, {
|
|||||||
var direction = this.options.direction;
|
var direction = this.options.direction;
|
||||||
var actions = [];
|
var actions = [];
|
||||||
if (direction & DIRECTION_HORIZONTAL) {
|
if (direction & DIRECTION_HORIZONTAL) {
|
||||||
actions.push(TOUCH_ACTION_PAN_X);
|
actions.push(TOUCH_ACTION_PAN_Y);
|
||||||
}
|
}
|
||||||
if (direction & DIRECTION_VERTICAL) {
|
if (direction & DIRECTION_VERTICAL) {
|
||||||
actions.push(TOUCH_ACTION_PAN_Y);
|
actions.push(TOUCH_ACTION_PAN_X);
|
||||||
}
|
}
|
||||||
return actions;
|
return actions;
|
||||||
},
|
},
|
||||||
@ -1765,8 +1825,8 @@ inherit(PressRecognizer, Recognizer, {
|
|||||||
defaults: {
|
defaults: {
|
||||||
event: 'press',
|
event: 'press',
|
||||||
pointers: 1,
|
pointers: 1,
|
||||||
time: 500, // minimal time of the pointer to be pressed
|
time: 251, // minimal time of the pointer to be pressed
|
||||||
threshold: 5 // a minimal movement is ok, but keep it low
|
threshold: 9 // a minimal movement is ok, but keep it low
|
||||||
},
|
},
|
||||||
|
|
||||||
getTouchAction: function() {
|
getTouchAction: function() {
|
||||||
@ -1864,7 +1924,7 @@ inherit(SwipeRecognizer, AttrRecognizer, {
|
|||||||
defaults: {
|
defaults: {
|
||||||
event: 'swipe',
|
event: 'swipe',
|
||||||
threshold: 10,
|
threshold: 10,
|
||||||
velocity: 0.65,
|
velocity: 0.3,
|
||||||
direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
|
direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
|
||||||
pointers: 1
|
pointers: 1
|
||||||
},
|
},
|
||||||
@ -1936,7 +1996,7 @@ inherit(TapRecognizer, Recognizer, {
|
|||||||
taps: 1,
|
taps: 1,
|
||||||
interval: 300, // max time between the multi-tap taps
|
interval: 300, // max time between the multi-tap taps
|
||||||
time: 250, // max time of the pointer to be down (like finger on the screen)
|
time: 250, // max time of the pointer to be down (like finger on the screen)
|
||||||
threshold: 2, // a minimal movement is ok, but keep it low
|
threshold: 9, // a minimal movement is ok, but keep it low
|
||||||
posThreshold: 10 // a multi-tap can be a bit off the initial position
|
posThreshold: 10 // a multi-tap can be a bit off the initial position
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -2018,7 +2078,7 @@ inherit(TapRecognizer, Recognizer, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple way to create an manager with a default set of recognizers.
|
* Simple way to create a manager with a default set of recognizers.
|
||||||
* @param {HTMLElement} element
|
* @param {HTMLElement} element
|
||||||
* @param {Object} [options]
|
* @param {Object} [options]
|
||||||
* @constructor
|
* @constructor
|
||||||
@ -2032,7 +2092,7 @@ function Hammer(element, options) {
|
|||||||
/**
|
/**
|
||||||
* @const {string}
|
* @const {string}
|
||||||
*/
|
*/
|
||||||
Hammer.VERSION = '2.0.4';
|
Hammer.VERSION = '2.0.6';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default settings
|
* default settings
|
||||||
@ -2156,9 +2216,8 @@ var FORCED_STOP = 2;
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function Manager(element, options) {
|
function Manager(element, options) {
|
||||||
options = options || {};
|
this.options = assign({}, Hammer.defaults, options || {});
|
||||||
|
|
||||||
this.options = merge(options, Hammer.defaults);
|
|
||||||
this.options.inputTarget = this.options.inputTarget || element;
|
this.options.inputTarget = this.options.inputTarget || element;
|
||||||
|
|
||||||
this.handlers = {};
|
this.handlers = {};
|
||||||
@ -2171,7 +2230,7 @@ function Manager(element, options) {
|
|||||||
|
|
||||||
toggleCssProps(this, true);
|
toggleCssProps(this, true);
|
||||||
|
|
||||||
each(options.recognizers, function(item) {
|
each(this.options.recognizers, function(item) {
|
||||||
var recognizer = this.add(new (item[0])(item[1]));
|
var recognizer = this.add(new (item[0])(item[1]));
|
||||||
item[2] && recognizer.recognizeWith(item[2]);
|
item[2] && recognizer.recognizeWith(item[2]);
|
||||||
item[3] && recognizer.requireFailure(item[3]);
|
item[3] && recognizer.requireFailure(item[3]);
|
||||||
@ -2185,7 +2244,7 @@ Manager.prototype = {
|
|||||||
* @returns {Manager}
|
* @returns {Manager}
|
||||||
*/
|
*/
|
||||||
set: function(options) {
|
set: function(options) {
|
||||||
extend(this.options, options);
|
assign(this.options, options);
|
||||||
|
|
||||||
// Options that need a little more setup
|
// Options that need a little more setup
|
||||||
if (options.touchAction) {
|
if (options.touchAction) {
|
||||||
@ -2319,11 +2378,19 @@ Manager.prototype = {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
var recognizers = this.recognizers;
|
|
||||||
recognizer = this.get(recognizer);
|
recognizer = this.get(recognizer);
|
||||||
recognizers.splice(inArray(recognizers, recognizer), 1);
|
|
||||||
|
|
||||||
this.touchAction.update();
|
// let's make sure this recognizer exists
|
||||||
|
if (recognizer) {
|
||||||
|
var recognizers = this.recognizers;
|
||||||
|
var index = inArray(recognizers, recognizer);
|
||||||
|
|
||||||
|
if (index !== -1) {
|
||||||
|
recognizers.splice(index, 1);
|
||||||
|
this.touchAction.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -2354,7 +2421,7 @@ Manager.prototype = {
|
|||||||
if (!handler) {
|
if (!handler) {
|
||||||
delete handlers[event];
|
delete handlers[event];
|
||||||
} else {
|
} else {
|
||||||
handlers[event].splice(inArray(handlers[event], handler), 1);
|
handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
@ -2430,7 +2497,7 @@ function triggerDomEvent(event, data) {
|
|||||||
data.target.dispatchEvent(gestureEvent);
|
data.target.dispatchEvent(gestureEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
extend(Hammer, {
|
assign(Hammer, {
|
||||||
INPUT_START: INPUT_START,
|
INPUT_START: INPUT_START,
|
||||||
INPUT_MOVE: INPUT_MOVE,
|
INPUT_MOVE: INPUT_MOVE,
|
||||||
INPUT_END: INPUT_END,
|
INPUT_END: INPUT_END,
|
||||||
@ -2477,12 +2544,18 @@ extend(Hammer, {
|
|||||||
each: each,
|
each: each,
|
||||||
merge: merge,
|
merge: merge,
|
||||||
extend: extend,
|
extend: extend,
|
||||||
|
assign: assign,
|
||||||
inherit: inherit,
|
inherit: inherit,
|
||||||
bindFn: bindFn,
|
bindFn: bindFn,
|
||||||
prefixed: prefixed
|
prefixed: prefixed
|
||||||
});
|
});
|
||||||
|
|
||||||
if (typeof define == TYPE_FUNCTION && define.amd) {
|
// this prevents errors when Hammer is loaded in the presence of an AMD
|
||||||
|
// style loader but by script tag, not by the loader.
|
||||||
|
var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line
|
||||||
|
freeGlobal.Hammer = Hammer;
|
||||||
|
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
define(function() {
|
define(function() {
|
||||||
return Hammer;
|
return Hammer;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -32,7 +32,77 @@
|
|||||||
//doneCallback(prompt('Change your lesion location:'));
|
//doneCallback(prompt('Change your lesion location:'));
|
||||||
}
|
}
|
||||||
|
|
||||||
///////// BEGIN ACTIVE TOOL ///////
|
function createNewMeasurement(mouseEventData) {
|
||||||
|
var imageId = mouseEventData.image.imageId;
|
||||||
|
|
||||||
|
// Get studyInstanceUid
|
||||||
|
var study = cornerstoneTools.metaData.get('study', imageId);
|
||||||
|
var studyInstanceUid = study.studyInstanceUid;
|
||||||
|
var patientId = study.patientId;
|
||||||
|
|
||||||
|
// Get seriesInstanceUid
|
||||||
|
var series = cornerstoneTools.metaData.get('series', imageId);
|
||||||
|
var seriesInstanceUid = series.seriesInstanceUid;
|
||||||
|
|
||||||
|
// Create the measurement data for this tool with the end handle activated
|
||||||
|
var measurementData = {
|
||||||
|
visible: true,
|
||||||
|
active: true,
|
||||||
|
handles: {
|
||||||
|
start: {
|
||||||
|
x: mouseEventData.currentPoints.image.x,
|
||||||
|
y: mouseEventData.currentPoints.image.y,
|
||||||
|
highlight: true,
|
||||||
|
active: false,
|
||||||
|
drawnIndependently: true,
|
||||||
|
index: 0
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
x: mouseEventData.currentPoints.image.x,
|
||||||
|
y: mouseEventData.currentPoints.image.y,
|
||||||
|
highlight: true,
|
||||||
|
active: true,
|
||||||
|
drawnIndependently: true,
|
||||||
|
index: 1
|
||||||
|
},
|
||||||
|
textBox: {
|
||||||
|
x: mouseEventData.currentPoints.image.x - 50,
|
||||||
|
y: mouseEventData.currentPoints.image.y - 70,
|
||||||
|
active: false,
|
||||||
|
movesIndependently: false,
|
||||||
|
drawnIndependently: true,
|
||||||
|
allowedOutsideImage: true,
|
||||||
|
hasBoundingBox: true
|
||||||
|
},
|
||||||
|
perpendicularStart: {
|
||||||
|
x: mouseEventData.currentPoints.image.x,
|
||||||
|
y: mouseEventData.currentPoints.image.y,
|
||||||
|
highlight: true,
|
||||||
|
active: false,
|
||||||
|
locked: true, // If perpendicular line is connected to long-line
|
||||||
|
drawnIndependently: true,
|
||||||
|
index: 2
|
||||||
|
},
|
||||||
|
perpendicularEnd: {
|
||||||
|
x: mouseEventData.currentPoints.image.x,
|
||||||
|
y: mouseEventData.currentPoints.image.y,
|
||||||
|
highlight: true,
|
||||||
|
active: false,
|
||||||
|
drawnIndependently: true,
|
||||||
|
index: 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
imageId: imageId,
|
||||||
|
seriesInstanceUid: seriesInstanceUid,
|
||||||
|
studyInstanceUid: studyInstanceUid,
|
||||||
|
patientId: patientId,
|
||||||
|
longestDiameter: 0,
|
||||||
|
shortestDiameter: 0,
|
||||||
|
isDeleted: false,
|
||||||
|
isTarget: true
|
||||||
|
};
|
||||||
|
return measurementData;
|
||||||
|
}
|
||||||
|
|
||||||
function addNewMeasurement(mouseEventData) {
|
function addNewMeasurement(mouseEventData) {
|
||||||
var element = mouseEventData.element;
|
var element = mouseEventData.element;
|
||||||
@ -53,9 +123,9 @@
|
|||||||
var eventData = {
|
var eventData = {
|
||||||
mouseButtonMask: mouseEventData.which
|
mouseButtonMask: mouseEventData.which
|
||||||
};
|
};
|
||||||
var config = cornerstoneTools.lesion.getConfiguration();
|
|
||||||
|
|
||||||
// Set lesion number and lesion name
|
// Set lesion number and lesion name
|
||||||
|
var config = cornerstoneTools.lesion.getConfiguration();
|
||||||
if (measurementData.lesionNumber === undefined) {
|
if (measurementData.lesionNumber === undefined) {
|
||||||
config.setLesionNumberCallback(measurementData, mouseEventData, doneCallback);
|
config.setLesionNumberCallback(measurementData, mouseEventData, doneCallback);
|
||||||
}
|
}
|
||||||
@ -128,6 +198,12 @@
|
|||||||
|
|
||||||
var measurementData = createNewMeasurement(touchEventData);
|
var measurementData = createNewMeasurement(touchEventData);
|
||||||
|
|
||||||
|
// Set lesion number and lesion name
|
||||||
|
var config = cornerstoneTools.lesion.getConfiguration();
|
||||||
|
if (measurementData.lesionNumber === undefined) {
|
||||||
|
config.setLesionNumberCallback(measurementData, mouseEventData, doneCallback);
|
||||||
|
}
|
||||||
|
|
||||||
// associate this data with this imageId so we can render it and manipulate it
|
// associate this data with this imageId so we can render it and manipulate it
|
||||||
cornerstoneTools.addToolState(element, toolType, measurementData);
|
cornerstoneTools.addToolState(element, toolType, measurementData);
|
||||||
|
|
||||||
@ -139,9 +215,12 @@
|
|||||||
|
|
||||||
cornerstone.updateImage(element);
|
cornerstone.updateImage(element);
|
||||||
cornerstoneTools.moveNewHandleTouch(touchEventData, toolType, measurementData, measurementData.handles.end, function() {
|
cornerstoneTools.moveNewHandleTouch(touchEventData, toolType, measurementData, measurementData.handles.end, function() {
|
||||||
if (cornerstoneTools.anyHandlesOutsideImage(touchEventData, measurementData.handles)) {
|
if (cancelled || cornerstoneTools.anyHandlesOutsideImage(touchEventData, measurementData.handles)) {
|
||||||
// delete the measurement
|
// delete the measurement
|
||||||
cornerstoneTools.removeToolState(element, toolType, measurementData);
|
cornerstoneTools.removeToolState(element, toolType, measurementData);
|
||||||
|
} else {
|
||||||
|
// Set lesionMeasurementData Session
|
||||||
|
config.getLesionLocationCallback(measurementData, touchEventData, doneCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
// perpendicular line is not connected to long-line
|
// perpendicular line is not connected to long-line
|
||||||
@ -154,80 +233,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function createNewMeasurement(mouseEventData) {
|
|
||||||
var imageId = mouseEventData.image.imageId;
|
|
||||||
|
|
||||||
// Get studyInstanceUid
|
|
||||||
var study = cornerstoneTools.metaData.get('study', imageId);
|
|
||||||
var studyInstanceUid = study.studyInstanceUid;
|
|
||||||
var patientId = study.patientId;
|
|
||||||
|
|
||||||
// Get seriesInstanceUid
|
|
||||||
var series = cornerstoneTools.metaData.get('series', imageId);
|
|
||||||
var seriesInstanceUid = series.seriesInstanceUid;
|
|
||||||
|
|
||||||
// Create the measurement data for this tool with the end handle activated
|
|
||||||
var measurementData = {
|
|
||||||
visible: true,
|
|
||||||
active: true,
|
|
||||||
handles: {
|
|
||||||
start: {
|
|
||||||
x: mouseEventData.currentPoints.image.x,
|
|
||||||
y: mouseEventData.currentPoints.image.y,
|
|
||||||
highlight: true,
|
|
||||||
active: false,
|
|
||||||
drawnIndependently: true,
|
|
||||||
index: 0
|
|
||||||
},
|
|
||||||
end: {
|
|
||||||
x: mouseEventData.currentPoints.image.x,
|
|
||||||
y: mouseEventData.currentPoints.image.y,
|
|
||||||
highlight: true,
|
|
||||||
active: true,
|
|
||||||
drawnIndependently: true,
|
|
||||||
index: 1
|
|
||||||
},
|
|
||||||
textBox: {
|
|
||||||
x: mouseEventData.currentPoints.image.x - 50,
|
|
||||||
y: mouseEventData.currentPoints.image.y - 70,
|
|
||||||
pointNearHandle: pointNearTextBox,
|
|
||||||
active: false,
|
|
||||||
movesIndependently: false,
|
|
||||||
drawnIndependently: true,
|
|
||||||
allowedOutsideImage: true
|
|
||||||
},
|
|
||||||
perpendicularStart: {
|
|
||||||
x: mouseEventData.currentPoints.image.x,
|
|
||||||
y: mouseEventData.currentPoints.image.y,
|
|
||||||
highlight: true,
|
|
||||||
active: false,
|
|
||||||
locked: true, // If perpendicular line is connected to long-line
|
|
||||||
drawnIndependently: true,
|
|
||||||
index: 2
|
|
||||||
},
|
|
||||||
perpendicularEnd: {
|
|
||||||
x: mouseEventData.currentPoints.image.x,
|
|
||||||
y: mouseEventData.currentPoints.image.y,
|
|
||||||
highlight: true,
|
|
||||||
active: false,
|
|
||||||
drawnIndependently: true,
|
|
||||||
index: 3
|
|
||||||
}
|
|
||||||
},
|
|
||||||
imageId: imageId,
|
|
||||||
seriesInstanceUid: seriesInstanceUid,
|
|
||||||
studyInstanceUid: studyInstanceUid,
|
|
||||||
patientId: patientId,
|
|
||||||
measurementText: 0,
|
|
||||||
widthMeasurement: 0,
|
|
||||||
perpendicularMeasurement: 0,
|
|
||||||
isDeleted: false,
|
|
||||||
isTarget: true
|
|
||||||
};
|
|
||||||
return measurementData;
|
|
||||||
}
|
|
||||||
///////// END ACTIVE TOOL ///////
|
|
||||||
|
|
||||||
function pointNearTool(element, data, coords) {
|
function pointNearTool(element, data, coords) {
|
||||||
var lineSegment = {
|
var lineSegment = {
|
||||||
start: cornerstone.pixelToCanvas(element, data.handles.start),
|
start: cornerstone.pixelToCanvas(element, data.handles.start),
|
||||||
@ -235,7 +240,7 @@
|
|||||||
};
|
};
|
||||||
var distanceToPoint = cornerstoneMath.lineSegment.distanceToPoint(lineSegment, coords);
|
var distanceToPoint = cornerstoneMath.lineSegment.distanceToPoint(lineSegment, coords);
|
||||||
|
|
||||||
if (pointNearTextBox(element, data.handles.textBox, coords)) {
|
if (cornerstoneTools.pointInsideBoundingBox(data.handles.textBox, coords)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,14 +251,6 @@
|
|||||||
return (distanceToPoint < 5);
|
return (distanceToPoint < 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
function pointNearTextBox(element, handle, coords) {
|
|
||||||
if (!handle.boundingBox) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cornerstoneMath.point.insideRect(coords, handle.boundingBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
function pointNearPerpendicular(element, handles, coords) {
|
function pointNearPerpendicular(element, handles, coords) {
|
||||||
var lineSegment = {
|
var lineSegment = {
|
||||||
start: cornerstone.pixelToCanvas(element, handles.perpendicularStart),
|
start: cornerstone.pixelToCanvas(element, handles.perpendicularStart),
|
||||||
@ -265,7 +262,6 @@
|
|||||||
|
|
||||||
// Move long-axis start point
|
// Move long-axis start point
|
||||||
function perpendicularBothFixedLeft(eventData, data) {
|
function perpendicularBothFixedLeft(eventData, data) {
|
||||||
|
|
||||||
var longLine = {
|
var longLine = {
|
||||||
start: {
|
start: {
|
||||||
x: data.handles.start.x,
|
x: data.handles.start.x,
|
||||||
@ -273,7 +269,7 @@
|
|||||||
},
|
},
|
||||||
end: {
|
end: {
|
||||||
x: data.handles.end.x,
|
x: data.handles.end.x,
|
||||||
y: data.handles. end.y
|
y: data.handles.end.y
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -284,7 +280,7 @@
|
|||||||
},
|
},
|
||||||
end: {
|
end: {
|
||||||
x: data.handles.perpendicularEnd.x,
|
x: data.handles.perpendicularEnd.x,
|
||||||
y: data.handles. perpendicularEnd.y
|
y: data.handles.perpendicularEnd.y
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -322,7 +318,6 @@
|
|||||||
|
|
||||||
// Move long-axis end point
|
// Move long-axis end point
|
||||||
function perpendicularBothFixedRight(eventData, data) {
|
function perpendicularBothFixedRight(eventData, data) {
|
||||||
|
|
||||||
var longLine = {
|
var longLine = {
|
||||||
start: {
|
start: {
|
||||||
x: data.handles.start.x,
|
x: data.handles.start.x,
|
||||||
@ -330,7 +325,7 @@
|
|||||||
},
|
},
|
||||||
end: {
|
end: {
|
||||||
x: data.handles.end.x,
|
x: data.handles.end.x,
|
||||||
y: data.handles. end.y
|
y: data.handles.end.y
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -341,7 +336,7 @@
|
|||||||
},
|
},
|
||||||
end: {
|
end: {
|
||||||
x: data.handles.perpendicularEnd.x,
|
x: data.handles.perpendicularEnd.x,
|
||||||
y: data.handles. perpendicularEnd.y
|
y: data.handles.perpendicularEnd.y
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1046,8 +1041,8 @@
|
|||||||
data.handles.textBox.boundingBox = boundingBox;
|
data.handles.textBox.boundingBox = boundingBox;
|
||||||
|
|
||||||
// Set measurement text to show lesion table
|
// Set measurement text to show lesion table
|
||||||
data.measurementText = length.toFixed(1);
|
data.longestDiameter = length.toFixed(1);
|
||||||
data.widthMeasurement = width.toFixed(1);
|
data.shortestDiameter = width.toFixed(1);
|
||||||
|
|
||||||
context.restore();
|
context.restore();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -141,18 +141,18 @@
|
|||||||
textBox: {
|
textBox: {
|
||||||
x: mouseEventData.currentPoints.image.x - 50,
|
x: mouseEventData.currentPoints.image.x - 50,
|
||||||
y: mouseEventData.currentPoints.image.y - 50,
|
y: mouseEventData.currentPoints.image.y - 50,
|
||||||
pointNearHandle: pointNearTextBox,
|
|
||||||
active: false,
|
active: false,
|
||||||
movesIndependently: false,
|
movesIndependently: false,
|
||||||
drawnIndependently: true,
|
drawnIndependently: true,
|
||||||
allowedOutsideImage: true
|
allowedOutsideImage: true,
|
||||||
|
hasBoundingBox: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
imageId: imageId,
|
imageId: imageId,
|
||||||
seriesInstanceUid: seriesInstanceUid,
|
seriesInstanceUid: seriesInstanceUid,
|
||||||
studyInstanceUid: studyInstanceUid,
|
studyInstanceUid: studyInstanceUid,
|
||||||
patientId: patientId,
|
patientId: patientId,
|
||||||
measurementText: '',
|
response: '',
|
||||||
isTarget: false
|
isTarget: false
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -167,21 +167,13 @@
|
|||||||
};
|
};
|
||||||
var distanceToPoint = cornerstoneMath.lineSegment.distanceToPoint(lineSegment, coords);
|
var distanceToPoint = cornerstoneMath.lineSegment.distanceToPoint(lineSegment, coords);
|
||||||
|
|
||||||
if (pointNearTextBox(element, data.handles.textBox, coords)) {
|
if (cornerstoneTools.pointInsideBoundingBox(data.handles.textBox, coords)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return distanceToPoint < 25;
|
return distanceToPoint < 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pointNearTextBox(element, handle, coords) {
|
|
||||||
if (!handle.boundingBox) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cornerstoneMath.point.insideRect(coords, handle.boundingBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
///////// BEGIN IMAGE RENDERING ///////
|
///////// BEGIN IMAGE RENDERING ///////
|
||||||
function onImageRendered(e, eventData) {
|
function onImageRendered(e, eventData) {
|
||||||
var element = eventData.element;
|
var element = eventData.element;
|
||||||
|
|||||||
@ -79,7 +79,7 @@ Template.lesionTable.onRendered(function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('ViewerData changed, check for displayed timepoints');
|
log.info('ViewerData changed, check for displayed timepoints');
|
||||||
|
|
||||||
// Get study dates of imageViewerViewport elements
|
// Get study dates of imageViewerViewport elements
|
||||||
var loadedStudyDates = {
|
var loadedStudyDates = {
|
||||||
|
|||||||
@ -290,8 +290,7 @@ Template.nonTargetLesionDialog.events({
|
|||||||
/// Set the isTarget value to true, since this is the target-lesion dialog callback
|
/// Set the isTarget value to true, since this is the target-lesion dialog callback
|
||||||
measurementData.isTarget = false;
|
measurementData.isTarget = false;
|
||||||
|
|
||||||
// measurementText is set from location response list
|
// Response is set from location response list
|
||||||
measurementData.measurementText = responseOptionId;
|
|
||||||
measurementData.response = responseOptionId;
|
measurementData.response = responseOptionId;
|
||||||
|
|
||||||
// Adds lesion data to timepoints array
|
// Adds lesion data to timepoints array
|
||||||
|
|||||||
@ -109,8 +109,7 @@ Template.nonTargetResponseDialog.events({
|
|||||||
/// Set the isTarget value to true, since this is the target-lesion dialog callback
|
/// Set the isTarget value to true, since this is the target-lesion dialog callback
|
||||||
measurementData.isTarget = false;
|
measurementData.isTarget = false;
|
||||||
|
|
||||||
// measurementText is set from location response list
|
// Response is set from location response list
|
||||||
measurementData.measurementText = responseOptionId;
|
|
||||||
measurementData.response = responseOptionId;
|
measurementData.response = responseOptionId;
|
||||||
|
|
||||||
// Adds lesion data to timepoints array
|
// Adds lesion data to timepoints array
|
||||||
|
|||||||
@ -47,8 +47,8 @@ function updateLesionData(lesionData) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (lesionData.isTarget === true) {
|
if (lesionData.isTarget === true) {
|
||||||
timepointData.shortestDiameter = lesionData.widthMeasurement;
|
timepointData.shortestDiameter = lesionData.shortestDiameter;
|
||||||
timepointData.longestDiameter = lesionData.measurementText;
|
timepointData.longestDiameter = lesionData.longestDiameter;
|
||||||
} else {
|
} else {
|
||||||
timepointData.response = lesionData.response;
|
timepointData.response = lesionData.response;
|
||||||
}
|
}
|
||||||
@ -79,27 +79,15 @@ function updateLesionData(lesionData) {
|
|||||||
measurement.timepoints[timepoint.timepointId] = timepointData;
|
measurement.timepoints[timepoint.timepointId] = timepointData;
|
||||||
|
|
||||||
// Set a flag to prevent duplication of toolData
|
// Set a flag to prevent duplication of toolData
|
||||||
measurement.toolDataInsertedManually = true;
|
measurement.clientId = ClientId;
|
||||||
|
|
||||||
// Increment and store the absolute Lesion Number for this Measurement
|
// Increment and store the absolute Lesion Number for this Measurement
|
||||||
measurement.lesionNumberAbsolute = Measurements.find().count() + 1;
|
measurement.lesionNumberAbsolute = Measurements.find().count() + 1;
|
||||||
|
|
||||||
// Insert this into the Measurements Collection
|
// Insert this into the Measurements Collection
|
||||||
// Save the ID into the toolData (not sure if this works?)
|
// Save the ID into the toolData (not sure if this works?)
|
||||||
console.log('LesionManager inserting Measurement');
|
log.info('LesionManager inserting Measurement');
|
||||||
measurement.id = Measurements.insert(measurement);
|
measurement.id = Measurements.insert(measurement);
|
||||||
|
|
||||||
// Update the database entry so it can be re-added next time the study is loaded
|
|
||||||
Measurements.update(measurement.id, {
|
|
||||||
$set: {
|
|
||||||
toolDataInsertedManually: false
|
|
||||||
}
|
|
||||||
}, function(error) {
|
|
||||||
if (error) {
|
|
||||||
log.warn(error);
|
|
||||||
}
|
|
||||||
OHIF.viewer.manuallyModifyingMeasurement = false;
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
lesionData.id = existingMeasurement._id;
|
lesionData.id = existingMeasurement._id;
|
||||||
lesionData.isNodal = existingMeasurement.isNodal;
|
lesionData.isNodal = existingMeasurement.isNodal;
|
||||||
@ -111,16 +99,12 @@ function updateLesionData(lesionData) {
|
|||||||
// Update timepoints from lesion data
|
// Update timepoints from lesion data
|
||||||
existingMeasurement.timepoints[timepoint.timepointId] = timepointData;
|
existingMeasurement.timepoints[timepoint.timepointId] = timepointData;
|
||||||
|
|
||||||
console.log('LesionManager updating Measurement');
|
log.info('LesionManager updating Measurement');
|
||||||
Measurements.update(existingMeasurement._id, {
|
Measurements.update(existingMeasurement._id, {
|
||||||
$set: {
|
$set: {
|
||||||
timepoints: existingMeasurement.timepoints
|
timepoints: existingMeasurement.timepoints,
|
||||||
|
clientId: ClientId
|
||||||
}
|
}
|
||||||
}, function(error) {
|
|
||||||
if (error) {
|
|
||||||
log.warn(error);
|
|
||||||
}
|
|
||||||
OHIF.viewer.manuallyModifyingMeasurement = false;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,6 @@ handleMeasurementAdded = function(e, eventData) {
|
|||||||
case 'nonTarget':
|
case 'nonTarget':
|
||||||
case 'lesion':
|
case 'lesion':
|
||||||
log.info('CornerstoneToolsMeasurementAdded');
|
log.info('CornerstoneToolsMeasurementAdded');
|
||||||
OHIF.viewer.manuallyModifyingMeasurement = true;
|
|
||||||
LesionManager.updateLesionData(measurementData);
|
LesionManager.updateLesionData(measurementData);
|
||||||
TrialResponseCriteria.validateDelayed(measurementData);
|
TrialResponseCriteria.validateDelayed(measurementData);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -5,7 +5,6 @@ handleMeasurementModified = function(e, eventData) {
|
|||||||
case 'nonTarget':
|
case 'nonTarget':
|
||||||
case 'lesion':
|
case 'lesion':
|
||||||
log.info('CornerstoneToolsMeasurementModified');
|
log.info('CornerstoneToolsMeasurementModified');
|
||||||
OHIF.viewer.manuallyModifyingMeasurement = true;
|
|
||||||
LesionManager.updateLesionData(measurementData);
|
LesionManager.updateLesionData(measurementData);
|
||||||
TrialResponseCriteria.validateDelayed(measurementData);
|
TrialResponseCriteria.validateDelayed(measurementData);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -21,8 +21,8 @@ removeToolDataWithMeasurementId = function(imageId, toolType, measurementId) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("Removing Indices: ");
|
log.info("Removing Indices: ");
|
||||||
console.log(toRemove);
|
log.info(toRemove);
|
||||||
|
|
||||||
// If any toolData entries need to be removed, splice them from
|
// If any toolData entries need to be removed, splice them from
|
||||||
// the toolData array
|
// the toolData array
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
syncMeasurementAndToolData = function(measurement) {
|
syncMeasurementAndToolData = function(measurement) {
|
||||||
console.log('syncMeasurementAndToolData');
|
log.info('syncMeasurementAndToolData');
|
||||||
|
|
||||||
// Check what toolType we should be adding this to, based on the isTarget value
|
// Check what toolType we should be adding this to, based on the isTarget value
|
||||||
// of the stored Measurement
|
// of the stored Measurement
|
||||||
@ -10,54 +10,48 @@ syncMeasurementAndToolData = function(measurement) {
|
|||||||
var timepointData = measurement.timepoints[key];
|
var timepointData = measurement.timepoints[key];
|
||||||
var imageId = timepointData.imageId;
|
var imageId = timepointData.imageId;
|
||||||
|
|
||||||
|
// Sync the Cornerstone ToolData with this Measurement's timepoint-specific data
|
||||||
syncTimepointDataWithToolData(measurement, timepointData, imageId, toolType);
|
syncTimepointDataWithToolData(measurement, timepointData, imageId, toolType);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function syncTimepointDataWithToolData(measurement, timepointData, imageId, toolType) {
|
function syncTimepointDataWithToolData(measurement, timepointData, imageId, toolType) {
|
||||||
|
// Get the global imageId-specific toolState from Cornerstone Tools
|
||||||
var toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.toolState;
|
var toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.toolState;
|
||||||
|
|
||||||
|
// If no tool state exists for this imageId, create an empty object to store it
|
||||||
if (!toolState[imageId]) {
|
if (!toolState[imageId]) {
|
||||||
toolState[imageId] = {};
|
toolState[imageId] = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is probably not the best approach to prevent duplicates
|
// Check if we already have toolData for this imageId and toolType
|
||||||
if (toolState[imageId][toolType] && toolState[imageId][toolType].data) {
|
if (toolState[imageId][toolType] &&
|
||||||
var measurementHasNoIdYet = false;
|
toolState[imageId][toolType].data &&
|
||||||
toolState[imageId][toolType].data.forEach(function(measurement) {
|
toolState[imageId][toolType].data.length) {
|
||||||
if (measurement.id !== 'notready') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
measurementHasNoIdYet = true;
|
// If we have toolData, we should search it for any toolData
|
||||||
return false;
|
// related to the current Measurement
|
||||||
});
|
|
||||||
|
|
||||||
// Stop here if it appears that we are creating this measurement right now,
|
|
||||||
// and would not like this function to add another copy of it to the toolData
|
|
||||||
if (measurementHasNoIdYet === true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (toolState[imageId][toolType]) {
|
|
||||||
var alreadyExists = false;
|
|
||||||
var toolData = toolState[imageId][toolType].data;
|
var toolData = toolState[imageId][toolType].data;
|
||||||
if (!toolData.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Create a flag so we know if we have successfully updated
|
||||||
|
// this Measurement's timepoint data in the toolData
|
||||||
|
var alreadyExists = false;
|
||||||
|
|
||||||
|
// Loop through the toolData to search for this Measurement's
|
||||||
|
// timepoint data
|
||||||
toolData.forEach(function(tool) {
|
toolData.forEach(function(tool) {
|
||||||
|
// Break the loop if this isn't the Measurement we are looking for
|
||||||
if (tool.id !== measurement._id) {
|
if (tool.id !== measurement._id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we find the Measurement, set the flag to True
|
||||||
alreadyExists = true;
|
alreadyExists = true;
|
||||||
|
|
||||||
// Update the toolData lesionNumber from the Measurement
|
// Update the toolData from the Measurement data and
|
||||||
|
// timepoint-specific data from this Measurement
|
||||||
tool.lesionNumber = measurement.lesionNumber;
|
tool.lesionNumber = measurement.lesionNumber;
|
||||||
tool.isTarget = measurement.isTarget;
|
tool.isTarget = measurement.isTarget;
|
||||||
|
|
||||||
tool.active = timepointData.active;
|
tool.active = timepointData.active;
|
||||||
tool.visible = timepointData.visible;
|
tool.visible = timepointData.visible;
|
||||||
tool.isDeleted = timepointData.isDeleted;
|
tool.isDeleted = timepointData.isDeleted;
|
||||||
@ -65,31 +59,30 @@ function syncTimepointDataWithToolData(measurement, timepointData, imageId, tool
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// If we found the Measurement we intended to update, we can stop
|
||||||
|
// this function here
|
||||||
if (alreadyExists === true) {
|
if (alreadyExists === true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// If no toolData exists for this toolType, create an empty array to hold some
|
||||||
toolState[imageId][toolType] = {
|
toolState[imageId][toolType] = {
|
||||||
data: []
|
data: []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create measurementData structure based on the lesion data at this timepoint
|
// If we have reached this point, it means we haven't found the Measurement we are
|
||||||
// We will add this into the toolData for this imageId
|
// looking for in the current toolData. This means we need to add it.
|
||||||
var measurementData = timepointData;
|
|
||||||
measurementData.isTarget = measurement.isTarget;
|
|
||||||
measurementData.lesionNumber = measurement.lesionNumber;
|
|
||||||
measurementData.measurementText = measurement.measurementText;
|
|
||||||
measurementData.isDeleted = measurement.isDeleted;
|
|
||||||
measurementData.location = measurement.location;
|
|
||||||
measurementData.locationUID = measurement.locationUID;
|
|
||||||
measurementData.patientId = measurement.patientId;
|
|
||||||
measurementData.visible = measurement.visible;
|
|
||||||
measurementData.active = measurement.active;
|
|
||||||
measurementData.uid = measurement.uid;
|
|
||||||
measurementData.id = measurement._id;
|
|
||||||
|
|
||||||
toolState[imageId][toolType].data.push(measurementData);
|
// First, create the measurementData structure based on the lesion data at this timepoint.
|
||||||
|
var tool = timepointData;
|
||||||
|
tool.lesionNumber = measurement.lesionNumber;
|
||||||
|
tool.isTarget = measurement.isTarget;
|
||||||
|
tool.location = measurement.location;
|
||||||
|
tool.locationUID = measurement.locationUID;
|
||||||
|
tool.patientId = measurement.patientId;
|
||||||
|
tool.id = measurement._id;
|
||||||
|
|
||||||
TrialResponseCriteria.validateSingleMeasurement(measurementData);
|
// Add the measurementData into the toolData for this imageId
|
||||||
|
toolState[imageId][toolType].data.push(tool);
|
||||||
}
|
}
|
||||||
|
|||||||
4
Packages/viewerbase/client/collections.js
Normal file
4
Packages/viewerbase/client/collections.js
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
ViewerStudies = new Meteor.Collection(null);
|
||||||
|
ViewerStudies._debugName = 'ViewerStudies';
|
||||||
|
|
||||||
|
ClientId = Random.id();
|
||||||
@ -322,7 +322,7 @@ function loadSeriesIntoViewport(data, templateData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Temporary until we have a real window manager with events for series/study changed
|
// Temporary until we have a real window manager with events for series/study changed
|
||||||
console.log('Set NewSeriesLoaded');
|
log.info('Set NewSeriesLoaded');
|
||||||
Session.set('NewSeriesLoaded', Random.id());
|
Session.set('NewSeriesLoaded', Random.id());
|
||||||
|
|
||||||
// Run any renderedCallback that exists in the data context
|
// Run any renderedCallback that exists in the data context
|
||||||
@ -412,7 +412,7 @@ Meteor.startup(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Template.imageViewerViewport.onCreated(function() {
|
Template.imageViewerViewport.onCreated(function() {
|
||||||
console.log('imageViewerViewport onCreated');
|
log.info('imageViewerViewport onCreated');
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.imageViewerViewport.onRendered(function() {
|
Template.imageViewerViewport.onRendered(function() {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
applyWLPreset = function(presetName, element) {
|
applyWLPreset = function(presetName, element) {
|
||||||
console.log("Applying WL Preset: " + presetName);
|
log.info("Applying WL Preset: " + presetName);
|
||||||
var viewport = cornerstone.getViewport(element);
|
var viewport = cornerstone.getViewport(element);
|
||||||
|
|
||||||
if (presetName === 'Default') {
|
if (presetName === 'Default') {
|
||||||
|
|||||||
@ -55,6 +55,6 @@ getWADORSImageId = function(instance) {
|
|||||||
|
|
||||||
var imageId = cornerstoneWADOImageLoader.imageManager.add(image);
|
var imageId = cornerstoneWADOImageLoader.imageManager.add(image);
|
||||||
|
|
||||||
console.log('WADO-RS ImageID: ' + imageId);
|
log.info('WADO-RS ImageID: ' + imageId);
|
||||||
return imageId;
|
return imageId;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -27,6 +27,10 @@ Package.onUse(function (api) {
|
|||||||
// TODO= Find a meteor package for this
|
// TODO= Find a meteor package for this
|
||||||
api.addFiles('client/compatibility/jquery.hotkeys.js', 'client');
|
api.addFiles('client/compatibility/jquery.hotkeys.js', 'client');
|
||||||
|
|
||||||
|
|
||||||
|
// ---------- Collections ----------
|
||||||
|
api.addFiles('client/collections.js', 'client');
|
||||||
|
|
||||||
// ---------- Components ----------
|
// ---------- Components ----------
|
||||||
|
|
||||||
// Basic components
|
// Basic components
|
||||||
@ -148,8 +152,12 @@ Package.onUse(function (api) {
|
|||||||
api.export('toolManager', 'client');
|
api.export('toolManager', 'client');
|
||||||
api.export('WindowManager', 'client');
|
api.export('WindowManager', 'client');
|
||||||
|
|
||||||
// Global data object
|
// Global objects
|
||||||
api.export('OHIF', 'client');
|
api.export('OHIF', 'client');
|
||||||
|
api.export('ClientId', 'client');
|
||||||
|
|
||||||
|
// Collections
|
||||||
|
api.export('ViewerStudies', 'client');
|
||||||
|
|
||||||
// UI Helpers
|
// UI Helpers
|
||||||
api.addFiles('lib/helpers/formatDA.js', 'client');
|
api.addFiles('lib/helpers/formatDA.js', 'client');
|
||||||
|
|||||||
@ -26,7 +26,7 @@ function getSourceImageInstanceUid(instance) {
|
|||||||
* @returns {{seriesList: Array, patientName: *, patientId: *, accessionNumber: *, studyDate: *, modalities: *, studyDescription: *, imageCount: *, studyInstanceUid: *}}
|
* @returns {{seriesList: Array, patientName: *, patientId: *, accessionNumber: *, studyDate: *, modalities: *, studyDescription: *, imageCount: *, studyInstanceUid: *}}
|
||||||
*/
|
*/
|
||||||
function resultDataToStudyMetadata(studyInstanceUid, resultData) {
|
function resultDataToStudyMetadata(studyInstanceUid, resultData) {
|
||||||
console.log('resultDataToStudyMetadata');
|
log.info('resultDataToStudyMetadata');
|
||||||
var seriesMap = {};
|
var seriesMap = {};
|
||||||
var seriesList = [];
|
var seriesList = [];
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ function resultDataToStudies(resultData) {
|
|||||||
|
|
||||||
|
|
||||||
Services.DIMSE.Studies = function(filter) {
|
Services.DIMSE.Studies = function(filter) {
|
||||||
console.log('Services.DIMSE.Studies');
|
log.info('Services.DIMSE.Studies');
|
||||||
var parameters = {
|
var parameters = {
|
||||||
0x00100010: filter.patientName,
|
0x00100010: filter.patientName,
|
||||||
0x00100020: filter.patientId,
|
0x00100020: filter.patientId,
|
||||||
|
|||||||
@ -116,7 +116,6 @@ function search() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Template.worklistResult.onCreated(function() {
|
Template.worklistResult.onCreated(function() {
|
||||||
console.log('WorklistResult onCreated!');
|
|
||||||
var self = this;
|
var self = this;
|
||||||
if (Worklist.subscriptions) {
|
if (Worklist.subscriptions) {
|
||||||
Worklist.subscriptions.forEach(function(collectionName) {
|
Worklist.subscriptions.forEach(function(collectionName) {
|
||||||
@ -125,10 +124,6 @@ Template.worklistResult.onCreated(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.worklistResult.onDestroyed(function() {
|
|
||||||
console.log('WorklistResult onDestroyed!');
|
|
||||||
});
|
|
||||||
|
|
||||||
Template.worklistResult.events({
|
Template.worklistResult.events({
|
||||||
'keydown input': function(e) {
|
'keydown input': function(e) {
|
||||||
if (e.which === 13) { // Enter
|
if (e.which === 13) { // Enter
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user