LT-332: Fixed tool color and shadow for target tool. Moved client-only utilities to client-folder in viewerbase to speed up reloading

This commit is contained in:
Erik Ziegler committed 2016-11-16 12:17:07 +01:00
1 parent c04c70b325
commit 8cf6666bb1
46 files changed
+67 -57

No files matched your search

@@ -0,0 +1,43 @@
import { OHIF } from 'meteor/ohif:core';
/**
* This function disables reference lines for a specific viewport element.
* It also enables reference lines for all other viewports with the
* class .imageViewerViewport.
*
* @param element {node} DOM Node representing the viewport element
*/
displayReferenceLines = element => {
OHIF.log.info("imageViewerViewport displayReferenceLines");
// Check if image plane (orientation / loction) data is present for the current image
const enabledElement = cornerstone.getEnabledElement(element);
const imageId = enabledElement.image.imageId;
const imagePlane = cornerstoneTools.metaData.get('imagePlane', imageId);
if (!OHIF.viewer.refLinesEnabled || !imagePlane || !imagePlane.frameOfReferenceUID) {
return;
}
// Disable reference lines for the current element
cornerstoneTools.referenceLines.tool.disable(element);
// Loop through all other viewport elements and enable reference lines
$('.imageViewerViewport').not(element).each((index, viewportElement) => {
let imageId;
if($(viewportElement).find('canvas').length) {
try {
const enabledElement = cornerstone.getEnabledElement(viewportElement);
imageId = enabledElement.image.imageId;
} catch(error) {
return;
}
if (!imageId) {
return;
}
cornerstoneTools.referenceLines.tool.enable(viewportElement, OHIF.viewer.updateImageSynchronizer);
}
});
};