LT-29: Set activeViewport session for empty imageViewerViewport element, deactivate lesion tools for element which does not have pixel spacing data
This commit is contained in:
parent
2ceca2bd10
commit
56d2a2f654
@ -9,8 +9,8 @@ Template.viewer.onCreated(function() {
|
|||||||
log.info('viewer onCreated');
|
log.info('viewer onCreated');
|
||||||
|
|
||||||
OHIF = OHIF || {
|
OHIF = OHIF || {
|
||||||
viewer: {}
|
viewer: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
OHIF.viewer.loadIndicatorDelay = 3000;
|
OHIF.viewer.loadIndicatorDelay = 3000;
|
||||||
OHIF.viewer.defaultTool = 'wwwc';
|
OHIF.viewer.defaultTool = 'wwwc';
|
||||||
@ -304,34 +304,44 @@ Template.viewer.onRendered(function() {
|
|||||||
|
|
||||||
// Set lesion tool buttons as disable if pixel spacing is not available for active element
|
// Set lesion tool buttons as disable if pixel spacing is not available for active element
|
||||||
this.autorun(function(){
|
this.autorun(function(){
|
||||||
|
if (!Session.get('ViewerData') || Session.get('activeViewport') === undefined) {
|
||||||
if (!Session.get('ViewerData')) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Set activeViewport for empty viewport element
|
|
||||||
var activeViewportIndex = Session.get('activeViewport');
|
var activeViewportIndex = Session.get('activeViewport');
|
||||||
if (activeViewportIndex === undefined) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var viewports = $(".imageViewerViewport");
|
var viewports = $(".imageViewerViewport");
|
||||||
var element = viewports.get(activeViewportIndex);
|
var element = viewports.get(activeViewportIndex);
|
||||||
var enabledElement = cornerstone.getEnabledElement(element);
|
|
||||||
// Check value of rowPixelSpacing & columnPixelSpacing to define as unavailable
|
// Check element has .empty class
|
||||||
if (!enabledElement || !enabledElement.image || !enabledElement.image.rowPixelSpacing || !enabledElement.image.columnPixelSpacing) {
|
if (element.classList.contains('empty')) {
|
||||||
// Disable Lesion Buttons
|
|
||||||
setLesionToolButtonsDisable(true);
|
setLesionToolButtonsDisable(true);
|
||||||
} else{
|
return;
|
||||||
// Enable Lesion Buttons
|
|
||||||
setLesionToolButtonsDisable(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
var enabledElement = cornerstone.getEnabledElement(element);
|
||||||
|
if (!enabledElement || !enabledElement.image ||
|
||||||
|
!enabledElement.image.rowPixelSpacing ||
|
||||||
|
!enabledElement.image.columnPixelSpacing) {
|
||||||
|
// Disable Lesion Tools and Buttons
|
||||||
|
toolManager.setActiveTool("wwwc", viewports);
|
||||||
|
cornerstoneTools.lesion.disable(element);
|
||||||
|
cornerstoneTools.nonTarget.disable(element);
|
||||||
|
setLesionToolButtonsDisable(true);
|
||||||
|
} else{
|
||||||
|
// Enable Lesion Buttons
|
||||||
|
setLesionToolButtonsDisable(false);
|
||||||
|
}
|
||||||
|
} catch(error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.viewer.onDestroyed(function() {
|
Template.viewer.onDestroyed(function() {
|
||||||
log.info('onDestroyed');
|
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);
|
||||||
@ -382,7 +392,7 @@ function handleMeasurementRemoved(e, eventData) {
|
|||||||
|
|
||||||
// Set enablement of Lesion Tools Buttons
|
// Set enablement of Lesion Tools Buttons
|
||||||
function setLesionToolButtonsDisable (status) {
|
function setLesionToolButtonsDisable (status) {
|
||||||
var buttons = [$("button#length"), $("button#lesion"), $("button#nonTarget")];
|
var buttons = [$("button#lesion"), $("button#nonTarget")];
|
||||||
buttons.forEach(function(btn){
|
buttons.forEach(function(btn){
|
||||||
btn.prop("disabled", status);
|
btn.prop("disabled", status);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -17,9 +17,8 @@ Template.studyDateList.helpers({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Find studies which have the same patientId as the currently selected study
|
// Find studies which have the same patientId as the currently selected study
|
||||||
var relatedStudies = WorklistStudies.find({
|
var relatedStudies = WorklistStudies.find({patientId: currentStudyInBrowser.patientId},
|
||||||
patientId: currentStudyInBrowser.patientId
|
{sort: {studyDate: 1}}).fetch();
|
||||||
}).fetch();
|
|
||||||
|
|
||||||
// Modify the array of related studies so the default option is the currently selected study
|
// Modify the array of related studies so the default option is the currently selected study
|
||||||
relatedStudies.forEach(function(study) {
|
relatedStudies.forEach(function(study) {
|
||||||
|
|||||||
@ -442,6 +442,10 @@ Template.imageViewerViewport.onRendered(function() {
|
|||||||
element.classList.add('empty');
|
element.classList.add('empty');
|
||||||
$(element).siblings('.imageViewerLoadingIndicator').css('display', 'none');
|
$(element).siblings('.imageViewerLoadingIndicator').css('display', 'none');
|
||||||
$(element).siblings('.viewportInstructions').show();
|
$(element).siblings('.viewportInstructions').show();
|
||||||
|
$(element).click(function(){
|
||||||
|
var viewportIndex = $('.imageViewerViewport').index(element);
|
||||||
|
Session.set('activeViewport', viewportIndex);
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
(function($) {
|
|
||||||
//Collapse the container
|
|
||||||
function collapseContainer ( container ) {
|
|
||||||
container.toggleClass("collapseHorizontal");
|
|
||||||
var btnCollapse = container.find(".btnCollapse");
|
|
||||||
}
|
|
||||||
|
|
||||||
//function add collapse button
|
|
||||||
function addButtonCollapse ( container ) {
|
|
||||||
var btnCollapse = document.createElement("button");
|
|
||||||
btnCollapse.innerHTML = ">";
|
|
||||||
$(btnCollapse).addClass ("btnCollapse");
|
|
||||||
|
|
||||||
btnCollapse.onclick = function() { // Note this is a function
|
|
||||||
collapseContainer(container);
|
|
||||||
};
|
|
||||||
container.append(btnCollapse);
|
|
||||||
}
|
|
||||||
|
|
||||||
$.fn.dockingContainer = function(options) {
|
|
||||||
var self = this;
|
|
||||||
var opts = $.extend( {}, $.fn.dockingContainer.defaults, options);
|
|
||||||
|
|
||||||
//Set container class
|
|
||||||
this.addClass("dockingContainer");
|
|
||||||
|
|
||||||
//Add btnCollapse
|
|
||||||
addButtonCollapse(this);
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
|
|
||||||
//Defaults
|
|
||||||
$.fn.dockingContainer.defaults = {
|
|
||||||
background: "black"
|
|
||||||
};
|
|
||||||
|
|
||||||
}(jQuery));
|
|
||||||
Loading…
Reference in New Issue
Block a user