ImageSegmentation: include option to provide pixel coordinates and extract the segment that corresponds to it
Image Segmentation is useful for masking sources in an astronomical image and sometimes this masking option involves having to remove certain segments e.g. galaxies in the image before creating a source map of the remaining sources. It may be useful to add an option to add an method to ImageSegmentation that allows the user to provide pixel coordinates and extract the segment in the image, as well as its label, so it can be easily removed. Something like the bbox functionality but allows for more ease of removing segments
Thank you
You can remove segments from a segmentation image by simply using the remove_labels method: https://photutils.readthedocs.io/en/latest/api/photutils.segmentation.SegmentationImage.html#photutils.segmentation.SegmentationImage.remove_labels
If you want to know the label number for a given (x, y) position, index the segmentation map in the normal Python way: label = segmap.data[y, x]
Thank you for letting me know about how to find the label for a given x,y -I will try this