Automated on-chip imaging and sorting of C. elegans