Measurement and manipulation of ultracold bosons using microfabricated optics