1. A method comprising: providing a target mask, wherein the target mask is in a spatial domain; performing a frequency domain transformation on the target mask to obtain a first mask, wherein the first mask is in a frequency domain; computing a first cost function for a first mask to obtain a first value; altering the first mask in a frequency domain to obtain a second mask, wherein the second mask is in the frequency domain; computing the first cost function for the second mask to obtain a second value; and repeating the altering the first mask and the computing the first cost function for the second mask until the second value is less than the first value, wherein the performing a frequency domain transformation, computing a first cost function, and altering the first mask are performed using at least one electronic processor.