Computational optical imaging methods allow the extension of the functionality of traditional cameras. The shape of the aperture in an optical system determines the shape in which the out-of-focus points are blurred in a captured image. In this work we present a method in the Fourier domain that allows us, from an acquired multi-focus image stack, to synthesize images of a three-dimensional scene as if they had been acquired with apertures with arbitrary shapes. Partially extended depth-of-field as well as all-in-focus image reconstruction can be obtained as particular cases.