Assessment of lung function in the ventilated patient