Djsopnet: improve performance of slice retrieval

This change makes sure the set of slices retrieved is distinct.