3d medical images classifications

I am trying to classify medical dicom images using Conv3D. I have a few questions, not sure if I am asking the question in the right way. The image size is (512 x 512 x 3 channels). Each scan has no of slices 28 - 40 slices in DICOM format, and I have around 500 datasets

  1. How should I structure the datasets? Is a absent or present classification for the medical images. I understand if simple 2D images (for e.g. dog and cat, I can put the right images in the respective folders). But in my case, I have a stack of 2D images for one scan.
  2. The no of slices varies for all the scans, what is the correct way to use the dataloader?

My questions may not be very clear, but I am more than happy to give more clarification if needed. Or if there is any example that will be great.

I think you can look here for a starting point

Thanks, will take a look