An implantable medical device that measures respiration parameters based on transthoracic impedance signals, and converts transthoracic impedance signals into a time series of digital values which is filtered with morphological operators to separate the signal into a respiratory component and a cardiac component. Metrics are generated based on the filtered impedance values such as respiratory rate, I/E ratio, tidal volume and minute ventilation.