2015-12-19 04:24:00 +01:00
|
|
|
removeToolDataWithMeasurementId = function(imageId, toolType, measurementId) {
|
2016-02-12 20:38:00 +01:00
|
|
|
log.info('removeToolDataWithMeasurementId');
|
2015-12-19 04:24:00 +01:00
|
|
|
var toolState = cornerstoneTools.globalImageIdSpecificToolStateManager.toolState;
|
|
|
|
|
|
|
|
|
|
// Find any related toolData
|
|
|
|
|
if (!toolState[imageId] || !toolState[imageId][toolType]) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var toolData = toolState[imageId][toolType].data;
|
|
|
|
|
if (!toolData.length) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Search toolData for entries linked to the specified Measurement
|
|
|
|
|
var toRemove = [];
|
|
|
|
|
toolData.forEach(function(measurement, index) {
|
2016-02-13 18:57:04 +01:00
|
|
|
if (measurement.id === measurementId ||
|
|
|
|
|
measurement._id === measurementId) {
|
2015-12-19 04:24:00 +01:00
|
|
|
toRemove.push(index);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2016-02-13 18:57:04 +01:00
|
|
|
log.info('Removing Indices: ');
|
2016-02-13 17:42:10 +01:00
|
|
|
log.info(toRemove);
|
2016-02-12 20:38:00 +01:00
|
|
|
|
2015-12-19 04:24:00 +01:00
|
|
|
// If any toolData entries need to be removed, splice them from
|
|
|
|
|
// the toolData array
|
|
|
|
|
toRemove.forEach(function(index) {
|
|
|
|
|
toolData.splice(index, 1);
|
|
|
|
|
});
|
2016-01-11 11:32:20 +01:00
|
|
|
};
|