A system for automatic sleep structure recognition and analysis