Fixing child measurements rowItem jumping and data syncing
This commit is contained in:
parent
ebcdf80d49
commit
2a724e7080
@ -1,6 +1,8 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { _ } from 'meteor/underscore';
|
||||
import { $ } from 'meteor/jquery';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { cornerstone } from 'meteor/ohif:cornerstone';
|
||||
|
||||
Template.measurementTableRow.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
@ -43,7 +45,8 @@ Template.measurementTableRow.events({
|
||||
$row.closest('.measurementTableView').find('.measurementTableRow').not($row).removeClass('active');
|
||||
$row.toggleClass('active');
|
||||
|
||||
OHIF.measurements.jumpToRowItem(rowItem, timepoints);
|
||||
const childToolKey = $(event.target).attr('data-child');
|
||||
OHIF.measurements.jumpToRowItem(rowItem, timepoints, childToolKey);
|
||||
},
|
||||
|
||||
'click .js-rename'(event, instance) {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { _ } from 'meteor/underscore';
|
||||
import { $ } from 'meteor/jquery';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { cornerstone } from 'meteor/ohif:cornerstone';
|
||||
|
||||
Template.measurementTableTimepointCell.helpers({
|
||||
hasDataAtThisTimepoint() {
|
||||
@ -58,16 +60,6 @@ Template.measurementTableTimepointCell.helpers({
|
||||
});
|
||||
|
||||
Template.measurementTableTimepointCell.events({
|
||||
'click .measurementTableTimepointCell'(event, instance) {
|
||||
if (!instance.data.timepointId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const rowItem = instance.data.rowItem;
|
||||
const timepoints = instance.data.timepoints.get();
|
||||
OHIF.measurements.jumpToRowItem(rowItem, timepoints);
|
||||
},
|
||||
|
||||
'dblclick .measurementTableTimepointCell'(event, instance) {
|
||||
const { rowItem, timepointId } = instance.data;
|
||||
if (!timepointId) return;
|
||||
|
||||
@ -21,7 +21,7 @@ export class TargetTypeCriterion extends BaseCriterion {
|
||||
items.forEach(item => {
|
||||
const measurement = item.measurement;
|
||||
|
||||
if (measurement.toolType !== 'bidirectional') {
|
||||
if (measurement.toolType !== 'bidirectional' && !measurement.bidirectional) {
|
||||
measurements.push(measurement);
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { $ } from 'meteor/jquery';
|
||||
import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
/**
|
||||
|
||||
@ -5,8 +5,8 @@ import { cornerstone } from 'meteor/ohif:cornerstone';
|
||||
|
||||
function renderIntoViewport(measurementData, enabledElement, viewportIndex) {
|
||||
const { activateMeasurements, findAndRenderDisplaySet } = OHIF.measurements;
|
||||
const { studyInstanceUid, seriesInstanceUid, sopInstanceUid } = measurementData;
|
||||
const { element } = enabledElement;
|
||||
const { studyInstanceUid, seriesInstanceUid, sopInstanceUid } = measurementData;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const renderedCallback = element => {
|
||||
@ -73,7 +73,7 @@ let lastActivatedRowItem;
|
||||
*
|
||||
* @param measurementId The unique key for a specific Measurement
|
||||
*/
|
||||
OHIF.measurements.jumpToRowItem = (rowItem, timepoints) => {
|
||||
OHIF.measurements.jumpToRowItem = (rowItem, timepoints, childToolKey) => {
|
||||
const { isZoomed, zoomedViewportIndex } = OHIF.viewerbase.layoutManager;
|
||||
|
||||
lastActivatedRowItem = rowItem;
|
||||
@ -112,10 +112,22 @@ OHIF.measurements.jumpToRowItem = (rowItem, timepoints) => {
|
||||
continue;
|
||||
}
|
||||
|
||||
const measurementData = dataAtThisTimepoint[0];
|
||||
const measurement = dataAtThisTimepoint[0];
|
||||
let measurementData = measurement;
|
||||
const { toolType } = measurementData;
|
||||
const { tool } = OHIF.measurements.getToolConfiguration(toolType);
|
||||
if (childToolKey) {
|
||||
measurementData = measurementData[childToolKey];
|
||||
} else if (Array.isArray(tool.childTools)) {
|
||||
tool.childTools.every(key => {
|
||||
measurementData = measurementData[key];
|
||||
return !measurementData;
|
||||
});
|
||||
}
|
||||
|
||||
measurementsData.push(measurementData);
|
||||
const promise = OHIF.studies.loadStudy(measurementData.studyInstanceUid);
|
||||
promise.then(() => OHIF.measurements.syncMeasurementAndToolData(measurementData));
|
||||
promise.then(() => OHIF.measurements.syncMeasurementAndToolData(measurement));
|
||||
promises.add(promise);
|
||||
}
|
||||
|
||||
|
||||
@ -11,8 +11,22 @@ OHIF.measurements.syncMeasurementAndToolData = measurement => {
|
||||
const metadata = OHIF.viewer.StudyMetadataList.findBy({ studyInstanceUid });
|
||||
if (!metadata) return;
|
||||
|
||||
const imageId = OHIF.viewerbase.getImageIdForImagePath(measurement.imagePath);
|
||||
// Iterate each child tool if the current tool has children
|
||||
const { getImageIdForImagePath } = OHIF.viewerbase;
|
||||
const toolType = measurement.toolType;
|
||||
const { tool } = OHIF.measurements.getToolConfiguration(toolType);
|
||||
if (Array.isArray(tool.childTools)) {
|
||||
tool.childTools.forEach(childToolKey => {
|
||||
const childMeasurement = measurement[childToolKey];
|
||||
if (!childMeasurement) return;
|
||||
childMeasurement._id = measurement._id;
|
||||
OHIF.measurements.syncMeasurementAndToolData(childMeasurement);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const imageId = getImageIdForImagePath(measurement.imagePath);
|
||||
|
||||
// If no tool state exists for this imageId, create an empty object to store it
|
||||
if (!toolState[imageId]) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user