I don’t know how these slices should be used, i.e. if you want to push each slice separately to the model or if you would like to create a batch of slices from different files.
In the former case it might be easier to just return all slices from the current file and iterate them in the training loop.
In the latter case, a custom sampler (e.g. using two indices for the file and slice index) might work.