# [FieldTrip] ft_preproc_hilbert questions

Max Cantor mcantor at umich.edu
Tue Oct 28 21:42:37 CET 2014

```Hm, let me see if I can articulate this properly (I may be a bit rusty with
this, so this is as much a review for me as it is an attempt to explain it
to anyone else).

The Hilbert Transform itself provides the analytic signal, as Sr (the real
part, or cosine) and Si (the imaginary part, or sine, which is 90 degrees
from the Sr). This can be used to determine things like, as you mentioned,
phase, envelope, instantaneous frequency, and power. If a TFR (or at least
a power spectrum from a TFR) is the power at sensor x frequency x time, the
data structure output from ft_preprocessing is itself not able to give us a
TFR; we have to do an FFT or wavelet analysis to get the necessary data
matrix, but you can also use Hilbert. I know, from a computational
standpoint, how to go from point A to point B here for both wavelet and
hilbert, but I'm struggling to articulate it in real words, which means I
probably need to do some rereading. However, the point is that you can use
Hilbert to get a nearly identical, albeit computationally quite different,
time frequency representation as you can with wavelet analysis.

I have some code to do both wavelet and hilbert on a sample EEGlab dataset.
The sample data comes from the Cohen book, and even though I wrote the code
myself, it is based on example code Cohen provides with the book, so
unfortunately I'm not sure if it's ethical to share it, but that would
hopefully clarify what I mean. That being said, I should be able to
articulate it better myself. If anybody thinks they can explain what I'm
talking about better I would greatly appreciate it, otherwise I might have
to come back to you after I've done some rereading.

On Tue, Oct 28, 2014 at 3:54 PM, Orion <orionblue8 at gmail.com> wrote:

> Hi Max,
>
> Can you clarify what you mean by a Hilbert time-frequency analysis?
> Performing hilbert on a signal will give several different outputs, like
> the envelope and phase, and if you want, the instantaneous frequency.  But
> I don't understand the meaning of Hilbert time-frequency.
>
> There are ways of calculating hilbert that don't use fft, but as fars as
> I'm aware, the hilbert.m that calls fft.m provides a quick way to the
> desired outputs.
>
> Orion
>
> On Tue, Oct 28, 2014 at 3:05 PM, Rodrigo Montefusco <
> rmontefusco at med.uchile.cl> wrote:
>
>> Hi Max,
>>
>> to what I understand, the output of Hilbert will be the amplitude of the
>> input signal (envelope). If you want to use that information, then the only
>> step you should add before is a very good and sweet narrow band filter (as
>> narrow as you want your frequency bins). Then, the filter design is the
>> hard part, because you need a filter that is able to filter out other
>> frequencies without introducing any kind of artifact.
>>
>> Hopefully someone else has something to add, or if I'm missing any stuff.
>>
>> Best
>>
>> Rodrigo
>>
>> On Tue, Oct 28, 2014 at 2:16 PM, Max Cantor <mcantor at umich.edu> wrote:
>>
>>> Hi,
>>>
>>> So this is not a specific method-based question, but something more
>>> general.
>>>
>>> I've been slowly reading through bits and pieces of Mike Cohen's
>>> 'Analyzing Neural Time Series Data' book, in an attempt to gain a better
>>> understanding of how things like Fourier Transform, Wavelets, and Hilbert
>>> work on a more fundamental level.
>>>
>>> Fieldtrip does not have a built in Hilbert time frequency analysis (that
>>> I'm aware of), but from having read through that chapter of Cohen's book
>>> I've been able to effectively create a hilbert analysis of my own.
>>>
>>> However, I was wondering if it would be possible to use
>>> ft_preproc_hilbert (setting cfg.hilbert = 'complex', 'real', etc. in
>>> ft_preprocessing) to do this in a more efficient and fieldtrip-compatible
>>> way. It seems I can use this setting to get the analytic signal, phase,
>>> power, and other things, but since this is on raw/epoched data, there is no
>>> obvious way I can think of to apply a time or frequency series as in the
>>> other TFRs. It seems I could either write a fieldtrip function from
>>> scratch, which I'm not prepared to do, or write a function to reformat
>>> fieldtrip data to work using the Cohen function, and then output it back
>>> into a fieldtrip function, which would be fine but I'm more interested to
>>> know if the ft_preproc_hilbert function can do what I want more efficiently.
>>>
>>> *So boiling it down**, my questions are:*
>>>
>>> 1. Can cfg.hilbert parameter for ft_preprocessing (or ft_preproc_hilbert
>>> called directly) be used as an ad hoc hilbert TFR, and if so what ad hoc
>>> steps would one need to take?
>>>
>>> 2. If it cannot be used this way, what situations is it meant for?
>>>
>>> --
>>> Max Cantor
>>> Lab Manager
>>> Computational Neurolinguistics Lab
>>> University of Michigan
>>>
>>> _______________________________________________
>>> fieldtrip mailing list
>>> fieldtrip at donders.ru.nl
>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>

--
Max Cantor
Lab Manager
Computational Neurolinguistics Lab
University of Michigan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20141028/f45ba8fa/attachment.html>
```