Skip to content

Commit

Permalink
Fix data saving and default list of points
Browse files Browse the repository at this point in the history
Also update readme
  • Loading branch information
ReubenHill committed Jun 26, 2023
1 parent 1b64f88 commit 8b5471b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
Binary file modified DIGIGUI.fig
Binary file not shown.
33 changes: 23 additions & 10 deletions DIGIGUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
% 'Ar','Al' and 'Cz'. Once measured, an Atlas reference baby head, with
% these points marked, is mapped onto the graph display of points.
%
% Before the allignment of the head model, a coordinte transform is done:
% Before the allignment of the head model, a coordinate transform is done:
% 1: place the 'inion' at the origin
% 2: rotate the 'Al' into the y axis
% 3: rotate the 'Ar' into the xy plane about the new 'Inion'-'Al' y axis
Expand All @@ -38,11 +38,17 @@
% time. This is useful if one wishes to remeasure an atlas point.
%
% A list of points in absolute coordinates of the Polhemus can be specified
% along with a given tolerance in a space delimited text file. Click
% 'File/Import Expected Coordinates...' for more detail.
% to measure as 'expected coordinates'. These are specified in a CSV file
% as a list of locations and x-y-z coordinates in centimetres - see
% 'expected_coordinates_example.txt' for the format required. The tolerance
% for accepting a measurement is specified by providing a location called
% "Tolerance" with the X coordinate used as the tolerance. The list of
% points must correspond to at least some of the imported locations,
% otherwise the expected coordinates will not be imported and an error will
% be displayed.
%
% A tab delimited list of points and their XYZ coords is outputted to
% a file of the user's choosing.
% A CSV file, mat file, or excel spreadsheet of points and their XYZ coords is
% outputted to a location of the user's choosing.
%
%
% MATLAB GUIDE Generated comments:
Expand All @@ -69,7 +75,7 @@

% Edit the above text to modify the response to help DIGIGUI

% Last Modified by GUIDE v2.5 26-Jun-2023 12:38:38
% Last Modified by GUIDE v2.5 26-Jun-2023 13:46:04

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
Expand Down Expand Up @@ -1030,6 +1036,8 @@ function save_Callback(hObject, eventdata, handles)
if(filterIndex == 2)
disp(['Data saving to ' pathName fileName]);
dataOutput = get(handles.coords_table,'Data');
% remove any expected coordinates information
dataOutput = dataOutput(:, 1:4);
save([pathName fileName],'dataOutput');
disp('Data is stored in cell array "dataOutput"');

Expand All @@ -1055,8 +1063,11 @@ function save_Callback(hObject, eventdata, handles)
%Mark empty location names as '-'
data(emptyLocationNames,1) = {'-'};

tableToOutput = cell2table(data,'VariableNames', ...
get(handles.coords_table,'ColumnName'));
% remove any expected coordinates information
data = data(:, 1:4);
columnnames = handles.coords_table.ColumnName(1:4);

tableToOutput = cell2table(data,'VariableNames', columnnames);
% Note that writetable changes its output depending on the fileName
% type.
writetable(tableToOutput,[pathName fileName]);
Expand Down Expand Up @@ -1816,7 +1827,9 @@ function menu_file_import_expected_coordinates_Callback(hObject, eventdata, hand

function handles = remove_expected_coords(handles)
% handles structure with handles and user data (see GUIDATA)
handles.coords_table.Data = handles.coords_table.Data(:, 1:4);
if size(handles.coords_table.Data, 2) > 1
handles.coords_table.Data = handles.coords_table.Data(:, 1:4);
end
handles.coords_table.ColumnName = handles.coords_table.ColumnName(1:4);


Expand Down Expand Up @@ -2007,4 +2020,4 @@ function menu_file_reset_expected_coords_Callback(hObject, eventdata, handles)
handles = rmfield(handles, 'expected_coords_tolerance');
end
handles = remove_expected_coords(handles);
guidata(hObject,handles);
guidata(hObject,handles);
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ For more information see the comments in `DIGIGUI.m`.

This has been designed for use with MATLAB compiler using the `DIGIGUI.prj` file.

Copyright (C) 2022 Reuben W. Nixon-Hill (formerly Reuben W. Hill)
Copyright (C) 2023 Reuben W. Nixon-Hill (formerly Reuben W. Hill)

This package is licenced under the MIT Licence (see LICENCE.txt).
1 change: 1 addition & 0 deletions expected_coordinates_example.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Location,X,Y,Z
Nasion,15.0,0,0
Ar,0,0,0
Example Pt 1,20.0,0,0
Tolerance,10,NaN,NaN
Binary file modified savedLocationNames.mat
Binary file not shown.

0 comments on commit 8b5471b

Please sign in to comment.