help > RE: spm_fnirs_read_nirscout.m issue
Jul 12, 2016  05:07 AM | Sungho Tak - Wellcome Trust Centre for Neuroimaging, UCL
RE: spm_fnirs_read_nirscout.m issue
Dear Don, 

Thank you for sharing your code. 

Yes. As you mentioned, spm_fnirs_read_nirscout.m reads information about channel configuration from header file (*.hdr), and writes that information as 'ch_config.txt' file. I think that your code skips this routine and prevents ch_config.txt file overwritten if 'ch_config.txt' file already exists in a directory of the header file (*.hdr). 

Best wishes, 

Sungho 

PS: If channel configuration is changed or does not match with information in the header file (*.hdr), you can also save it as a file with different name (eg, re_ch_config.txt), and use that file as input for spatial preprocessing. 


Originally posted by Don Rojas:
Hi Sungho,

I was running into some problems with some code I'd written that deleted channels in our nirx datasets and wrote out new channel configurations files. I hadn't realized until late that the spm_fnirs_read_nirscout script was overwriting my channel configuration file between lines 150-154. I modified the file as follows to test for an existing file, so as not to overwrite the customized one I had produced:

sfname = fullfile(pathstr, 'ch_config.txt');
if ~exist(sfname, 'file')
fid_w = fopen(sfname, 'w');
fprintf(fid_w, '%s\r\n', 'Ch, Source, Detector');
for j = 1:P.nch, fprintf(fid_w, '%s\r\n', [num2str(j) ', ' num2str(ch_sd(j,1)) ', ' num2str(ch_sd(j,2))]); end
fclose(fid_w);
end

I attached the revised file for your convenience if it makes sense to you. At any rate, the modification works well for me.

Best,

Don

Threaded View

TitleAuthorDate
Don Rojas Jul 8, 2016
RE: spm_fnirs_read_nirscout.m issue
Sungho Tak Jul 12, 2016