Data Augmentor for 3D images

I have MRI images of brain scans of shape [bs, modalities, h,w,d] and would like to know if there is a library for 3D image augmentations. Also which augmentations would be good for this kind of data?

3 Likes

Have a look at @christianperone’s …MedicalTorch repo.
It might be a good starter for your project.

Regarding the data augmentations, you could try to apply the augmentation on each slide of your scans.
In this case I would use the functional API of torchvision.transforms to make sure that each “random” transformation is applied in with the same parameters on each slide.
Here is a small example on using the same transform parameters on the data and target. You would need to adapt this code for all image slides.

Alternatively you could write your own (affine) transformations. Here is a small example I’ve written for a rotation using rotation matrices.

4 Likes

Thanks, I will look into these

Hey @bluesky314,

This might come a bit late, but you could take a look at the TorchIO transforms.

4 Likes