ZFTurbo / volumentations

Library for 3D augmentations
MIT License
220 stars 35 forks source link

Transformations are not being applied #18

Closed LoboaTeresa closed 1 year ago

LoboaTeresa commented 1 year ago
import numpy as np
import volumentations as V

def get_augmentation():
    return V.Compose([V.RotateAroundAxis3d(axis=[0, 0, 1], rotation_limit=np.pi / 4, p=1),
                    V.Flip3d(axis=[0, 0, 1], always_apply=True)], p=1.0)

def augmentor(img):
    aug = get_augmentation()
    data = {'image': img}
    aug_data = aug(**data)
    img     = aug_data['image']
    return np.ndarray.astype(img , np.float32)

img = nib.load(img_path)
arr_image = img.get_fdata() # arr_image.shape = (206, 206, 176)
aug_img = augmentor(arr_image) # aug_img.shape = (206, 206, 176)

When I apply the transformations specified in "get_augmentation" to my arr_image, the resulting image (aug_img) is exactly the same as the original one.

Am I doing something wrong? Could someone lend me a hand, please? Thank you!

ZFTurbo commented 1 year ago

There are no RotateAroundAxis3d and Flip3d augmentations in this repository. Are you sure you use correct one?

LoboaTeresa commented 1 year ago

I am sorry. I have miskaen this Volumentations-3D repository with the Volumentations one, everything works fine. Thank you for your fast response!