RF: allow non-unique and 0 in frame index values

Refactor image_shape to use an array for the frame indices, and look for
unique values in the indices instead of assuming they are continuous
starting at 1.