BYU-MicrostructureOfMaterials / OpenXY

Other
35 stars 14 forks source link

Error in selecting first image #10

Closed kangdi0209 closed 6 years ago

kangdi0209 commented 6 years ago

Dear developer,

I experienced an error (enclosed below) when trying to select the first image of my EBSD patterns. The Settings.mat file is included in an email titled "Error Report" I sent you earlier. I would really appreciate your input on this issue. Thank you!

Best regards,

Di

Index exceeds array bounds.

Error in GetImageNamesList (line 57) if (isstrprop(NameParts{i}(Rinds(end)+1),'digit')) && (isstrprop(NameParts{i}(Cinds(end)+1),'digit'))

Error in ImportImageNamesList (line 21) ImageNamesList = GetImageNamesList(Settings.ScanType, ...

Error in MainGUI>SetImageFields (line 420) handles.Settings.ImageNamesList = ImportImageNamesList(handles.Settings);

Error in MainGUI>SelectImageButton_Callback (line 380) SetImageFields(handles,name,path);

Error in gui_mainfcn (line 95) feval(varargin{:});

Error in MainGUI (line 42) gui_mainfcn(gui_State, varargin{:});

Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)MainGUI('SelectImageButton_Callback',hObject,eventdata,guidata(hObject)) Error while evaluating UIControl Callback.

image folder

eretnek commented 6 years ago

Di,

Sorry for the late reply. The problem is a fairly simple one. The solution less so. Basically, because of the spaces in the name of your images, and the fact that one of the words in your name has both an r and a c and lacks an x and a y and either the c or the r is in the final position (I know, our string parsing is terrible) it throws an error. Our method of detecting whether you're using r-c naming or x-y naming is a pile of spaghetti. Anyway, on to the possible solutions:

Rename your images to not include the spaces - sounds like a pain Comment out lines 56-63 in GetImageNamesList.m - this will break the code for r-c naming, which you shouldn't be using anyways, as it seems to change the order fo the patterns based on what version of OIM/TEAM you're using, but you can always uncomment it back

In the future, I'd avoid spaces in the name of your images, use underlines instead. Please let me know if you're still having problems.

Note to the devs, we really need to fix this string parsing, as it is very weak. I don't even understand the purpose of dividing the name into parts (lines 39-40).

-Tim

On Sat, May 19, 2018 at 5:21 PM, kangdi0209 notifications@github.com wrote:

Dear developer,

I experienced an error (enclosed below) when trying to select the first image of my EBSD patterns. The Settings.mat file is included in an email titled "Error Report" I sent you earlier. I would really appreciate your input on this issue. Thank you!

Best regards,

Di

Index exceeds array bounds.

Error in GetImageNamesList (line 57) if (isstrprop(NameParts{i}(Rinds(end)+1),'digit')) && (isstrprop(NameParts{i}(Cinds(end)+1),'digit'))

Error in ImportImageNamesList (line 21) ImageNamesList = GetImageNamesList(Settings.ScanType, ...

Error in MainGUI>SetImageFields (line 420) handles.Settings.ImageNamesList = ImportImageNamesList(handles.Settings);

Error in MainGUI>SelectImageButton_Callback (line 380) SetImageFields(handles,name,path);

Error in gui_mainfcn (line 95) feval(varargin{:});

Error in MainGUI (line 42) gui_mainfcn(gui_State, varargin{:});

Error in matlab.graphics.internal.figfile.FigFile/read>@( hObject,eventdata)MainGUI('SelectImageButton_Callback', hObject,eventdata,guidata(hObject)) Error while evaluating UIControl Callback.

[image: image folder] https://user-images.githubusercontent.com/39445277/40273028-a3a2e72e-5b86-11e8-8a45-97654df0078e.jpg

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/BYU-MicrostructureOfMaterials/OpenXY/issues/10, or mute the thread https://github.com/notifications/unsubscribe-auth/AKx0jVyZuDs25JK-APOxQcbdPucbiLpOks5t0Iy_gaJpZM4UF3Cs .

ZachClayburn commented 6 years ago

I have looked into this issue, and I have begun rewriting the code that parses the image names, and it should be working within the next couple of days. I agree with @eretnek , the function was a mess. Sorry for the inconvenience this caused you @kangdi0209 . Please let me know if I can continue to help!

kangdi0209 commented 6 years ago

Hi Tim and Zach,

Thank you both for looking into this issue and for your detailed response! No worries about the delay - I am sure you have been trying to help a lot of users.

I followed the suggestion by @eretnek to remove the spaces in my file names (fortunately it was not too difficult with PowerShell), and now it is working like a charm! Time to proceed with processing my data while leaving you with the hard work of making the code more foolproof :)

Thanks again for your timely help and for developing such a useful tool.

Di

ZachClayburn commented 6 years ago

I have updated GetImageNamesList.m to hopefully remove this bug.