Removing imageId from Measurement schema
This commit is contained in:
1 parent
cf9136447e
commit
7bb25ae6aa
12 files changed
+66
-36
No files matched your search
@@ -145,7 +145,8 @@ class ConformanceCriteria {
|
||||
const measurements = this.measurementApi.fetch(measurementType);
|
||||
|
||||
measurements.forEach(measurement => {
|
||||
const { studyInstanceUid, imageId } = measurement;
|
||||
const imageId = OHIF.viewerbase.getImageIdForImagePath(measurement.imagePath);
|
||||
const { studyInstanceUid } = measurement;
|
||||
|
||||
const timepointId = measurement.timepointId;
|
||||
const timepoint = timepointId && this.timepointApi.timepoints.findOne({ timepointId });
|
||||
|
||||
@@ -35,14 +35,15 @@ class MeasurementHandlers {
|
||||
|
||||
OHIF.log.info('CornerstoneToolsMeasurementAdded');
|
||||
|
||||
const imagePath = [studyInstanceUid, seriesInstanceUid, sopInstanceUid, frameIndex].join('_');
|
||||
let measurement = $.extend({
|
||||
userId: Meteor.userId(),
|
||||
patientId: patientId,
|
||||
studyInstanceUid: studyInstanceUid,
|
||||
seriesInstanceUid: seriesInstanceUid,
|
||||
sopInstanceUid: sopInstanceUid,
|
||||
frameIndex: frameIndex,
|
||||
imageId: imageId // TODO: In the future we should consider removing this
|
||||
patientId,
|
||||
studyInstanceUid,
|
||||
seriesInstanceUid,
|
||||
sopInstanceUid,
|
||||
frameIndex,
|
||||
imagePath
|
||||
}, measurementData);
|
||||
|
||||
// Get the related timepoint by the measurement number and use its location if defined
|
||||
|
||||
@@ -9,7 +9,7 @@ import { OHIF } from 'meteor/ohif:core';
|
||||
*/
|
||||
function activateTool(measurementData) {
|
||||
const toolType = measurementData.toolType;
|
||||
const imageId = measurementData.imageId;
|
||||
const imageId = OHIF.viewerbase.getImageIdForImagePath(measurementData.imagePath);
|
||||
const toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.saveToolState();
|
||||
|
||||
const toolData = toolState[imageId][toolType];
|
||||
@@ -25,8 +25,7 @@ function activateTool(measurementData) {
|
||||
}
|
||||
|
||||
cornerstoneTools.globalImageIdSpecificToolStateManager.restoreToolState(toolState);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to the image of the correct image index
|
||||
@@ -68,11 +67,12 @@ OHIF.measurements.activateMeasurements = (element, measurementData) => {
|
||||
const enabledElement = cornerstone.getEnabledElement(element);
|
||||
const currentImageId = enabledElement.image.imageId;
|
||||
const toolData = cornerstoneTools.getToolState(element, 'stack');
|
||||
const imageIdIndex = toolData.data[0].imageIds.indexOf(measurementData.imageId);
|
||||
const imageId = OHIF.viewerbase.getImageIdForImagePath(measurementData.imagePath);
|
||||
const imageIdIndex = toolData.data[0].imageIds.indexOf(imageId);
|
||||
|
||||
// If we aren't currently displaying the image that this tool is on,
|
||||
// scroll to it now.
|
||||
if (currentImageId !== measurementData.imageId) {
|
||||
if (currentImageId !== imageId) {
|
||||
cornerstoneTools.scrollToIndex(element, imageIdIndex);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ OHIF.measurements.activateMeasurements = (element, measurementData) => {
|
||||
// or maybe just remove the 'error' this throws?
|
||||
let ee;
|
||||
try {
|
||||
ee = cornerstone.getEnabledElement(element)
|
||||
ee = cornerstone.getEnabledElement(element);
|
||||
} catch(error) {
|
||||
OHIF.log.warn(error);
|
||||
return;
|
||||
@@ -99,6 +99,6 @@ OHIF.measurements.activateMeasurements = (element, measurementData) => {
|
||||
return;
|
||||
}
|
||||
|
||||
cornerstone.updateImage(element)
|
||||
cornerstone.updateImage(element);
|
||||
});
|
||||
};
|
||||
};
|
||||
@@ -18,8 +18,9 @@ OHIF.measurements.exportPdf = (measurementApi, timepointApi) => {
|
||||
|
||||
const printMeasurement = (measurement, callback) => {
|
||||
OHIF.measurements.getImageDataUrl({ measurement }).then(imageDataUrl => {
|
||||
const series = cornerstoneTools.metaData.get('series', measurement.imageId);
|
||||
const instance = cornerstoneTools.metaData.get('instance', measurement.imageId);
|
||||
const imageId = OHIF.viewerbase.getImageIdForImagePath(measurement.imagePath);
|
||||
const series = cornerstoneTools.metaData.get('series', imageId);
|
||||
const instance = cornerstoneTools.metaData.get('instance', imageId);
|
||||
|
||||
let info = measurement.response;
|
||||
if (!info) {
|
||||
|
||||
@@ -7,10 +7,11 @@ OHIF.measurements.getImageDataUrl = ({
|
||||
width=512,
|
||||
height=512,
|
||||
cacheImage=true,
|
||||
imageId,
|
||||
imagePath,
|
||||
measurement
|
||||
}) => {
|
||||
imageId = imageId || measurement.imageId;
|
||||
imagePath = imagePath || measurement.imagePath;
|
||||
const imageId = OHIF.viewerbase.getImageIdForImagePath(imagePath);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const loadMethod = cacheImage ? 'loadAndCacheImage' : 'loadImage';
|
||||
|
||||
@@ -5,7 +5,7 @@ OHIF.measurements.syncMeasurementAndToolData = measurement => {
|
||||
OHIF.log.info('syncMeasurementAndToolData');
|
||||
|
||||
const toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.saveToolState();
|
||||
const imageId = measurement.imageId;
|
||||
const imageId = OHIF.viewerbase.getImageIdForImagePath(measurement.imagePath);
|
||||
const toolType = measurement.toolType;
|
||||
|
||||
// If no tool state exists for this imageId, create an empty object to store it
|
||||
|
||||
Reference in new issue
Block a user