Skip to main content

Variable: helpers

const helpers: object

Type declaration​

clearSegmentValue()​

clearSegmentValue: (segmentationId, segmentIndex, options?) => void

Clears the specified segment value from a segmentation.

Parameters​

• segmentationId: string

The unique identifier of the segmentation.

• segmentIndex: number

The index of the segment to be cleared.

• options?

Optional. recordHistory: when true, record this clear in history. Caller must start group recording if grouping is desired.

• options.recordHistory?: boolean

Returns​

void

Throws​

If the segmentation type is not supported (currently only labelmap is supported).

Remarks​

This function iterates through all voxels in the segmentation and sets the value to 0 for any voxel that matches the specified segment index. It supports both stack and volume segmentations.

computeVolumeLabelmapFromStack()​

computeVolumeLabelmapFromStack: (args) => Promise<object>

Computes a volume segmentation from a stack of image IDs.

Parameters​

• args: any

Returns​

Promise<object>

A promise that resolves to an object containing the volumeId of the created volume.

volumeId​

volumeId: string

Async​

convertStackToVolumeLabelmap()​

convertStackToVolumeLabelmap: (args) => Promise<void>

Converts a stack-based segmentation to a volume-based segmentation.

Parameters​

• args: any

Returns​

Promise<void>

A promise that resolves when the conversion is complete.

convertVolumeToStackLabelmap()​

convertVolumeToStackLabelmap: (__namedParameters) => Promise<void>

Parameters​

• __namedParameters

• __namedParameters.options?

• __namedParameters.options.newSegmentationId?: string

• __namedParameters.options.removeOriginal?: boolean

• __namedParameters.options.viewportId: string

• __namedParameters.segmentationId: string

Returns​

Promise<void>

getLabelToSegmentIndex()​

getLabelToSegmentIndex: (segmentation, labelmapId) => Record<number, number>

A copy of the label value to segment index map of one layer, to map many voxels at a time. A label value that is not in the map is its own segment index.

Parameters​

• segmentation: Segmentation

• labelmapId: string

Returns​

Record<number, number>

getLabelValueForSegment()​

getLabelValueForSegment: (segmentation, segmentIndex) => number

Parameters​

• segmentation: Segmentation

• segmentIndex: number

Returns​

number

getSegmentIndexForLabelValue()​

getSegmentIndexForLabelValue: (segmentation, labelmapId, labelValue) => number | undefined

Parameters​

• segmentation: Segmentation

• labelmapId: string

• labelValue: number

Returns​

number | undefined

moveSegmentToPrivateLabelmap()​

moveSegmentToPrivateLabelmap: (segmentationId, segmentIndex, options?) => string | undefined

Moves a segment to a new labelmap layer that holds only that segment. After the move, the segment can overlap the other segments of the segmentation. The brush never moves a segment by itself: an application calls this function when the user asks for an overlapping segment.

Parameters​

• segmentationId: string

The unique identifier of the segmentation.

• segmentIndex: number

The index of the segment to move.

• options?

Optional. recordHistory: when true, record the move in history, so that undo puts the segment back on its previous layer.

• options.recordHistory?: boolean

Returns​

string | undefined

The id of the layer that holds the segment, or undefined when the segment has no layer. When the segment is already alone on its layer, the segment stays on that layer.

Defined in​

tools/src/stateManagement/segmentation/index.ts:61