On beam shaping of the field radiated by a line source coupled to finite or infinite photonic crystals