Forum

Notifications
Clear all

Issue Converting nirs to snirf files on Homer3

7 Posts
3 Users
0 Likes
121 Views
tthuynh
Posts: 6
Topic starter
(@tthuynh)
Active Member
Joined: 2 years ago

Hello, 

We are encountering an issue with Homer3 (v1.38.5) in which some nirs files will not be converted to snirf files on Homer3. 

For example, if there are 2 nirs files, Homer 3 will only recognize and convert 1 and not the other. The following message will show up on MATLAB

"FAILED error check: /Users/Downloads/P008_S01_CRM_AIDED.nirs will not be added to data set"

There is no pattern or visible reason this is happening and the issue is constant throughout different MATLAB versions (2017a, 2020a, 2021b)

 

If anyone is encountering the same issue/knows how to fix the issue, any help would be appreciated. 

 

Thanks in advance

6 Replies
Meredith Pecukonis
Posts: 16
(@meredith)
Active Member
Joined: 2 years ago

Hello! I am also having this issue. I have .nirs files that I try to open in Homer3. When I click "yes" to have Homer3 convert the files from .nirs to .snirf, I get the following error:

 

Reference to non-existent field 'SpatialUnit'.

Error in SnirfClass (line 153)
obj.metaDataTags.SetLengthUnit(dotnirs.SD.SpatialUnit);

Error in Nirs2Snirf (line 60)
snirf(ii) = SnirfClass(nirs);

Error in FindFiles (line 84)
Nirs2Snirf(dirnameGroup, filesSrc.files(~found));

Error in DataTreeClass/FindAndLoadGroups (line 255)
dataInit = FindFiles(obj.dirnameGroups{kk}, fmt, options);

Error in DataTreeClass (line 80)
obj.FindAndLoadGroups(groupDirs, fmt, procStreamCfgFile, options);

Error in LoadDataTree (line 50)
dataTree = DataTreeClass(groupDirs, fmt, procStreamCfgFile);

Error in MainGUI>MainGUI_OpeningFcn (line 242)
maingui.dataTree = LoadDataTree(maingui.groupDirs, maingui.format, procStreamFile);

Error in gui_mainfcn (line 220)
feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});

Error in MainGUI (line 19)
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

Error in Homer3 (line 58)
unitTest = MainGUI(groupDirs, inputFileFormat, unitTest, 'userargs');

Reply
David Boas
Posts: 238
(@dboas)
Reputable Member
Joined: 2 years ago

Looks to me that you need to go in and modify the .nirs file so that the SD structure in the .nirs file has a SpatialUnit field.

I suspect you need SD.SpatialUnit = 'mm' assuming your spatial unit is millimeters

Reply
2 Replies
Meredith Pecukonis
(@meredith)
Joined: 2 years ago

Active Member
Posts: 16

@dboas thanks David! Is there a way to load and edit my nirs file directly in matlab?

Reply
Meredith Pecukonis
(@meredith)
Joined: 2 years ago

Active Member
Posts: 16

jk I figured it out! Copying here in case anyone needs it in the future.

 

FILENAME = 'yourfilename';
load([FILENAME '.nirs'], '-mat');
SD.SpatialUnit = 'cm';  %or mm depending on your probe design
save ([FILENAME '_fixedSU.nirs'],'d','t','ml','aux','SD','s');

Reply
tthuynh
Posts: 6
Topic starter
(@tthuynh)
Active Member
Joined: 2 years ago

Hello, 

 

The error notif that comes up in MATLAB doesn't indicate anything about the SD structure in our case. It just says there was a "FAILED error check" with no further clarification. I have attached a screenshot below. In this case there were 18 nirs files in the folder, but only 16 were converted, the other 2 are said to have a "Failed error check." 

 

Help to fix this issue would be greatly appreciated, 

 

Thank you 

Reply
David Boas
Posts: 238
(@dboas)
Reputable Member
Joined: 2 years ago

@tthuynh there is some issue with those two nirs files. Two bad Homer doesn't provide a little more info about the error. Do they have different SD structures than the other 16? Can you think of any difference with those two files? Maybe they got corrupted somehow?

Reply
Share:
en_USEnglish