MaskSegmentHelper

Mask segment helper: helps handling the segments list, but does NOT update the associated mask (use special commands for that such as DeleteSegmentCommand, ChangeSegmentColourCommand...).

Constructor

new MaskSegmentHelper(mask)

Parameters:
NameTypeDescription
maskImage

The associated mask image.

Classes

MaskSegmentHelper

Methods

addSegment(segment)

Add a segment to the segments list.

Parameters:
NameTypeDescription
segmentMaskSegment

The segment to add.

getNumberOfSegments() → {number}

Get the number of segments of the segmentation.

Returns:

The number of segments.

Type: 
number

getSegment(segmentNumber) → {MaskSegment|undefined}

Get a segment from the inner segment list.

Parameters:
NameTypeDescription
segmentNumbernumber

The segment number.

Returns:

The segment or undefined if not found.

Type: 
MaskSegment | undefined

hasSegment(segmentNumber) → {boolean}

Check if a segment is part of the segments list.

Parameters:
NameTypeDescription
segmentNumbernumber

The segment number.

Returns:

True if the segment is included.

Type: 
boolean

maskHasSegments(numbers) → {Array.<boolean>}

Check if a segment is present in a mask image.

Parameters:
NameTypeDescription
numbersArray.<number>

Array of segment numbers.

Returns:

Array of boolean set to true if the segment is present in the mask.

Type: 
Array.<boolean>

removeSegment(segmentNumber)

Remove a segment from the segments list.

Parameters:
NameTypeDescription
segmentNumbernumber

The segment number.

updateSegment(segment)

Update a segment of the segments list.

Parameters:
NameTypeDescription
segmentMaskSegment

The segment to update.