Skip to contents

Check for a given spectrum's mask if the pixels on its edges are part of its masked spectrum. That would suggest that the bounding area was set too restrictively, cutting off pixels which are potentially valid for this mask.

Usage

validate_mask_edges(mask.idx, mask_name, array_dim, image.path)

Arguments

mask.idx

pixel-locations of pixels detected for this mask

mask_name

the mask's name, to print useful warnings

array_dim

dimensions of the loaded pixel.array

image.path

path to image-file

Value

list of booleans for each edge. TRUE values signify that a given boundary was infringed upon.

Examples

if (FALSE) {
# load a subset of an image
pixel.array <- duflor::load_image(image.path,
                                  subset_only = T,
                                  crop_left = 20,
                                  crop_right = 20,
                                  crop_bottom = 20,
                                  crop_top = 20
                                  )

# get pixels which belong to a given mask, and return the results for it
ret <- extract_pixels_HSV(pixel.array, lower_bound, upper_bound, F)

# check for each mask if its edges are valid.
for (mask in names(ret)) {
    duflor:::validate_mask_edges(ret[[mask]]$pixel.idx,mask, dim(pixel.array)[1:2],image.path)
}
}