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:
- In Plexon.h, remove all references to the Windows API.
- 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.
- In plxread.cpp, #define LONGLONG long or #define LONGLONG int64_t
- Compile with g++
- 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.
4 responses to “Plexon C++ API on 64-bit Linux”
[…] 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 […]
[…] 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 […]
[…] 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 […]
[…] 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 […]