[FieldTrip] Creating a New CTF Ds file

Luke Bloy luke.bloy at gmail.com
Wed Jul 29 17:12:59 CEST 2015

Thanks for the replies.

Jan-Mathijs, I am working on some  preprocessing/artifact correction
projects and would like the option to write back to the DS format so that
others in my lab, using native ctf tools or besa, can easily incorporate
what I am doing into their pipelines. Starting with readCTFds.m and the
files in external/ctf is probbaly a good idea. Thanks.

Tom, rewriting the meg4 file would certainly work for what I need to do.
Would you be willing to share an example (Python would be fine) of writing
out to the meg4 file.


On Tue, 28 Jul 2015 at 16:12 Tom Holroyd <tomh at kurage.nimh.nih.gov> wrote:

> On Tue, 28 Jul 2015 17:03:41 +0000
> Luke Bloy <luke.bloy at gmail.com> wrote:
> > Is anyone aware of any tools for writing CTF DS files out from
> > fieldtrip data structures?
> Well, I have Python code. But the usual way to go here is to use an
> existing dataset. The CTF .meg4 file is a "flat" file*, so you can read
> in a CTF dataset, modify the data, and then easily re-write only
> the .meg4 file without changing any of the other files, assuming the
> modification doesn't change the trial structure or length of data.
> The only thing you need to do is convert the internal floating point
> representation (units of Tesla) back into the .meg4 file representation
> (32-bit integers) by inverting the gain calculation, using the same
> gains stored in the header.
> With some trickery, you can even make shorter datasets from existing
> ones using the usual newDs tool, and then rewrite the short .meg4 file
> with whatever data. Writing CTF datasets from scratch is certainly
> possible, but you're still going to be copying things from existing
> datasets (such as sensor geometry and gain factors).
> * with an 8 byte (constant) header
> --
> Dr. Tom
> --
> "There are not more than five musical notes,
> yet the combinations of these five give rise to
> more melodies than can ever be heard." -- Sun Tzu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150729/8d3ea717/attachment-0002.html>

More information about the fieldtrip mailing list