Four people have been taken to hospital after the roof of a double-decker bus was torn off when it hit a railway bridge.