spacipy.Gem.mask
- Gem.mask(matrix, outfile=None, label_object=False, return_offset=True, return_cropped_mask=False)
Subset the gem object with a numpy array mask
- Parameters:
matrix (np.ndarray(int)) – mask matrix in int dtype, coordinate with overlapped 0 or nan will be dropped
outfile (str) – save the subsetted gem
label_object (bool, default False) – Whether or not to label the masked object, which will generate a new ‘label’ column in the result object
return_offset (bool, default True) – Whether or not to return the offset
return_cropped_mask (bool, default False) – Whether or not to return the cropped mask matrix, which will only keep the kept region in result object