neurodroid / stimfit

A program for viewing and analyzing electrophysiological data
GNU General Public License v2.0
52 stars 25 forks source link

HEKA channel interleave information missing #93

Closed AMikroulis closed 1 year ago

AMikroulis commented 2 years ago

Hello.

The current version fails with long multi-channel HEKA recordings (truncates recording). There is an old issue with hekalib.cpp.

In stimfit/src/libstfio/heka/hekalib.cpp lines 153 to 155 read:

...
    int TrFiller2; /* SET16 */
    };
C_ASSERT(sizeof(TraceRecord) == 296);
...

TrFiller2 is a 32-bit unsigned int giving the channel interleave size in bytes. The following 4 bytes (missing, but not necessary -would increase sizeof(TraceRecord) to 300) are another unsigned giving the relative offset (in bytes) to the next chunk of the same channel.

Of course this applies only to (long) recordings with >1 channels.

Edit: something should also be added (perhaps a nested loop to catch all the segments?) in the for loop at stimfit/src/libbiosiglite/biosig4c++/t210/sopen_heka_read.c line 362.

schloegl commented 1 year ago

In order to debug this issue, we'd need see an example file, or you run some tests for us. Can you provide some example file ? Alternatively, you can try converting your heka file with biosig-tools to a GDF file in the following way:
save2gdf testheka.dat testheka.gdf

Does the conversion work ? And if yes, can you load testheka.gdf into Stimfit ?

schloegl commented 1 year ago

Please check whether a recent version of stimfit (0.16.2) shows the same issue - I assume the problem is gone when using a more rencent version of stimfit.