Class: IslandRemoval
This class has the fill island, with various options being available.
The usage of this class is to:
- Get the viewport where a labelmap segmentation has been created with some data containing islands created.
- Initialize the instance of this class using the initialize method, providing it the viewport, the segmentation voxel manager and some options
- Generate the updated island classification using
floodFillSegmentIsland
- For external island removal, call the
removeExternalIslands
.- External islands are segmentation data which not connected to the central selected points.
- External island removal should be done before internal island removal for performance
- For internal island removal, call the 'removeInternalIslands'
- Internal islands are entirely surrounded sections of non-segment marked areas
- Trigger a segmentation data updated on the originally provided segmentation voxel manager set of slices.
Constructors
new IslandRemoval()
new IslandRemoval(
options
?):IslandRemoval
Parameters
• options?
• options.fillInternalEdge?: boolean
• options.maxInternalRemove?: number
Returns
Defined in
tools/src/utilities/segmentation/islandRemoval.ts:72
Properties
fillSegments()
fillSegments: (
index
) =>boolean
Parameters
• index: number
Returns
boolean
Defined in
tools/src/utilities/segmentation/islandRemoval.ts:55
previewSegmentIndex
previewSegmentIndex:
number
Defined in
tools/src/utilities/segmentation/islandRemoval.ts:57
previewVoxelManager
previewVoxelManager:
VoxelManager
<number
>
Defined in
tools/src/utilities/segmentation/islandRemoval.ts:56
segmentIndex
segmentIndex:
number
Defined in
tools/src/utilities/segmentation/islandRemoval.ts:54
segmentSet
segmentSet:
RLEVoxelMap
<SegmentationEnum
>
The segment set is a set that categorizes points in the segmentation as belonging to one of the categories in SegmentationEnum. Undefined here means that it is a non-relevant segment index. Note this is an RLEVoxelMap for efficiency of storage and running fill algorithms, as it is expected that the classes will have fairly long runs.
Defined in
tools/src/utilities/segmentation/islandRemoval.ts:53
selectedPoints
selectedPoints:
Point3
[]
The selected points are the points that have been directly identified as belonging to the segmentation set, either via user selection or some other process that identifies this set of points as being definitely inside the island.
Defined in
tools/src/utilities/segmentation/islandRemoval.ts:64
Methods
floodFillSegmentIsland()
floodFillSegmentIsland():
number
This operation starts a flood fill on the set of points that were selected (typically by clicking on them or hovering over them in some way, but other options are possible). All of the selected points are marked as SEGMENT, and then all the flood fill points that planar connected to them are marked as being ISLAND points. Then, this is repeated for planes in both normal and anti-normal directions for the points which were so marked (this is done internally to the floodFill algorithm).
This results in a set of points in the volume which are connected to the points originally selected, thus an island point, where the island is the island containing the selected points.
The return value is the number of such points selected.
Returns
number
Defined in
tools/src/utilities/segmentation/islandRemoval.ts:194
initialize()
initialize(
viewport
,segmentationVoxels
,options
):boolean
Initializes the island fill. This is used by providing a viewport that is currently display the segment points of interest, plus a voxel manager that is either a segmentation voxel manager or a preview voxel manager, and a set of options for things like the segment indices to fill/apply to.
The floodFillSegmentIsland
is an additional initialization piece that
internally records additional information on the flood fill.
Returns undefined if the data is invalid for some reason.
Parameters
• viewport: any
showing the current orientation view of an image with the desired labelmap to have island removal applied.
• segmentationVoxels: any
the voxel manager for the segmentation labelmap.
- Can be a preview voxel manager or just a basic voxel manager on the segmentation, or an RLE history voxel manager for using with undo/redo.
- May contain getPoints that is the set of starting points which mark individual islands
• options: any
contains options on how to apply the island removal
- points - the selected points to start the island removal from
- segmentIndex - the segment index for the final color segmentation
- If there is no previewSegmentIndex, then the segment index will be used for all operations, otherwise a preview will be updated, filling it with the preview segment index.
- previewSegmentIndex - the preview segment index.
- Allows for showing a preview of the changes.
- Omit to perform non-preview displays of segmentation voxels.
- Should be 255 typically
Returns
boolean
Defined in
tools/src/utilities/segmentation/islandRemoval.ts:111
removeExternalIslands()
removeExternalIslands():
void
This part removes external islands. External islands are regions of voxels which are not connected to the selected/click points. The algorithm is to start with all of the clicked points, performing a flood fill along all sections that are within the given segment, replacing the "SEGMENT" indicator with a new "ISLAND" indicator. Then, every point in the preview that is not marked as ISLAND is now external and can be reset to the value it had before the flood fill was initiated.
Returns
void
Defined in
tools/src/utilities/segmentation/islandRemoval.ts:227
removeInternalIslands()
removeInternalIslands():
number
[]
Handle islands which are internal to the flood fill - these are points which are surrounded entirely by the filled area. Start by getting the island map - that is, the output from the previous external island removal. Then, mark all the points in between two islands as being "Interior". The set of points marked interior is within a boundary point on the left and right, but may still be open above or below. To test that, perform a flood fill on the interior points, and see if it is entirely contained ('covered') on the top and bottom. Note this is done in a planar fashion, that is one plane at a time, but covering all planes that have interior data. That removes islands that are interior to the currently displayed view to be handled.
Returns
number
[]
Defined in
tools/src/utilities/segmentation/islandRemoval.ts:268
covers()
static
covers(rle
,row
):boolean
Determine if the rle [start...end)
is covered by row completely, by which
it is meant that the row has RLE elements from the start to the end of the
RLE section, matching every index i in the start to end.
Parameters
• rle: any
• row: any
Returns
boolean