Combine rois automatically based on rectangle selection or maximal distance


I wonder if there is a way to automatically combine ROIs which are closed to each other. In images I analyze at the moment, there are sometimes gaps between the ROIs which however belong to one object.
I already found out the ROI picker tool and can manually combine the ROIs but for the number of our samples, it would be great if there is an automatic way.
Searching around for solutions I found nothing applicable.

I could imagine there is something like: consider ROIs with a maximal distance of … px as one ROI or to define that all ROIs within a rectangle selection should be selected in ROI manager and combined.

thanks for your help!