Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'ohif.measurements.timepoint.changeViewType .timepoint-browser-list'(event, instance, viewType) {
const $browserList = $(event.currentTarget);
const $allBrowserItems = $browserList.find('.timepoint-browser-item');
// Removes all active classes to collapse the timepoints and studies
$allBrowserItems.removeClass('active');
if (viewType === 'key') {
const { timepointIds, currentTimepointId } = OHIF.viewer.data;
timepointIds.forEach(timepointId => {
const $browserItem = $allBrowserItems.filter(`[data-id=${timepointId}]`);
$browserItem.find('.timepoint-item').trigger('ohif.measurements.timepoint.load');
});
// Show only current timepoint expanded on key timepoints tab
const $browserItem = $allBrowserItems.filter(`[data-id=${currentTimepointId}]`);
$browserItem.find('.timepoint-item').trigger('click');
}
const cloneElement = (element, targetId) => {
// Clone the DOM element
const clone = element.cloneNode(true);
// Find any canvas children to clone
const clonedCanvases = $(clone).find('canvas');
clonedCanvases.each((canvasIndex, clonedCanvas) => {
// Draw from the original canvas to the cloned canvas
const context = clonedCanvas.getContext('2d');
const thumbnailCanvas = $(element).find('canvas').get(canvasIndex);
context.drawImage(thumbnailCanvas, 0, 0);
});
// Update the clone with the targetId
clone.id = targetId;
clone.style.visibility = 'hidden';
return clone;
};
repositionStudySeriesQuickSwitch() {
OHIF.log.info('ResizeViewportManager repositionStudySeriesQuickSwitch');
// Stop here if viewer is not displayed
const isViewer = Session.get('ViewerOpened');
if (!isViewer) return;
// Stop here if there is no one or only one viewport
const nViewports = OHIF.viewerbase.layoutManager.viewportData.length;
if (!nViewports || nViewports <= 1) return;
const $viewer = $('#viewer');
const leftSidebar = $viewer.find('.sidebar-left.sidebar-open');
const rightSidebar = $viewer.find('.sidebar-right.sidebar-open');
const $leftQuickSwitch = $('.quickSwitchWrapper.left');
const $rightQuickSwitch = $('.quickSwitchWrapper.right');
const hasLeftSidebar = leftSidebar.length > 0;
const hasRightSidebar = rightSidebar.length > 0;
$rightQuickSwitch.removeClass('left-sidebar-only');
$leftQuickSwitch.removeClass('right-sidebar-only');
let leftOffset = 0;
if (hasLeftSidebar) {
leftOffset = (leftSidebar.width() / $(window).width()) * 100;
if (!hasRightSidebar) {
$rightQuickSwitch.addClass('left-sidebar-only');
}
initComplete: function () {
var options = template.tabular.options.get();
if (options.search && options.search.onEnterOnly) {
var replaceSearchLabel = function(newText){
$('.dataTables_filter label').contents().filter(function() {
return this.nodeType === 3 && this.textContent.trim().length;
}).replaceWith(newText);
}
$('.dataTables_filter input')
.unbind()
.bind('keyup change', function (event) {
if (!table) return;
if (event.keyCode === 13 || this.value === '') {
replaceSearchLabel("Search:");
table.search(this.value).draw();
}
else {
replaceSearchLabel("Search (hit enter):");
}
});
}
},
headerCallback(headerRow) {
const isActiveViewportEmpty = () => {
const activeViewport = Session.get('activeViewport') || 0;
return $('.imageViewerViewport').eq(activeViewport).hasClass('empty');
};
function updateImagePriorities() {
$(".gallery > .gallery-image")
.toArray()
.map((element, index) => {
const mediaId = element.getAttribute("data-index");
Media.update(mediaId, {
$set: {
"metadata.priority": index
}
});
});
}
$('.imageViewerViewport').each((index, ele) => {
let elementSpecificMeasurementData = $.extend(true, {}, measurementData);
const imagePoint = getImagePoint(patientPoint, ele);
const id = fiducialCounter[studyInstanceUidString]
if (measurementData.hasOwnProperty('server')) {
id = 'server.'.concat(measurementData.f_id);
}
elementSpecificMeasurementData.handles.end.x = imagePoint.x;
elementSpecificMeasurementData.handles.end.y = imagePoint.y;
elementSpecificMeasurementData.id = id;
elementSpecificMeasurementData.active = false;
if (isInBoundary(ele, elementSpecificMeasurementData.handles.end)) {
$(ele).off('cornerstonetoolsmeasurementadded');
cornerstoneTools.addToolState(ele, toolType, elementSpecificMeasurementData);
cornerstone.updateImage(ele);
bindToMeasurementAdded(ele);
imageIds.push(cornerstone.getEnabledElement(ele).image.imageId);
}
});
Template.loading.onRendered(function() {
$('#loading-content').hide().delay(500).fadeIn('slow');
});
function displayResult(fiducials, studyInstanceUid) {
const ClinSigCounter = fiducials.filter(v => v.ClinSig).length;
const htmlLineBreak = '<br><br><br><br><br><br><br>'
if(!(fiducials[0])) {
$('#feedback-section').html(htmlLineBreak + '<p class="text-bold text-center">No result available for this patient.</p>')
return;
}
$('#feedback-section').html(htmlLineBreak + '<p class="text-bold text-center">Fetching data from the server...</p>')
setTimeout(() => {
$('#feedback-section').html(htmlLineBreak + '<p class="text-bold text-center">Adding the true results to the views...</p>')
}, delay);
setTimeout(() => {
$('#feedback-section').html(htmlLineBreak + '<p class="text-bold text-center">Calculating distances...</p>')
}, (delay * (fiducials.length)) + delay);
setTimeout(() => {
$('#feedback-section').html(''.concat(
'<p class="text-bold">Annotations:</p><p>Expert radiologist indicated <span class="text-color">',
fiducials.length.toString(),
(fiducials.length === 1) ? '</span> suspicious area ' : ' suspicious areas ',
'for this patient.',
'</p><br>',
Template.CoursesGeneral.onRendered(() => {
const tabId = FlowRouter.getQueryParam("tab");
if (tabId) {
$('a[href="#' + tabId + '"]').tab("show");
}
});