Data augmentation library for 3D (US) medical images

Hi everyone,

we are working on some DeepLearning networks and we would like to do some data augmentation when exporting data from Slicer.

Do you guys have any plans for creating a library for supporting this kind of matter or does anyone know a good library or code chunks to start?

We are mainly interested in doing affine and elastic deformations as well as intensity shift.

P.S. We are using pytorch for training

I am thankful for any help.


I would check out Albumentations:
Haven’t used it myself but it does elastic and affine transformations.

Intensity shifts should be easily implementable in Pytorch using the basic Dataset classes:

1 Like

As @Prashant_Pandey suggested, albumentations are a good choice. I have used them with success. Alternatively, if you want to implement elastic transformations yourself, this is a good starting point:

Affine transformations (along with other standard are also part of default torchvision transforms:

Also, as above, I wouldn’t augment data via exporting new datasets through Slicer, but rather dynamically and randomly augmenting them through pytorch DataLoader transforms. This way you can even implement e.g. adaptive histogram equalization with randomly assigned parameters from skimage, or other interesting solutions.

1 Like

@Prashant_Pandey, @JanWitowski Thanks for your quick response. If I am not wrong, Albumentations doesn’t seem to do data augmentation on 3D volumetric data.

Yes, that’s what it looks like to me as well. Perhaps the architecture is such that we could plug in a 3D augmentation path? If not, perhaps follow the general style but with a 3D approach in mind (or maybe ND for that matter).

Yes, for sure it would be good to follow this approach.

This probably comes in very late, but in case someone needs this, you can use TorchIO.