Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How could I calculate average amplitude for respiration data in Diadem?

Hi,

I am analysing some resipiration data in Diadem obtained using a piezo-electric sensor.  Currently I take 6 second windows that are uninterrupted by movement artifacts and simply count the peaks manually to calculate respiratory frequency.  However, I need to estimate changes in tidal volume also, based upon the average maximum (peaks) and minimum (troughs) for each 6-second sample yet I cannot find a simple way to do this in Diadem.

It seems that LabView may be better in the longer term but in the meantime if someone could advise me how to do this or post a vbs script that would be great.  Attached is a visual sample of the data.  If anyone could advise on a suitable LabView VI that would be excellent too.

Secondly I must ask about filtering, will I distort the values significantly by filtering at 0.5Hz HPF and 40Hz LPF? (To eliminate drift and AC buzz).   It is sampled at 5kHz.  It strikes me that this is a very high value for measuring respiration (I am using an EEG rig..), what is the standard?

bw

MarshaP
0 Kudos
Message 1 of 10
(7,012 Views)
A high pass filter set at 0.5 Hz is way too high for respiration.  If you really need a high pass filter, then it needs to be set to more like 0.1 Hz to be sure to not distort the signal since average respiratory rates are 10-20 breaths/minute (3-6 seconds cycle).  Your lowpass filter could be brought down to around 10 Hz without any problem.

Are you sure a 6 seconds window is long enough to get meaningful data?  You will only get 1 to maybe 3 breaths in that window.
Randall Pursley
0 Kudos
Message 2 of 10
(7,008 Views)
Thanks rpursley8, of course, I see what you mean - I dropped a decimal place, apologies it was 0.05Hz

Our experimental subjects are rodents in this case so the rate is pretty rapid, between 160 and 330 per minute.  Movement artifacts are a problem yet grabbing a few six-second windows per minute and averaging is working well.

I have dug out the licence for LabView and installed, now trying to open/convert TDM file in LabView and analyse peak to peak amplitude using a pre-written .vi (!)  Probably a long shot for a newbie but any advice would be very welcome.  I am reading the manual of course.

bw

MarshaP
0 Kudos
Message 3 of 10
(7,004 Views)
I should have thought about it not being humans.  Here at NIH, we do alot of mouse work.

Peak detection can be really easy or really hard.  I will take a look at your example and get back to you.

Would you be able to post some actual data?

Message Edited by rpursley8 on 07-31-2007 02:29 PM

Randall Pursley
0 Kudos
Message 4 of 10
(7,006 Views)
Hi Randall,

Thanks for your offer to look at some data, I have attached some - I thought I posted some up before I went on vacation but it seems the files were too big, so here goes again.

I have attached the VI that I am trying to convert to read TDMS files, plus a sample TDMS of my rodent breathing data.  It is recorded at 5kHz..  I think 500Hz would be more appropriate in future.

Best wishes,

MarshaP
0 Kudos
Message 5 of 10
(6,929 Views)
And here it is..
Message 6 of 10
(6,925 Views)
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
Download All
0 Kudos
Message 7 of 10
(6,915 Views)
Thank you very much indeed that is a big help.  I can't say I understand fully what you have done, but am I right in thinking that normalization makes the whole signal the same amplitude..?  I am wondering if this is good in this case as many of the high amplitude events are movement artifacts.

I've contacted someone who used to work in our department and he has some ideas too and this is great for us to be going on with 🙂

With kind regards, and thanks again!

P Marshall!
0 Kudos
Message 8 of 10
(6,911 Views)
That is why I suggested the wavelet denoising filter.  This eliminated much of the motion artifact so that the remainder was near in amplitude to the respiration signal.  Attached is the result with the following parameters.  In this case, your respiration signal, since it is much smaller than the movement artifact, is treated as noise and is removed.  Then I subtracted the denoised signal from the original signal to get the resulting signal.

Wavelet = db14
Thresholding rule = Minimax
Rescaling Method = multiple levels
Soft Threshold = soft

I am not a wavelet expert whatsoever so there could very well be other wavelets and denoising rules that would give an even better result.  But these worked pretty well.


Randall Pursley
0 Kudos
Message 9 of 10
(6,905 Views)
I am also doing breathing studies at these low acquisition rates.  Where do you set your high pass and low pass filters?  Is it a software setting or hardware?  I am using Peak Detector.vi to find my peaks and valleys.  It works well to find my peak to peak breathing resistances.  Why do you need to normalize the data?
0 Kudos
Message 10 of 10
(6,178 Views)