[FieldTrip] padding of segmented data

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Mon Jun 24 10:43:11 CEST 2013

Hi Nenad,

what Casper said is not quite true. You can pad segmented trials, but 
you are limited in how to pad. There are different ways of padding, and 
what Casper was referring to is true data padding. Once you segmented 
your trials you cannot get back to your recorded data and attach more 
data to it. This is because filtering artifacts at edges etc would 
result in discontinuities and the like. However, there are other ways to 
achieve what you want. The most elegant way in my opinion is what Casper 
already suggested. Just for completeness, you can still pad using 
zero-padding (i.e. adding a bunch of 0s in the beginning and at the end 
of your trials). Other ways are mean-padding (pad with the mean value), 
or edge-padding (using the first/last value to padding). However, with 
all these methods you mostly also add a discontinuity, but you 
explicitly ask for that in this case :) The most elegant solution here 
might be to use mirror-padding, which is recently implemented.
See here:
and here:


On 6/22/2013 2:32 PM, Casper van Heck wrote:
> Dear Nenad,
> I think the option cfg.padding only works for that iteration of 
> ft_preprocessing, but what you can do, is select larger segments 
> initially, and then run ft_preprocessing again with smaller segments.
> While you can set ft_preprocessing to apply multiple different filters 
> in one go (like a low-pass, a high-pass, and a DFT-filter, for 
> example), using a similar filter multiple times (like a high-pass 
> filter at 4Hz, and another at 8Hz) is usually not required, or 
> recommended. If you do multiple analyses on the same data (which, for 
> example, require different filters) you could find it useful to create 
> multiple smaller pipelines with their own ft_preprocessing. Debugging 
> complex analyses can be a lot easier that way:)
> Hope this helps,
> Casper
> On Sat, Jun 22, 2013 at 1:34 PM, Nenad Polomac <polomacnenad at gmail.com 
> <mailto:polomacnenad at gmail.com>> wrote:
>     Dear all,
>     In my pipeline I need two times to filter data with
>     ft_preprocessing. Is it somehow possible to pad trials
>     after segmentation? I need this in order to avoid filter artifacts
>     during the second filtering.
>     Thank you in advance!
>     Nenad
>     _______________________________________________
>     fieldtrip mailing list
>     fieldtrip at donders.ru.nl <mailto: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

Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging
Radboud University Nijmegen
Neuronal Oscillations Group
FieldTrip Development Team

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

E-Mail: jm.horschig at donders.ru.nl
Tel:    +31-(0)24-36-68493
Web: http://www.ru.nl/donders

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20130624/d7eb547a/attachment-0002.html>

More information about the fieldtrip mailing list