I am trying to make an ECG viewer reading DICOM files.
I get all data (like Channel Definition Seqeunce), also got the waveform samples to each channel. My problem is that there is a Tag (Channel Sensitivity), and I can't figure out it's meaning.
What purpose does it have?
After you have the raw value for a sample you have to apply some transformations defined by several tags.
Channel Sensitivity is a mandatory field when samples represent defined units and it must be used in conjunction with Channel Sensitivity Correction Factor, Channel Baseline and Channel Sensitivity Units. It represents numeric value of unit quantity of sample.
What does it means? Suppose you did read the sample, you added the bias of Channel Baseline and applied the correction factor of Channel Sensitivity Correction Factor.
Now that value matches Channel Sensitivity with the unit of Channel Sensitivity Units. For example suppose you acquired a constant 5 mV signal, you may set Sensitivity to 5 mV, write to disk the value 1 for each sample and use a Channel Sensitivity Correction Factor of 5. After decoding you'll have back 5 mV. You do not need to consider this (but you have to consider its unit) if you'll display the signal with the same sensitivity.
For your reference: http://dicomlookup.com/html/03_03PU.html#LinkTarget_229394
Related
When correlating two signals or data set, would not subtracting give more accurate match between two signals rather that convolution, i.e less the error (by subtraction), gives an idea on how similar the signals are. Also convolution adds up DC offset which may bringing the value of correlating two different signals to have higher value than similar signals. (Which can be solved by subtracting means from signal)
I'm actually working on the pathways of inpatients during their hospital stay. These pathways are represented as states sequences (the current medical unit at each time unit) and I'm trying to find typical pathways through clustering algorithms.
I create the distance matrix by using the seqdist function from the R package TraMineR, with the method "OMspell". I've already read the R documentation and the related articles, but I can't find how to set the arguments tpow and expcost.
As the time unit is an hour, I don't want any little difference of duration to have a big impact on the clustering result (contrary to a medical unit transfer for example). But I don't want the duration not to have any impact either...
Also, is there a proper way to choose their value ? Or do I just continue to grope around for a good configuration ? (I'm using Dunn, Davies-Bouldin and Silhouette criteria to compare the results of hierarchical clustering, besides the medical opinion on the resulting clusters)
The parameter tpow is an exponential coefficient applied to transform the actual spell lengths (durations). The default value is 1 for which the spell lengths are taken as are. With tpow=0, you would just ignore spell durations, and with tpow=0.5 you would consider the square root of the spell lengths.
The expcost parameter is the expansion cost, i.e. the cost for expanding a (transformed) spell length by one unit. In other words, when in the editing of one sequence into the other a spell of length t1 has to be expanded to length t2, it would cost expcost * |t2^tpow - t1^tpow|. With expcost=0 spells in a same state (e.g. AA and AAAAA) would be equivalent whatever their lengths.
With tpow=.5, for example, increasing the spell length from 1 to 2 costs more than increasing a spell length form 3 to 4. If you do not want to give to much importance to small differences in spell lengths use a low expcost. However, note that the expcost applies to the transformed spell lengths and you may want to adjust it when you change the tpow value.
What is the recommended way of mapping MIDI channel volume to gain?
From here [1]
It is recommended that a device use the volume value in a logarithmic manner, as specified by the following formula if only the coarse value is used:
40 log (Volume/127)
To me, this formula looks like an inverse formula. If channel volume is given in dB, then the formula should use exp instead of log. If volume already is an amplitude, then there should only be Volume/127. To clarify, this does not make sense
*output_buffer = 40*log(channel_volume/127.0) * (*input_buffer);
(Testcase: channel_volume=0 will give infinite gain) The following on the other hand is better (provided that channel_volume is the real gain and not the gain in dB):
*output_buffer = channel_volume * (*input_buffer)/127.0;
[1] http://www.blitter.com/~russtopia/MIDI/~jglatt/tech/midispec/vol.htm
The MIDI specification itself does not specify the volume response.
However, the General MIDI Level 1 Developer Guidelines show this formula, because it's actually used by most implementations.
The channel volume is given as a value from 0 to 127.
The result of that formula is measured in dB; you have to convert it into a gain value afterwards:
gain = 10 ^ (dB / 20)
See the same document for how to handle interactions with the expression controller.
I'm working on a project to try to recognize some movements/poses for use in rehabilitation therapy using Myo Gesture Control Armband.
I have three questions:
Which is the maximum and minimum value that EMG Raw Data returns?
How do you interpret the EMG Raw Data?
The minimum value returned by the EMG Raw Data is for a relaxed muscle and the maximum value is a fully contracted muscle?
PS1: Question in Myo Developer Forum
PS2.: The most important to me is learn how interpret the EMG Raw Data. With some didactic sample. I want to create my own gestures.
This is from my looking results and understanding:
EMG Raw Data return value from -128 to 127 (8-bit value).
We don't really know what is EMG Raw Data. We can't say it's mV directly from muscles intensity. Sensors measure mV and convert to 8-bit data.
This is signal. Around 0 is "relaxed muscle" not minimum. But converting from mV to 8-bit data can make strange values too. Soo 2. and 3. question I can't really answer how it's work, because Myo don't show own hardware for converting values (or I don't find that).
I recommend visit Myo diagnostic page and see what happend in EMG graphs while you relaxed and contracted muscle.
Im really confused over here. I am a ai programmer working on a game that is designed to detect beats in songs and some more. I have no previous knowledge about audio and just reading through whatever material i can find. While i got fft working and stuff I simply don't understand the way samples are transferred to different frequencies. Question 1, what does each frequency stands for. For the algorithm i got. I can transfer for example 1024 samples into 512 outcomes. So are they a description of the strength of each spectrum at the current second? it doesn't really make sense since what i remember is that there are 20,000hz in a 44.1khz audio recording. So how does 512 spectrum samples explain what is happening in that moment? Question 2, from what i read, its a number that represent the sound wave at this moment. However i read that by squaring both left channel and right channel, and add them together and you will get the current power level. Both these seems incoherent to my understanding, and i am really buff led so please explain away.
DFT output
the output is complex representation of phasor (Re,Im,Frequency) of basis function (usually sin wave). First item is DC offset so skip it. All the others are multiples of the same fundamental frequency (sampling rate/N). The output is symmetric (if the input is real only) so use just first half of results. Often power spectrum is used
Amplitude=sqrt(Re^2+Im^2)
which is the amplitude of basis function. If phase is needed then
phase=atan2(Im,Re)
beware DFT results are strongly dependent on the input signal shape,frequency and phase shift to your basis functions. That causes the output to vibrate/oscillate around the correct value and produce wide peaks instead of sharp ones for singular frequencies not to mention aliasing.
frequencies
if you got 44100Hz then the max output frequency is half of it that means the biggest frequency present in data is 22050Hz. The DFFT however does not contain this frequency so if you ignore the mirrored second half of results then:
for 4 samples DFT outputs frequencies are { -,11025 } Hz
for 8 samples frequencies are: { -,5512.5,11025,16537.5 } Hz
The output frequency is linear to its address from start so if you got N=512 samples
do DFFT on it
obtain first N/2=256 results
i-th sample represents frequency f=i*samplerate/N Hz
where i={ 1,...,(N/2)-1} ... skipping i=0
the image shows one of mine utility apps tighted together with
2-channel sound generator (top left)
2-channel oscilloscope (top right)
2-channel spectral analyzer (bottom) ... switched to linear frequency scale to make obvious what I mean in above text
zoom the image to see the settings ... I made it as close to the real devices as I could.
Here DCT and DFT comparison:
Here the DFT output dependency on input signal frequency aliasing by sampling rate
more channels
Summing power of channels is more safe. If you just add the channels then you could miss some data. For example let left channel is playing 1 Khz sin wave and the right exact opposite so if you just sum them then the result is zero but you can hear the sound .... (if you are not exactly in the middle between speakers). If you analyze each channel independently then you need to calculate DFFT for each channel but if you use power sum of channels (or abs sum) then you can obtain the frequencies for all channels at once , of coarse you need to scale the amplitudes ...
[Notes]
Bigger the N nicer the result (less aliasing artifacts and closer to the max frequency). For specific frequencies detection are FIR filter detectors more precise and faster.
Strongly recommend to read DFT and all sublinks there and also this plotting real time Data on (qwt) Oscillocope