Reading CNT files (download final function)

I wrote this page when I wanted to read CNT under UNIX matlab

The only function that I know which worked on my data (acquired with NEUROSCAN 3) were these 2 programs under WINDOWS/DOS-

CNTTOASC from this local folder (not available from Neuroscan anymore).
CNT2BIN from the neuroscan web site

However we do not have the source of these program and I was trying to read my data under UNIX.

OTHER PROGRAMS THAT READ CNT

CNT2ASC
(I put the link because the sources are no more accessible). However the sources do not work (output and empty file and say error in file format). I compiled them on Unix and Dos and it is the same.
but they should be close to the sources of  CNTTOASC. I tried to look at how they read the raw data. They use the channeloffset field to read blocks of data. However this field is 0 on my data.

LOADCNT
of the neurotool software. Just doesn't work on my data.

LDCNTB
Matlab function of Andrew James (he gave me his program but did not difuse it). Read well all dataset info but problem for the data itself (which are not continuous). This function is available on the previous page or down on this one.

ANALYSE_NEUROSCAN
Matlab function by J-R Duann, a co-worker of mine who have been working for Neuroscan (this guy knew what he was doing for sure). I did not test the function but it seams to me that it is only compatible with version. The function is here.

GNUROSCAN
I compiled CNTCAT
cntcat can concatenate CNT files
I checked that it worked (continous file)
The header file gnuro.h which is included alongside cntcat.c in the
Gnuroscan distribution defines the offsets for relevant elements of
the Setup (S_), Electloc (EL_), and tagged-eeg (TEEG_) data structures.
Note that Neuroscan's .CNT format actually encompasses two formats, a
block-multiplexed one for data acquired from Neuroscan's own SYNAMPS
hardware, and a fully multiplexed one for non-SYNAMPS data. Gnuroscan
handles only the fully multiplexed (non-SYNAMPS) data, because I didn't
have access to any SYNAMPS data when I wrote the code. The data that
you mention in the final paragraph on this page, in blocks of forty
short integers, must be from SYNAMPS (info courtesy of Matthew Belmonte).

STAN SOFTWARE
no sources

DUMPCNT
cannot acess page

TESTREAD
small C program I wrote determining the offset of fields in the header. However, there is a problem with the size of the header (sethead.h) because offsets appear to be 4 bytes shifted (I redownloaded the sethead.h file from the Neuroscan site, but it's the same. I manually corrected for that but send me an email at arnosalk.edu (fake 'at' sign to prevent spam) if you figure out why.

eeg_load_scan_cnt from the EEG TOOLBOX (http://eeg.sourceforge.net). I couldn't get the function to work on my data.

READING MY DATA

I first tried to find the right offset of the beginning of the data in GNUROSCAN software and put it in LDCNTB
   -> Problem: the offset is already the same in both programs

After extensive searches, I realized that for my continuous CNT files, data was stored in blocks of 40 unsigned short integers for each channel [[40 bytes] * nb_channel] * nb_blocks. I couldn't find where this parameter (size of the block) was specified in the header, so I added the option 'blockread' and input the number 40 by hand in Andrew James that I modified and documented, ldcnt (then what I read is undistinguishable from the ASCII files I would read in Matlab after conversion by CNTTOASC or CNTTOBIN).