I am working with the MNIBITE dataset which contains magnetic resonance (MR) and ultra sound (US) images of human brains.
Because the US only covers a small portion of the MR image I want to apply a sliding window (e.g. skimage.util.view_as_windows) over the 466x394 US and MR images so that I can remove empty patches from training.
I would now like to know where would be the best place to implement this type of preprocessing?
- I can’t put this into the
__getitem__would then return n-patches.
- I can’t put this into the training loop as it the batch size would vary.
It may be best to put it somewhere right before the
torch.utils.data.DataLoader but I don’t see how. Any suggestions?