Skip to content

Commit

Permalink
trainingGui - scores added
Browse files Browse the repository at this point in the history
  • Loading branch information
stellastyl committed Jul 7, 2016
1 parent 89982cd commit 68ee143
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 18 deletions.
49 changes: 36 additions & 13 deletions trainingConstants/showSegRuleGUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,17 @@ function showSegRuleGUI( data, FLAGS, viewport )

S_flag = FLAGS.S_flag;

if ~isfield( FLAGS, 'index_score' ) % labels for segments
FLAGS.index_score = [];
end
index_score = FLAGS.index_score;

if ~isfield( FLAGS, 't_flag' ) % labels for segments
FLAGS.t_flag = 1;
end



t_flag = FLAGS.t_flag;


Expand Down Expand Up @@ -134,24 +141,32 @@ function showSegRuleGUI( data, FLAGS, viewport )
if S_flag && (~t_flag)
for ii = 1:num_segs
r = props(ii).Centroid;
tmp_flag = double(round(data.segs.scoreRaw(ii)))-double(data.segs.score(ii));

if isempty(index_score) || index_score(1) < 1 || index_score(1) > size(data.segs.info,2)
score_tmp = data.segs.scoreRaw(ii);
else
score_tmp = data.segs.info(ii,index_score);
end

tmp_flag = ((score_tmp>0) == (data.segs.score(ii)));


if tmp_flag == 0
if ~Sj_flag
text( r(1), r(2), num2str( data.segs.scoreRaw(ii), 2), 'Color', [0.5,0.5,0.5] );
text( r(1), r(2), num2str( score_tmp, 2), 'Color', [0.5,0.5,0.5] );
end
else
if data.segs.Include(ii)
text( r(1), r(2), num2str( data.segs.scoreRaw(ii), 2), 'Color', 'w' );
if isfield (data.segs, 'Include') && data.segs.Include(ii)
text( r(1), r(2), num2str( score_tmp, 2), 'Color', 'w' );
elseif ~Sj_flag
text( r(1), r(2), num2str( data.segs.scoreRaw(ii), 2), 'Color', 'g' );
text( r(1), r(2), num2str( score_tmp, 2), 'Color', 'g' );
end
end
end
end

if t_flag
for ii = 1:num_segs

for ii = 1:num_segs
r = props(ii).Centroid;
text( r(1), r(2), num2str( ii ), 'Color', 'w' );
end
Expand Down Expand Up @@ -189,13 +204,21 @@ function showSegRuleGUI( data, FLAGS, viewport )
for ii = 1:num_regs
r = data.regs.props(ii).Centroid;
flagger = 1;

if isfield (data.regs,'score')
flagger = logical(data.regs.score(ii)) == round(data.regs.scoreRaw(ii));
end
if flagger
text( r(1), r(2), num2str( data.regs.scoreRaw(ii), 2), 'Color', 'w' );
elseif ~Sj_flag
text( r(1), r(2), num2str( data.regs.scoreRaw(ii), 2), 'Color', [0.5,0.5,0.5] );
if isempty(index_score) || index_score(1) < 1 || index_score(1) > size(data.regs.info,2)
score_tmp = data.regs.scoreRaw(ii);
else
score_tmp = data.regs.info(ii,index_score);
end

flagger = ((score_tmp>0) == (data.regs.score(ii)));

if flagger
text( r(1), r(2), num2str( score_tmp, 2), 'Color', 'w' );
elseif ~Sj_flag
text( r(1), r(2), num2str( score_tmp, 2), 'Color', [0.5,0.5,0.5] );
end
end
end
end
Expand Down
Binary file modified trainingConstants/trainingGui.fig
Binary file not shown.
49 changes: 44 additions & 5 deletions trainingConstants/trainingGui.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
%
% You should have received a copy of the GNU General Public License
% along with SuperSegger. If not, see <http://www.gnu.org/licenses/>.
% Last Modified by GUIDE v2.5 29-Jun-2016 13:07:03
% Last Modified by GUIDE v2.5 06-Jul-2016 12:38:17

% Begin initialization code - DO NOT EDIT

Expand Down Expand Up @@ -420,7 +420,8 @@ function updateUI(handles)
if settings.axisFlag == 1 || settings.axisFlag == 2
% 1 for segments view, 2 for phase view.
FLAGS.im_flag = settings.axisFlag;
FLAGS.S_flag = 0;
FLAGS.S_flag = settings.handles.show_score.Value;
FLAGS.index_score = str2num(settings.handles.score_txt.String);
FLAGS.t_flag = 0;

showSegRuleGUI(settings.currentData, FLAGS, handles.viewport_train);
Expand Down Expand Up @@ -687,7 +688,14 @@ function setWorkingDirectory(directory, clearCONST, checkSave)

if exist(settings.loadDirectory, 'dir')
settings.numFrames = numel(dir([settings.loadDirectory,'*seg.mat']));
settings.loadFiles = dir([settings.loadDirectory,'*seg*.mat']);

% get files with right names
loadFiles = dir([settings.loadDirectory,'*seg*.mat']);
filenames = {loadFiles.name}';
pass_names= regexp(filenames,'seg.mat|seg_\d+_mod.mat');
pass_flag = ~cellfun('isempty',pass_names);
loadFiles(~pass_flag) = [];
settings.loadFiles = loadFiles;

if settings.numFrames > 0
settings.dataSegmented = 1;
Expand Down Expand Up @@ -1025,7 +1033,6 @@ function mask_radio_Callback(hObject, eventdata, handles)
updateUI(handles);



function crop_Callback(hObject, eventdata, handles)


Expand Down Expand Up @@ -1058,4 +1065,36 @@ function debug_ClickedCallback(hObject, eventdata, handles)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global settings;
keyboard;
keyboard;


% --- Executes on button press in show_score.
function show_score_Callback(hObject, eventdata, handles)
% hObject handle to show_score (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of show_score
updateUI(handles);


function score_txt_Callback(hObject, eventdata, handles)
% hObject handle to score_txt (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of score_txt as text
% str2double(get(hObject,'String')) returns contents of score_txt as a double
updateUI(handles);

% --- Executes during object creation, after setting all properties.
function score_txt_CreateFcn(hObject, eventdata, handles)
% hObject handle to score_txt (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

0 comments on commit 68ee143

Please sign in to comment.