[Eeglablist] script to batch process multiple Neuroscan CNT files

Arnaud Delorme adelorme at ucsd.edu
Tue Mar 14 10:17:04 PDT 2023


Hi Jeff,

Below is the list of all EEGLAB pipelines.

https://urldefense.com/v3/__https://eeglab.org/tutorials/11_Scripting/automated_pipeline.html__;!!Mih3wA!BQP5CBrLMHrrvZTkzZLJrYKN2hAWtuPrvO8S2W_-edj8lwePYHkgxCJTHBn91vMnDAyOwmGBNxwbgYGuv3oJ1t-R$ 

Cheers,

Arno

> On Mar 14, 2023, at 6:48 AM, Jeffrey Eriksen <jeriksen at downeurobiology.org> wrote:
> 
> Hi Cedric,
> 
> Thank you for writing out a whole script for me. If it is not too much to ask, can you modify it to scan all subfolders? I was perhaps not totally clear in my initial request. The CNT files are nested in several layers by subject and run.
> 
> More importantly, I encountered an error in the call to loadcnt. I do not presume that you know the inner workings of loadcnt, but could you take a look at the error message and see if it is something you could figure out? In the meantime I will look to see who wrote it and consider writing them directly.
> 
> -Jeff
> 
> My version (for a particular subject and run):
> % scan for and convert CNT files to SET files
> 
> dataFolder = 'D:\Sorg memory project\BU data\cue_reactivity_1\s03\run1';
> cd(dataFolder)
> filenames = dir('*.cnt');
> filenames = {filenames.name};
> eeglab; close;
> 
> for iFile = 1:length(filenames)
>   filename = filenames{iFile};
>   EEG = pop_loadcnt(fullfile(dataFolder, filename, 'dataformat', 'auto', 'memmapfile', ''));
>   EEG = pop_saveset(EEG,'filename',[filename(1:end-5) '.set'],'filepath',dataFolder);
> end
> disp('Done!')
> 
> output to command line:
>>> scan_convert
> eeglab: options file is C:\Users\Jeff\eeg_options.m
> Retrieving plugin versions from server...
> Retrieving download statistics...
> EEGLAB: adding "Biosig" v3.8.1 to the path
> EEGLAB: adding "Cleanline" v2.00 (see >> help eegplugin_cleanline)
> EEGLAB: adding "Fileio" v20230309 to the path
> EEGLAB: adding "ICLabel" v1.4 (see >> help eegplugin_iclabel)
> EEGLAB: adding "MFFMatlabIO" v4.1 (see >> help eegplugin_mffmatlabio)
> EEGLAB: adding "MFFimport" v2.3 (see >> help eegplugin_mffimport)
> EEGLAB: adding "clean_rawdata" v2.8 (see >> help eegplugin_clean_rawdata)
> EEGLAB: adding "dipfit" v5.0 (see >> help eegplugin_dipfit)
> EEGLAB: adding "egilegacy" v1.0 (see >> help eegplugin_egilegacy)
> EEGLAB: adding "firfilt" v2.7.1 (see >> help eegplugin_firfilt)
> EEGLAB: adding "neuroscanio" v1.6 (see >> help eegplugin_neuroscanio)
> You are using the latest version of EEGLAB.
> 9   for iFile = 1:length(filenames)
> Error using fread
> Invalid file identifier. Use fopen to generate a valid file identifier.
> 
> Error in loadcnt (line 110)
> h.rev               = fread(fid,12,'char');
> 
> Error in pop_loadcnt (line 132)
> 		r = loadcnt( fullFileName);
> 
> Error in scan_convert (line 11)
>   EEG = pop_loadcnt(fullfile(dataFolder, filename, 'dataformat', 'auto', 'memmapfile', ''));
> 
> 
> 
> -----Original Message-----
> From: Cedric Cannard <ccannard at protonmail.com> 
> Sent: Sunday, March 12, 2023 12:13 PM
> To: Jeffrey Eriksen <jeriksen at downeurobiology.org>
> Cc: eeglablist at sccn.ucsd.edu
> Subject: Re: [Eeglablist] FW: script to batch process multiple Neuroscan CNT files
> 
> Hi Jeff,
> 
> After installing the Neuroscanio plugin, this should do:
> 
> dataFolder = 'pathToYourDataFolder';
> cd(dataFolder )
> filenames = dir('*.cnt');
> filenames = {filenames.name};
> eeglab; close;
> 
> for iFile = 1:length(filenames)
>   filename = filenames{iFile};
>   EEG = pop_loadcnt(fullfile(dataFolder, filename, 'dataformat', 'auto', 'memmapfile', '');
> 
>    EEG = pop_saveset(EEG,'filename',[filename(1:end-5) '.set'],'filepath',dataFolder);
> 
> end
> disp('Done!')
> 
> 
> Cedric
> 
> 
> 
> ------- Original Message -------
> On Friday, March 10th, 2023 at 10:04 AM, Jeffrey Eriksen <jeriksen at downeurobiology.org> wrote:
> 
> 
>> Hello,
>> 
>> I have 327 Neuroscan CNT files. Does anyone know of a script that I could use or modify to do the following:
>> 
>> 
>> 1. Scan a set of folders and find all the CNT files 2. Import them 
>> using the neuroscanio plugin 3. Save them as SET format
>> 
>> Thanks,
>> -Jeff Eriksen
>> 
>> ________________________________
>> IMPORTANT NOTICE: This communication, including any attachment, contains important information that may be confidential or privileged, and is intended solely for the entity or individual to whom it is addressed. If you are not the intended recipient, you should contact the sender and delete this message. Any unauthorized disclosure, copying, or distribution of this message is strictly prohibited. Nothing in this email, including any attachment, is intended to be a legally binding signature.
>> _______________________________________________
>> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
>> To unsubscribe, send an empty email to 
>> eeglablist-unsubscribe at sccn.ucsd.edu
>> For digest mode, send an email with the subject "set digest mime" to 
>> eeglablist-request at sccn.ucsd.edu
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu




More information about the eeglablist mailing list