Type Alias: MeasurementTargetPredicate()
MeasurementTargetPredicate: (
candidate,options) =>boolean
A per-candidate decider: returns true to keep a single candidate display
set as a measurement target, false to drop it. Set it on the tool
configuration as targetPredicate to narrow the targets the
targetsFilter chooser considers - for example
targetPredicate: measurementTargetFilters.forModality('PT') restricts a
fusion viewport's measurements to its PT volume.
A predicate is the simple half of the selection: it decides one candidate
at a time and is reused by whichever chooser is configured, so the same
forModality('PT') predicate yields "the first PT" under
MeasurementTargetsFilter firstPixelData and "every PT" under
allPixelData, without the predicate knowing how many are wanted.
The decision should be based on the modality of the display set where
available; candidates whose display set is unknown (eg legacy stack image
ids) have no imageIds/instance, letting the predicate choose whether to
include them.
import { measurementTargetFilters } from '@cornerstonejs/tools';
// Only measure PT on a fusion viewport
toolGroup.addTool(CircleROITool.toolName, {
targetPredicate: measurementTargetFilters.forModality('PT'),
});
// Custom predicate
toolGroup.addTool(CircleROITool.toolName, {
targetPredicate: (candidate) => candidate.modality === 'PT',
});
Parameters
• candidate: MeasurementTargetCandidate
• options: MeasurementTargetOptions
Returns
boolean