Takes a list of correction operations (split, merge, delete, add) and applies them to produce a corrected mask.
Details
Each correction in the list must contain:
action = "delete"Remove cell. Requires
$cell_id.action = "merge"Merge cells. Requires
$cell_ids(integer vector).action = "split"Split a cell. Requires
$cell_idand$seed_points(matrix with columns row, col).action = "add"Add a new cell. Requires
$pixels(matrix of row/col coordinates).
Examples
labels <- matrix(0L, nrow = 20, ncol = 20)
labels[3:8, 3:8] <- 1L
labels[12:18, 12:18] <- 2L
mask <- new_sg_mask(labels)
corrected <- sg_apply_corrections(mask, list(
list(action = "delete", cell_id = 2L)
))
#> ✔ Applied 1 correction.
#> ℹ Result: 1 cell.
print(corrected)
#> <sg_mask>: 20 x 20, 1 cell