Hi all! You can use samplers in TorchIO for all this stuff. You can extract 2D, 3D or 4D patches from medical images randomly (for training) or densely (for testing). Here’s a little snippet: Creating non overlapping patches and reconstructing image back from the patches
There’s also support for overlapping patches.