    def _apply_transform(self, img, transform_selection):
        """ Rotates and flips input image according to transform_selection. """
        
        rotate = {
            0: lambda x: x,
            1: lambda x: np.rot90(x, k=1, axes=(1, 0)),  # rotate right
            2: lambda x: np.rot90(x, k=1, axes=(0, 1)),  # rotate left
        }
        
        flip = {
            0: lambda x: x,
            1: lambda x: np.flip(x, 0),  # flip along horizontal axis
            2: lambda x: np.flip(x, 1),  # flip along vertical axis
        }
        
        rot_direction = transform_selection[0]
        flip_axis = transform_selection[1]
        
        img = rotate[rot_direction](img)
        img = flip[flip_axis](img)
        
        return img
Rotates and flips input image according to transform_selection.
ISR/utils/datahandler.py