Centralize the use of segment_idxs.