LT-296: Bug fixing for jumping to measurements
This commit is contained in:
parent
7f0bd1bb42
commit
03dd8af731
@ -65,17 +65,6 @@ Template.measurementTableRow.events({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
'dblclick .location'() {
|
|
||||||
OHIF.log.info('Double clicked on Lesion Location cell');
|
|
||||||
|
|
||||||
const measurementData = this;
|
|
||||||
|
|
||||||
// TODO = Fix this weird issue? Need to set toolData's ID properly..
|
|
||||||
measurementData.id = this._id;
|
|
||||||
|
|
||||||
changeLesionLocationCallback(measurementData, null, doneCallback);
|
|
||||||
},
|
|
||||||
|
|
||||||
'keydown .location'(event) {
|
'keydown .location'(event) {
|
||||||
const keyCode = event.which;
|
const keyCode = event.which;
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,24 @@ OHIF.measurements.activateMeasurements = (element, measurementData) => {
|
|||||||
// updated and the highlight is removed from inactive tools in all visible viewports
|
// updated and the highlight is removed from inactive tools in all visible viewports
|
||||||
const $viewports = $('.imageViewerViewport');
|
const $viewports = $('.imageViewerViewport');
|
||||||
$viewports.each((index, element) => {
|
$viewports.each((index, element) => {
|
||||||
|
if (!$(element).find('canvas')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Implement isEnabledElement in Cornerstone
|
||||||
|
// or maybe just remove the 'error' this throws?
|
||||||
|
let ee;
|
||||||
|
try {
|
||||||
|
ee = cornerstone.getEnabledElement(element)
|
||||||
|
} catch(error) {
|
||||||
|
OHIF.log.warn(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ee.image) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cornerstone.updateImage(element)
|
cornerstone.updateImage(element)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -4,7 +4,7 @@ import { OHIF } from 'meteor/ohif:core';
|
|||||||
function findAndRenderDisplaySet(displaySets, viewportIndex, studyInstanceUid, seriesInstanceUid, sopInstanceUid, renderedCallback) {
|
function findAndRenderDisplaySet(displaySets, viewportIndex, studyInstanceUid, seriesInstanceUid, sopInstanceUid, renderedCallback) {
|
||||||
// Find the proper stack to display
|
// Find the proper stack to display
|
||||||
const stacksFromSeries = displaySets.filter(stack => stack.seriesInstanceUid === seriesInstanceUid);
|
const stacksFromSeries = displaySets.filter(stack => stack.seriesInstanceUid === seriesInstanceUid);
|
||||||
stack = stacksFromSeries.find(stack => {
|
const stack = stacksFromSeries.find(stack => {
|
||||||
const imageIndex = stack.images.findIndex(image => image.sopInstanceUid === sopInstanceUid);
|
const imageIndex = stack.images.findIndex(image => image.sopInstanceUid === sopInstanceUid);
|
||||||
return imageIndex > -1;
|
return imageIndex > -1;
|
||||||
});
|
});
|
||||||
@ -38,35 +38,26 @@ function renderIntoViewport(viewportIndex, studyInstanceUid, seriesInstanceUid,
|
|||||||
} else {
|
} else {
|
||||||
// If not, retrieve the study metadata and then find the relevant display set and
|
// If not, retrieve the study metadata and then find the relevant display set and
|
||||||
// render it.
|
// render it.
|
||||||
|
const $viewports = $('.imageViewerViewport');
|
||||||
|
const element = $viewports.get(viewportIndex);
|
||||||
|
const startLoadingHandler = cornerstoneTools.loadHandlerManager.getStartLoadHandler();
|
||||||
|
startLoadingHandler(element)
|
||||||
getStudyMetadata(studyInstanceUid, loadedStudy => {
|
getStudyMetadata(studyInstanceUid, loadedStudy => {
|
||||||
loadedStudy.displaySets = createStacks(loadedStudy);
|
loadedStudy.displaySets = createStacks(loadedStudy);
|
||||||
|
OHIF.log.warn('renderIntoViewport');
|
||||||
|
|
||||||
|
// Double check to make sure this study wasn't already inserted
|
||||||
|
// into ViewerStudies, so we don't cause duplicate entry errors
|
||||||
|
const loaded = ViewerStudies.findOne(loadedStudy._id);
|
||||||
|
if (!loaded) {
|
||||||
ViewerStudies.insert(loadedStudy);
|
ViewerStudies.insert(loadedStudy);
|
||||||
|
}
|
||||||
|
|
||||||
findAndRenderDisplaySet(loadedStudy.displaySets, viewportIndex, studyInstanceUid, seriesInstanceUid, sopInstanceUid, renderedCallback)
|
findAndRenderDisplaySet(loadedStudy.displaySets, viewportIndex, studyInstanceUid, seriesInstanceUid, sopInstanceUid, renderedCallback)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDisplaySetData(instance, series, study) {
|
|
||||||
// First, check if we already have this study loaded
|
|
||||||
var alreadyLoaded = ViewerStudies.findOne({
|
|
||||||
studyInstanceUid: study.studyInstanceUid
|
|
||||||
});
|
|
||||||
|
|
||||||
// If not, retrieve it.
|
|
||||||
if (!alreadyLoaded) {
|
|
||||||
getStudyMetadata(priorStudy.studyInstanceUid, study => {
|
|
||||||
study.abstractPriorValue = abstractPriorValue;
|
|
||||||
study.displaySets = createStacks(study);
|
|
||||||
ViewerStudies.insert(study);
|
|
||||||
this.studies.push(study);
|
|
||||||
this.matchImages(viewport);
|
|
||||||
this.updateViewports();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activates a set of lesions when lesion table row is clicked
|
* Activates a set of lesions when lesion table row is clicked
|
||||||
*
|
*
|
||||||
@ -109,17 +100,30 @@ OHIF.measurements.jumpToRowItem = (rowItem, timepoints) => {
|
|||||||
|
|
||||||
// Check if the study / series we need is already the one in the viewport
|
// Check if the study / series we need is already the one in the viewport
|
||||||
const element = $viewports.get(i);
|
const element = $viewports.get(i);
|
||||||
const enabledElement = cornerstone.getEnabledElement(element)
|
|
||||||
|
// TODO: Implement isEnabledElement in Cornerstone
|
||||||
|
// or maybe just remove the 'error' this throws?
|
||||||
|
let enabledElement;
|
||||||
|
try {
|
||||||
|
enabledElement = cornerstone.getEnabledElement(element)
|
||||||
|
} catch(error) {
|
||||||
|
OHIF.log.warn(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enabledElement && enabledElement.image) {
|
||||||
const imageId = enabledElement.image.imageId;
|
const imageId = enabledElement.image.imageId;
|
||||||
const instance = cornerstoneTools.metaData.get('instance', imageId);
|
|
||||||
const series = cornerstoneTools.metaData.get('series', imageId);
|
const series = cornerstoneTools.metaData.get('series', imageId);
|
||||||
const study = cornerstoneTools.metaData.get('study', imageId);
|
const study = cornerstoneTools.metaData.get('study', imageId);
|
||||||
|
|
||||||
if (series.seriesInstanceUid === measurementData.seriesInstanceUid &&
|
if (series.seriesInstanceUid === measurementData.seriesInstanceUid &&
|
||||||
study.studyInstanceUid === measurementData.studyInstanceUid) {
|
study.studyInstanceUid === measurementData.studyInstanceUid) {
|
||||||
|
|
||||||
// If it is, activate the measurements in this viewport and stop here
|
// If it is, activate the measurements in this viewport and stop here
|
||||||
activateMeasurements(element, measurementData);
|
activateMeasurements(element, measurementData);
|
||||||
} else {
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Otherwise, re-render the viewport with the required study/series, then
|
// Otherwise, re-render the viewport with the required study/series, then
|
||||||
// add an onRendered callback to activate the measurements
|
// add an onRendered callback to activate the measurements
|
||||||
const renderedCallback = element => {
|
const renderedCallback = element => {
|
||||||
@ -133,5 +137,4 @@ OHIF.measurements.jumpToRowItem = (rowItem, timepoints) => {
|
|||||||
measurementData.sopInstanceUid,
|
measurementData.sopInstanceUid,
|
||||||
renderedCallback);
|
renderedCallback);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user