computational neuroscience, vision research, matlab, and whatnot

Plexon C++ API on 64-bit Linux

Plexon has a C++ SDK which I was toying around with because all Plexon software including the Matlab API is Windows only, and all of our analyses run on 64-bit Ubuntu. So I figured the command line version of the .plx reader could be modified to run on Linux and suit our needs. Surprisingly, this is pretty easy:

  1. In Plexon.h, remove all references to the Windows API.
  2. This is the hard part to figure out: in Plexon.h, in the definition of struct PL_DataBlockHeader, change unsigned long TimeStamp to unsigned int TimeStamp. A long is 8 bytes in 64-bit Linux g++ but 4 bytes in MSVC, so as is the file reader will read too many bytes per data block and then the data won’t be aligned anymore and it will crash.
  3. In plxread.cpp, #define LONGLONG long or #define LONGLONG int64_t
  4. Compile with g++
  5. If g++ bothers you about *printf, change %I64 tokens to %ld.

It should work as is. This also works for Mac. See here for an example of how you can use the SDK to process .plx files on non-Windows OS. Alternative approaches to reading .plx files in Linux include using Python with OpenElectrophy and the FieldTrip toolbox in Matlab.

Comments on: "Plexon C++ API on 64-bit Linux" (4)

  1. [...] and whatnot. It was just added to the Recommended Blogs section on the right. Some example posts: A Plexon C++ API on 64-bit Linux Using WinBUGS to track RFs Rotating a histogram in [...]

  2. [...] for example the Plexon .ddt file format. You can convert .plx to .ddt using PlexUtil on Windows, or write your own code on other platforms; I use my own Python code that uses the .plx reading facilities of OpenElectrophy to do [...]

  3. [...] you’re on your own. Now, there are non-official means to read .plx files outside of Windows, some of which I’ve written about before, but they are all more or less painful. Let me count the [...]

  4. [...] readers of the blog will remember my previous struggles reading .plx files on platforms other than Windows. I got contacted by none other than Plexon boss [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s