I'm sure someone else will know better than I, but I'd think you might want the filter behind the pinhole if possible, since any smudges or dust or imperfections will be in the DOF of the pinhole!