It appears your biggest problem is normalizing the data so you can count the number of peaks and valleys. The easiest way to do this is to use a Hilbert Transform.
1. Filter your signal, X(t). I settled at and 2nd order bandpass 1 Hz to 15 Hz passband. The 15 Hz distorts the waveform by filtering out some of the higher frequency components of the respiration waveform, but leaves the fundamental frequency to work with.
2. Perform a Hilbert transform on the data, H(t)
3. Create a complex signal with the form X(t) + jH(t).
4. Take the magnitude of this signal, A(t). This should be an envelope of the signal.
5. Divide Y(t) = X(t)/A(t)
6. This signal Y(t) should be normalize to an amplitude of 1.
7. Set the peak detector to around 0.8 threshold with a width of 500. This gave me good results outside of the noise and I think reasonable results within the noise.
I played around with using a wavelet based denoising filter before doing the above and it seemed to help some in the noisy area. I don't know if you have this toolkit available to you or not (Signal Processing toolkit). Attached is the VI in 8.2.1 and an image if you can't open the vi.
Randall Pursley