toolManager: fixed annotate tool issues and added Text Marker Tool (importing callback functions from Nucleus) and using Metadata classes for OHIF Viewer

This commit is contained in:
Eloízio Salgado 2017-01-18 13:59:03 -02:00 committed by Emanuel F. Oliveira
parent 014dc7730f
commit a8626d02c0
24 changed files with 516 additions and 242 deletions

View File

@ -55,9 +55,9 @@ Template.viewer.onCreated(() => {
ViewerData[contentId].studyInstanceUids = [];
instance.data.studies.forEach(study => {
study.selected = true;
study.displaySets = OHIF.viewerbase.createStacks(study);
// const studyMetadata = new OHIF.metadata.StudyMetadata(study);
// study.displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(studyMetadata);
// study.displaySets = OHIF.viewerbase.createStacks(study);
const studyMetadata = new OHIF.metadata.StudyMetadata(study);
study.displaySets = OHIF.viewerbase.sortingManager.getDisplaySets(studyMetadata);
OHIF.viewer.Studies.insert(study);
ViewerData[contentId].studyInstanceUids.push(study.studyInstanceUid);
});

View File

@ -404,7 +404,6 @@ HP.ProtocolEngine = class ProtocolEngine {
}
// @TypeSafeStudies
var alreadyLoaded = OHIF.viewer.Studies.findBy({
studyInstanceUid: priorStudy.studyInstanceUid
});

View File

@ -30,7 +30,7 @@ OHIF.lesiontracker.openNewTabWithTimepoint = (timepointId, title) => {
// Update the ViewerData global object
ViewerData[contentId] = {
title: title,
contentid: contentId,
contentId: contentId,
studyInstanceUids: data.studyInstanceUids,
timepointIds: data.timepointIds,
currentTimepointId: timepointId

View File

@ -42,18 +42,18 @@ function dblClickOnStudy(data) {
* @param title The title to be used for the tab heading
*/
function open(studyInstanceUid, title) {
const contentid = 'viewerTab';
const contentId = 'viewerTab';
ViewerData = window.ViewerData || ViewerData;
// Update the ViewerData global object
ViewerData[contentid] = {
ViewerData[contentId] = {
title: title,
contentid: contentid,
contentId: contentId,
isUnassociatedStudy: true,
studyInstanceUids: [studyInstanceUid]
};
// Switch to the new tab
switchToTab(contentid);
switchToTab(contentId);
}

View File

@ -135,17 +135,17 @@ function viewStudies() {
const title = selectedStudies[0].patientName;
const studyInstanceUids = selectedStudies.map(study => study.studyInstanceUid);
const contentid = 'viewerTab';
const contentId = 'viewerTab';
ViewerData = window.ViewerData || ViewerData;
// Update the ViewerData global object
ViewerData[contentid] = {
ViewerData[contentId] = {
title: title,
contentid: contentid,
contentId: contentId,
studyInstanceUids: studyInstanceUids
};
// Switch to the new tab
switchToTab(contentid);
switchToTab(contentId);
}

View File

@ -32,7 +32,6 @@ function findAndRenderDisplaySet(displaySets, viewportIndex, studyInstanceUid, s
function renderIntoViewport(viewportIndex, studyInstanceUid, seriesInstanceUid, sopInstanceUid, renderedCallback) {
// @TypeSafeStudies
// First, check if we already have this study loaded
const alreadyLoadedStudy = OHIF.viewer.Studies.findBy({ studyInstanceUid });

View File

@ -11,16 +11,16 @@ openNewTab = function(studyInstanceUid, title) {
// Generate a unique ID to represent this tab
// We can't just use the Mongo entry ID because
// then it will change after hot-reloading.
var contentid = Random.id();
var contentId = Random.id();
// Update the ViewerData global object
ViewerData = window.ViewerData || ViewerData;
ViewerData[contentid] = {
ViewerData[contentId] = {
title: title,
contentid: contentid,
contentId: contentId,
studyInstanceUids: [studyInstanceUid]
};
// Switch to the new tab
switchToTab(contentid);
switchToTab(contentId);
};

View File

@ -1,3 +1,8 @@
import { Blaze } from 'meteor/blaze';
import { Session } from 'meteor/session';
import { jQuery, $ } from 'meteor/jquery';
import { Template } from 'meteor/templating';
import { OHIF } from 'meteor/ohif:core';
/**
@ -33,7 +38,7 @@ switchToTab = function(contentId) {
// If we are switching to the StudyList tab, reset any CSS styles
// that have been applied to prevent scrolling in the Viewer.
// Then stop here, since nothing needs to be re-rendered.
var container;
let container;
if (contentId === 'studylistTab') {
container = $('.tab-content').find('#studylistTab').get(0);
@ -41,7 +46,7 @@ switchToTab = function(contentId) {
return;
}
var studylistContainer = document.createElement('div');
const studylistContainer = document.createElement('div');
studylistContainer.classList.add('studylistContainer');
container.appendChild(studylistContainer);
@ -61,14 +66,14 @@ switchToTab = function(contentId) {
return;
}
var container = $('.tab-content').find('#viewerTab').get(0);
container = $('.tab-content').find('#viewerTab').get(0);
container.innerHTML = '';
// Use Blaze to render the Loading Template into the container
// viewStudiesInTab will clear this container
Blaze.renderWithData(Template.loadingText, {}, container);
var studies = ViewerData[contentId].studies;
const studies = ViewerData[contentId].studies;
if (studies) {
// ViewerData already has the meta data (in cases when studylist is launched externally)
@ -76,7 +81,7 @@ switchToTab = function(contentId) {
} else {
// Use the stored ViewerData global object to retrieve the studyInstanceUid
// related to this tab
var studyInstanceUids = ViewerData[contentId].studyInstanceUids;
const studyInstanceUids = ViewerData[contentId].studyInstanceUids;
// Attempt to retrieve the meta data (it might be cached)
OHIF.studylist.getStudiesMetadata(studyInstanceUids, function(studies) {
@ -85,7 +90,7 @@ switchToTab = function(contentId) {
}
};
function viewStudiesInTab(contentId, studies) {
const viewStudiesInTab = (contentId, studies) => {
// Tab closed while study data was being retrieved, stop here
if (!ViewerData[contentId]) {
OHIF.log.warn('Tab closed while study data was being retrieved');
@ -94,8 +99,11 @@ function viewStudiesInTab(contentId, studies) {
// Once we have the study data, store it in a structure with
// any other saved data about this tab (e.g. layout structure)
var data = jQuery.extend({}, ViewerData[contentId]);
const data = jQuery.extend({}, ViewerData[contentId]);
data.studies = studies;
// TODO: check if this is necessary. Since the typo bug
// was fixed (it was contentid instead of contentId)
data.contentId = contentId;
if (ViewerData[contentId].studies && ViewerData[contentId].studies.length) {
@ -103,8 +111,8 @@ function viewStudiesInTab(contentId, studies) {
}
// Add additional metadata to our study from the studylist
data.studies.forEach(function(study) {
var studylistStudy = StudyListStudies.findOne({
data.studies.forEach(study => {
const studylistStudy = StudyListStudies.findOne({
studyInstanceUid: study.studyInstanceUid
});
@ -117,10 +125,10 @@ function viewStudiesInTab(contentId, studies) {
// Get tab content container given the contentId string
// If no such container exists, stop here because something is wrong
var container = $('.tab-content').find('#viewerTab').get(0);
const container = $('.tab-content').find('#viewerTab').get(0);
// Remove the loading text template that is inside the tab container by default
var viewerContainer = document.createElement('div');
const viewerContainer = document.createElement('div');
viewerContainer.classList.add('viewerContainer');
container.innerHTML = '';
container.appendChild(viewerContainer);
@ -129,7 +137,7 @@ function viewStudiesInTab(contentId, studies) {
Blaze.renderWithData(Template.viewer, data, viewerContainer);
// Retrieve the DOM element of the viewer
var imageViewer = $('#viewer');
const imageViewer = $('#viewer');
// If it is present in the DOM (it should be), then apply
// styles to prevent page scrolling and overscrolling on mobile devices
@ -142,4 +150,4 @@ function viewStudiesInTab(contentId, studies) {
// Prevent overscroll on mobile devices
document.body.style.position = 'fixed';
}
}
};

View File

@ -127,7 +127,9 @@ function resultDataToStudyMetadata(studyInstanceUid, resultData) {
derivationDescription: instance[0x00282111],
lossyImageCompressionRatio: instance[0x00282112],
lossyImageCompressionMethod: instance[0x00282114],
spacingBetweenSlices: instance[0x00180088]
spacingBetweenSlices: instance[0x00180088],
echoNumber: instance[0x00180086],
contrastBolusAgent: instance[0x00180010]
};
// Retrieve the actual data over WADO-URI

View File

@ -100,7 +100,9 @@ function resultDataToStudyMetadata(server, studyInstanceUid, resultData) {
numberOfFrames: parseFloat(remoteGetValue(instance['0028,0008'])),
frameIncrementPointer: remoteGetValue(instance['0028,0009']),
frameTime: parseFloat(remoteGetValue(instance['0018,1063'])),
frameTimeVector: parseFloatArray(remoteGetValue(instance['0018,1065']))
frameTimeVector: parseFloatArray(remoteGetValue(instance['0018,1065'])),
echoNumber: remoteGetValue(instance['0018,0086']),
contrastBolusAgent: remoteGetValue(instance['0018,0010'])
};
var iid = instance['xxxx,0001'].Value;

View File

@ -118,6 +118,8 @@ function resultDataToStudyMetadata(server, studyInstanceUid, resultData) {
derivationDescription: DICOMWeb.getString(instance['00282111']),
lossyImageCompressionRatio: DICOMWeb.getString(instance['00282112']),
lossyImageCompressionMethod: DICOMWeb.getString(instance['00282114']),
echoNumber: DICOMWeb.getString(instance['00180086']),
contrastBolusAgent: DICOMWeb.getString(instance['00180010'])
};
if (server.imageRendering === 'wadouri') {

View File

@ -29,7 +29,6 @@ Template.studySeriesQuickSwitch.onCreated(() => {
const viewportData = instance.getViewportData(viewportIndex);
// @TypeSafeStudies
if (viewportData) {
// Finds the current study and return it
instance.study = OHIF.viewer.Studies.findBy({

View File

@ -41,7 +41,6 @@ Template.studyTimepoint.events({
let $studiesTarget = instance.$('.studyTimepoint');
// @TypeSafeStudies
if (changed.isQuickSwitch) {
// Changes the current quick switch study
const study = OHIF.viewer.Studies.findBy({

View File

@ -139,6 +139,14 @@ Viewerbase.sortingManager = sortingManager;
import { crosshairsSynchronizers } from './lib/crosshairsSynchronizers';
Viewerbase.crosshairsSynchronizers = crosshairsSynchronizers;
// annotateTextUtils.*
import { annotateTextUtils } from './lib/annotateTextUtils';
Viewerbase.annotateTextUtils = annotateTextUtils;
// textMarkerUtils.*
import { textMarkerUtils } from './lib/textMarkerUtils';
Viewerbase.textMarkerUtils = textMarkerUtils;
// createStacks.*
import { createStacks } from './lib/createStacks';
Viewerbase.createStacks = createStacks;

View File

@ -47,6 +47,15 @@ function createAndAddStack(stackMap, study, displaySet) {
}
});
const stack = {
displaySetInstanceUid: displaySet.displaySetInstanceUid,
imageIds: imageIds,
frameRate: displaySet.frameRate,
isClip: displaySet.isClip
};
stackMap[displaySet.displaySetInstanceUid] = stack;
return imageIds;
}

View File

@ -0,0 +1,122 @@
import { viewportUtils } from './viewportUtils';
const getTextCallback = doneChangingTextCallback => {
// This handles the text entry for the annotation tool
const keyPressHandler = e => {
// If Enter or Esc are pressed, close the dialog
if (e.which === 13 || e.which === 27) {
closeHandler();
}
};
const closeHandler = () => {
dialog.get(0).close();
doneChangingTextCallback(getTextInput.val());
// Reset the text value
getTextInput.val('');
// Reset the focus to the active viewport element
// This makes the mobile Safari keyboard close
const element = viewportUtils.getActiveViewportElement();
$(element).focus();
};
const dialog = $('#annotationDialog');
if (dialog.get(0).open === true) {
return;
}
const getTextInput = $('.annotationTextInput');
// Focus on the text input to open the Safari keyboard
getTextInput.focus();
dialog.get(0).showModal();
const confirm = dialog.find('.annotationDialogConfirm');
confirm.off('click');
confirm.on('click', () => {
closeHandler();
});
// Use keydown since keypress doesn't handle ESC in Chrome
dialog.off('keydown');
dialog.on('keydown', keyPressHandler);
};
const changeTextCallback = (data, eventData, doneChangingTextCallback) => {
const dialog = $('#relabelAnnotationDialog');
if (dialog.get(0).open === true) {
return;
}
if (Viewerbase.helpers.isTouchDevice()) {
// Center the dialog on screen on touch devices
dialog.css({
top: 0,
left: 0,
right: 0,
bottom: 0,
margin: 'auto'
});
} else {
// Place the dialog above the tool that is being relabelled
dialog.css({
top: eventData.currentPoints.page.y - dialog.outerHeight() - 20,
left: eventData.currentPoints.page.x - dialog.outerWidth() / 2
});
}
const getTextInput = dialog.find('.annotationTextInput');
const confirm = dialog.find('.relabelConfirm');
const remove = dialog.find('.relabelRemove');
getTextInput.val(data.text);
// Focus on the text input to open the Safari keyboard
getTextInput.focus();
dialog.get(0).showModal();
confirm.off('click');
confirm.on('click', () => {
dialog.get(0).close();
doneChangingTextCallback(data, getTextInput.val());
});
// If the remove button is clicked, delete this marker
remove.off('click');
remove.on('click', () => {
dialog.get(0).close();
doneChangingTextCallback(data, undefined, true);
});
dialog.off('keydown');
dialog.on('keydown', keyPressHandler);
const keyPressHandler = e => {
// If Enter is pressed, close the dialog
if (e.which === 13) {
closeHandler();
}
};
const closeHandler = () => {
dialog.get(0).close();
doneChangingTextCallback(data, getTextInput.val());
// Reset the text value
getTextInput.val('');
// Reset the focus to the active viewport element
// This makes the mobile Safari keyboard close
const element = viewportUtils.getActiveViewportElement();
$(element).focus();
};
};
const annotateTextUtils = {
getTextCallback,
changeTextCallback
};
export { annotateTextUtils };

View File

@ -88,13 +88,18 @@ export class LayoutManager {
// Generate the additional data based on the appendix
const additionalData = [];
appendix.forEach((displaySet, index) => {
additionalData.push({
viewportIndex: currentViewportIndex + index,
studyInstanceUid: displaySet.studyInstanceUid,
seriesInstanceUid: displaySet.seriesInstanceUid,
displaySetInstanceUid: displaySet.displaySetInstanceUid,
sopInstanceUid: displaySet.images[0].sopInstanceUid
});
const { images, studyInstanceUid, seriesInstanceUid, displaySetInstanceUid } = displaySet;
const sopInstanceUid = images[0] && images[0].getSOPInstanceUID ? images[0].getSOPInstanceUID() : '';
const viewportIndex = currentViewportIndex + index;
const data = {
viewportIndex,
studyInstanceUid,
seriesInstanceUid,
displaySetInstanceUid,
sopInstanceUid
};
additionalData.push(data);
});
// Append the additional data with the viewport data

View File

@ -1,40 +1,86 @@
import { ImageSet } from './classes/ImageSet';
import { isImage } from './isImage';
const isMultiFrame = instance => {
return instance.getRawValue('NumberOfFrames') > 1;
};
const makeDisplaySet = (series, instances) => {
const instance = instances[0];
const imageSet = new ImageSet(instances);
const seriesData = series.getData();
// set appropriate attributes to image set...
imageSet.setAttributes({
displaySetInstanceUid: imageSet.uid, // create a local alias for the imageSet UID
seriesInstanceUid: seriesData.seriesInstanceUid,
seriesNumber: seriesData.seriesNumber,
seriesDescription: seriesData.seriesDescription,
numImageFrames: instances.length,
frameRate: instance.getRawValue('x00181063'),
modality: seriesData.modality,
isMultiFrame: isMultiFrame(instance)
});
// Sort the images in this series
imageSet.sortBy((a, b) => {
// Sort by instance Number
const aInstanceNumber = a.getRawValue('x00200013');
const bInstanceNumber = b.getRawValue('x00200013');
if (a.instanceNumber && b.instanceNumber &&
a.instanceNumber !== b.instanceNumber) {
return a.instanceNumber - b.instanceNumber;
}
});
// Include the first image instance number (after sorted)
imageSet.setAttribute('instanceNumber', imageSet.getImage(0).getRawValue('x00200013'));
return imageSet;
};
const isSingleImageModality = modality => {
return (modality === 'CR' ||
modality === 'MG' ||
modality === 'DX');
};
/**
* Creates a set of series to be placed in the Study Browser
* The series that appear in the Study Browser must represent
* Creates a set of series to be placed in the Study Metadata
* The series that appear in the Study Metadata must represent
* imaging modalities.
*
* Furthermore, for drag/drop functionality,
* it is easiest if the stack objects also contain information about
* which study they are linked to.
*
* @param study The study instance to be used
* @returns {Array} An array of series to be placed in the Study Browser
* @param study The study instance metadata to be used
* @returns {Array} An array of series to be placed in the Study Metadata
*/
function createStacks(study) {
const createStacks = study => {
// Define an empty array of display sets
var displaySets = [];
const displaySets = [];
if (!study || !study.seriesList) {
if (!study || !study.getSeriesCount()) {
return displaySets;
}
study.seriesList.forEach(series => {
// Loop through the series (SeriesMetadata)
study.forEachSeries(series => {
// If the series has no instances, skip it
if (!series.instances) {
if (!series.getInstanceCount()) {
return;
}
// Search through the instances of this series
// Search through the instances (InstanceMedatada object) of this series
// Split Multi-frame instances and Single-image modalities
// into their own specific display sets. Place the rest of each
// series into another display set.
let stackableInstances = [];
series.instances.forEach(instance => {
// All imaging modalities must have a valid value for sopClassUid or rows
if (!isImage(instance.sopClassUid) && !instance.rows) {
const stackableInstances = [];
series.forEachInstance(instance => {
// All imaging modalities must have a valid value for sopClassUid (x00080016) or rows (x00280010)
if (!isImage(instance.getRawValue('x00080016')) && !instance.getRawValue('x00280010')) {
return;
}
@ -63,8 +109,8 @@ function createStacks(study) {
});
if (stackableInstances.length) {
let displaySet = makeDisplaySet(series, stackableInstances);
displaySet.setAttribute('studyInstanceUid', study.studyInstanceUid);
const displaySet = makeDisplaySet(series, stackableInstances);
displaySet.setAttribute('studyInstanceUid', study.getStudyInstanceUID());
displaySets.push(displaySet);
}
});
@ -72,47 +118,6 @@ function createStacks(study) {
return displaySets;
};
function makeDisplaySet(series, instances) {
const instance = instances[0];
const imageSet = new ImageSet(instances);
// set appropriate attributes to image set...
imageSet.setAttributes({
displaySetInstanceUid: imageSet.uid, // create a local alias for the imageSet UID
seriesInstanceUid: series.seriesInstanceUid,
seriesNumber: series.seriesNumber,
seriesDescription: series.seriesDescription,
numImageFrames: instances.length,
frameRate: instance.frameTime,
modality: series.modality,
isMultiFrame: isMultiFrame(instance)
});
// Sort the images in this series
imageSet.sortBy(function(a, b) {
if (a.instanceNumber && b.instanceNumber &&
a.instanceNumber !== b.instanceNumber) {
return a.instanceNumber - b.instanceNumber;
}
});
// Include the first image instance number (after sorted)
imageSet.setAttribute('instanceNumber', imageSet.getImage(0).instanceNumber);
return imageSet;
}
function isSingleImageModality(modality) {
return (modality === 'CR' ||
modality === 'MG' ||
modality === 'DX');
}
function isMultiFrame(instance) {
return instance.numberOfFrames > 1;
}
/**
* Expose "createStacks"...
*/

View File

@ -7,7 +7,13 @@ import { getWADORSImageId } from './getWADORSImageId';
* @param instance
* @returns {string} The imageId to be used by Cornerstone
*/
export function getImageId(instance, frame) {
export function getImageId(instanceMetadata, frame) {
if (!instanceMetadata) {
return;
}
const instance = instanceMetadata.getData();
if (!instance) {
return;
}

View File

@ -4,28 +4,30 @@ import { OHIF } from 'meteor/ohif:core';
/**
* Obtain an imageId for Cornerstone based on the WADO-RS scheme
*
* @param instance
* @param {object} instance metadata object (InstanceMetadata)
* @returns {string} The imageId to be used by Cornerstone
*/
export function getWADORSImageId(instance) {
var columnPixelSpacing = 1.0;
var rowPixelSpacing = 1.0;
export function getWADORSImageId(instanceMetada) {
const instance = instanceMetada.getData();
let columnPixelSpacing = 1.0;
let rowPixelSpacing = 1.0;
if (instance.pixelSpacing) {
var split = instance.pixelSpacing.split('\\');
const split = instance.pixelSpacing.split('\\');
rowPixelSpacing = parseFloat(split[0]);
columnPixelSpacing = parseFloat(split[1]);
}
var windowWidth;
var windowCenter;
let windowWidth;
let windowCenter;
if (instance.windowWidth && instance.windowCenter) {
windowWidth = parseFloat(instance.windowWidth.split('\\')[0]);
windowCenter = parseFloat(instance.windowCenter.split('\\')[0]);
}
var image = {
const image = {
uri: Meteor.absoluteUrl(instance.wadorsuri),
//imageId : '',
//minPixelValue : 0,
@ -56,7 +58,7 @@ export function getWADORSImageId(instance) {
instance: instance
};
var imageId = cornerstoneWADOImageLoader.imageManager.add(image);
const imageId = cornerstoneWADOImageLoader.imageManager.add(image);
OHIF.log.info('WADO-RS ImageID: ' + imageId);
return imageId;

View File

@ -1,7 +1,7 @@
import { getSortedData } from './getSortedData';
import { createStacks } from './createStacks';
const getDisplaySets = (studyMetadata, seriesNumber, iteratorFunction) => {
const iteratorFn = typeof iteratorFunction !== 'function' ? getSortedData : iteratorFunction;
const iteratorFn = typeof iteratorFunction !== 'function' ? createStacks : iteratorFunction;
return iteratorFn(studyMetadata, seriesNumber);
};

View File

@ -0,0 +1,87 @@
import { Blaze } from 'meteor/blaze';
import { toolManager } from './toolManager';
import { viewportUtils } from './viewportUtils';
const changeTextCallback = (data, eventData, doneChangingTextCallback) => {
// This handles the double-click/long-press event on Spine text marker labels
const keyPressHandler = e => {
// If Enter or Esc are pressed, close the dialog
if (e.which === 13 || e.which === 27) {
closeHandler();
}
};
// Deactivate textMarker tool after editing a spine label & if spine is not active tool
const deactivateAfterEdit = () => {
if (toolManager.getActiveTool() !== 'spine') {
const element = viewportUtils.getActiveViewportElement();
cornerstoneTools.textMarker.deactivate(element, 1);
}
};
const closeHandler = () => {
dialog.get(0).close();
doneChangingTextCallback(data, select.val());
deactivateAfterEdit();
// Reset the focus to the active viewport element
// This makes the mobile Safari keyboard close
const element = viewportUtils.getActiveViewportElement();
$(element).focus();
};
const dialog = $('#textMarkerRelabelDialog');
// Is necessary to use Blaze object to not create
// circular depencency with helper object (./helpers)
if (Blaze._globalHelpers.isTouchDevice()) {
// Center the dialog on screen on touch devices
dialog.css({
top: 0,
left: 0,
right: 0,
bottom: 0,
margin: 'auto'
});
dialog.find('.dialog.arrow').hide();
} else {
// Place the dialog above the tool that is being relabelled
// TODO = Switch this to the tool coordinates, but put back into
// page coordinates.
dialog.css({
top: eventData.currentPoints.page.y - dialog.outerHeight() - 20,
left: eventData.currentPoints.page.x - dialog.outerWidth() / 2
});
dialog.find('.dialog.arrow').show();
}
const select = dialog.find('.relabelSelect');
const confirm = dialog.find('.relabelConfirm');
const remove = dialog.find('.relabelRemove');
// If the remove button is clicked, delete this marker
remove.off('click');
remove.on('click', () => {
dialog.get(0).close();
doneChangingTextCallback(data, undefined, true);
deactivateAfterEdit();
});
dialog.get(0).showModal();
$('.relabelSelect').val(data.text).trigger('change'); //Update selector to the current
confirm.off('click');
confirm.on('click', () => {
closeHandler();
});
// Use keydown since keypress doesn't handle ESC in Chrome
dialog.off('keydown');
dialog.on('keydown', keyPressHandler);
};
const textMarkerUtils = {
changeTextCallback
};
export { textMarkerUtils };

View File

@ -4,6 +4,8 @@ import { OHIF } from 'meteor/ohif:core';
import { getFrameOfReferenceUID } from './getFrameOfReferenceUID';
import { updateCrosshairsSynchronizer } from './updateCrosshairsSynchronizer';
import { crosshairsSynchronizers } from './crosshairsSynchronizers';
import { annotateTextUtils } from './annotateTextUtils';
import { textMarkerUtils } from './textMarkerUtils';
let activeTool = 'wwwc';
let defaultTool = 'wwwc';
@ -167,16 +169,34 @@ export const toolManager = {
...shadowConfig
});
// Set the configuration values for the text annotation (Arrow) tool
// Set the configuration values for the Text Marker (Spine Labelling) tool
const startFrom = $('#startFrom');
const ascending = $('#ascending');
const textMarkerConfig = {
markers: [ 'L5', 'L4', 'L3', 'L2', 'L1', // Lumbar spine
'T12', 'T11', 'T10', 'T9', 'T8', 'T7', // Thoracic spine
'T6', 'T5', 'T4', 'T3', 'T2', 'T1',
'C7', 'C6', 'C5', 'C4', 'C3', 'C2', 'C1', // Cervical spine
],
current: startFrom.val(),
ascending: ascending.is(':checked'),
loop: true,
changeTextCallback: textMarkerUtils.changeTextCallback,
shadow: shadowConfig.shadow,
shadowColor: shadowConfig.shadowColor,
shadowOffsetX: shadowConfig.shadowOffsetX,
shadowOffsetY: shadowConfig.shadowOffsetY
};
cornerstoneTools.textMarker.setConfiguration(textMarkerConfig);
// @TODO: Fix this, needs to import them from somewhere
/*const annotateConfig = {
getTextCallback: getAnnotationTextCallback,
changeTextCallback: changeAnnotationTextCallback,
// Set the configuration values for the text annotation (Arrow) tool
const annotateConfig = {
getTextCallback: annotateTextUtils.getTextCallback,
changeTextCallback: annotateTextUtils.changeTextCallback,
drawHandles: false,
arrowFirst: true
};
arrowAnnotate.setConfiguration(annotateConfig);*/
arrowAnnotate.setConfiguration(annotateConfig);
const zoomConfig = {
minScale: 0.05,