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');
|
||||
|
||||
OHIF = OHIF || {
|
||||
viewer: {}
|
||||
};
|
||||
viewer: {}
|
||||
};
|
||||
|
||||
OHIF.viewer.loadIndicatorDelay = 3000;
|
||||
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
|
||||
this.autorun(function(){
|
||||
|
||||
if (!Session.get('ViewerData')) {
|
||||
if (!Session.get('ViewerData') || Session.get('activeViewport') === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Set activeViewport for empty viewport element
|
||||
var activeViewportIndex = Session.get('activeViewport');
|
||||
if (activeViewportIndex === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
var viewports = $(".imageViewerViewport");
|
||||
var element = viewports.get(activeViewportIndex);
|
||||
var enabledElement = cornerstone.getEnabledElement(element);
|
||||
// Check value of rowPixelSpacing & columnPixelSpacing to define as unavailable
|
||||
if (!enabledElement || !enabledElement.image || !enabledElement.image.rowPixelSpacing || !enabledElement.image.columnPixelSpacing) {
|
||||
// Disable Lesion Buttons
|
||||
|
||||
// Check element has .empty class
|
||||
if (element.classList.contains('empty')) {
|
||||
setLesionToolButtonsDisable(true);
|
||||
} else{
|
||||
// Enable Lesion Buttons
|
||||
setLesionToolButtonsDisable(false);
|
||||
return;
|
||||
}
|
||||
|
||||
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() {
|
||||
log.info('onDestroyed');
|
||||
console.log("viewer destroyed!");
|
||||
|
||||
// Remove the Window resize listener
|
||||
$(window).off('resize', handleResize);
|
||||
@ -382,7 +392,7 @@ function handleMeasurementRemoved(e, eventData) {
|
||||
|
||||
// Set enablement of Lesion Tools Buttons
|
||||
function setLesionToolButtonsDisable (status) {
|
||||
var buttons = [$("button#length"), $("button#lesion"), $("button#nonTarget")];
|
||||
var buttons = [$("button#lesion"), $("button#nonTarget")];
|
||||
buttons.forEach(function(btn){
|
||||
btn.prop("disabled", status);
|
||||
});
|
||||
|
||||
@ -17,9 +17,8 @@ Template.studyDateList.helpers({
|
||||
});
|
||||
|
||||
// Find studies which have the same patientId as the currently selected study
|
||||
var relatedStudies = WorklistStudies.find({
|
||||
patientId: currentStudyInBrowser.patientId
|
||||
}).fetch();
|
||||
var relatedStudies = WorklistStudies.find({patientId: currentStudyInBrowser.patientId},
|
||||
{sort: {studyDate: 1}}).fetch();
|
||||
|
||||
// Modify the array of related studies so the default option is the currently selected study
|
||||
relatedStudies.forEach(function(study) {
|
||||
|
||||
@ -442,6 +442,10 @@ Template.imageViewerViewport.onRendered(function() {
|
||||
element.classList.add('empty');
|
||||
$(element).siblings('.imageViewerLoadingIndicator').css('display', 'none');
|
||||
$(element).siblings('.viewportInstructions').show();
|
||||
$(element).click(function(){
|
||||
var viewportIndex = $('.imageViewerViewport').index(element);
|
||||
Session.set('activeViewport', viewportIndex);
|
||||
});
|
||||
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