DOC: Find the indices and number of pixels for rectangle shapes

open this branch due to conflicts in the previous branch( merge conflicts markers)
Can you add an ROI which goes out of bounds?