Finding indices and number pixels for rectangle shapes

This module will find the indices of rectangle or square shape and count the
  number of pixels in that shape.

Yes you right I can use (row_val*col_val), but then I have to use if... else ... because in the slicing we use 
 np.min([row_coor + row_val,  detector_size[1]]) in case if some one gave high value for row_val or col_val