From 8a639532390064c33b777b573898762f802a4784 Mon Sep 17 00:00:00 2001 From: Qi Gong Date: Tue, 21 Aug 2018 18:50:49 -0400 Subject: [PATCH] edit 5 tracking tasks. They can record each question answer log in recordStage.csv; --- .../task_tracking1_Breast_ADH_DCIS_ICA.m | 225 +++++++++++++++-- .../task_tracking2_Breast_ICA_synoptic.m | 234 +++++++++++++++++- src/tasks/task_tracking3_LN_micromets.m | 223 ++++++++++++++++- src/tasks/task_tracking4_GIST.m | 209 +++++++++++++++- .../task_tracking5_IHCproliferationIndices.m | 200 ++++++++++++++- 5 files changed, 1039 insertions(+), 52 deletions(-) diff --git a/src/tasks/task_tracking1_Breast_ADH_DCIS_ICA.m b/src/tasks/task_tracking1_Breast_ADH_DCIS_ICA.m index d6ea31e0..594dd749 100644 --- a/src/tasks/task_tracking1_Breast_ADH_DCIS_ICA.m +++ b/src/tasks/task_tracking1_Breast_ADH_DCIS_ICA.m @@ -55,6 +55,7 @@ function task_tracking1_Breast_ADH_DCIS_ICA( hObj ) if length(taskinfo.desc)>4 myData.finshedTask = myData.finshedTask + 1; end + case {'Update_GUI_Elements', ... 'ResumeButtonPressed'} % Initialize task elements @@ -72,7 +73,16 @@ function task_tracking1_Breast_ADH_DCIS_ICA( hObj ) handles = guidata(hObj); taskinfo.done2=zeros(1,12); taskinfo.done3=zeros(1,3); - handles.nnnn=0; + taskinfo.question1time = {}; + taskinfo.question1checkedBox = {}; + taskinfo.question2time = {}; + taskinfo.question2checkedBox = {}; + taskinfo.question3time = {}; + taskinfo.question3checkedBox = {}; + taskinfo.question4time = {}; + taskinfo.question4checkedBox = {}; + taskinfo.question5time = {}; + taskinfo.question5checkedBox = {}; %open pdf wsi_files = myData.wsi_files{taskinfo.slot}; wsi_files = handles.myData.wsi_files; @@ -1004,9 +1014,12 @@ function startTrackView_Callback(hObj, eventdata) % record stage position handles.recordStagePosition=[]; - handles.recordTime = []; - handles.recordStagePositionX = []; - handles.recordStagePositionY = []; +% handles.recordTime = []; +% handles.recordStagePositionX = []; +% handles.recordStagePositionY = []; + handles.recordTime = {}; + handles.recordStagePositionX = {}; + handles.recordStagePositionY = {}; guidata(hObj, handles); handles.stageTimer = timer('ExecutionMode','fixedrate','Period',2,... 'TimerFcn',{@executeStageTimer,handles.output}); @@ -1044,8 +1057,131 @@ function stopTrackView_Callback(hObj, eventdata) systemTime= handles.recordTime; PositionX=handles.recordStagePositionX; PositionY=handles.recordStagePositionY; - stageTable = table(systemTime,PositionX,PositionY); + % insert questions answered time to csv file + question1List=repmat({'NA'},[length(PositionX),1]); + question1checkedBox = taskinfo.question1checkedBox; + question1time = taskinfo.question1time; + question2List=repmat({'NA'},[length(PositionX),1]); + question2checkedBox = taskinfo.question2checkedBox; + question2time = taskinfo.question2time; + question3List=repmat({'NA'},[length(PositionX),1]); + question3checkedBox = taskinfo.question3checkedBox; + question3time = taskinfo.question3time; + question4List=repmat({'NA'},[length(PositionX),1]); + question4checkedBox = taskinfo.question4checkedBox; + question4time = taskinfo.question4time; + question5List=repmat({'NA'},[length(PositionX),1]); + question5checkedBox = taskinfo.question5checkedBox; + question5time = taskinfo.question5time; + for i = 1 : length(systemTime) + tempSystemTime = systemTime{i}; + %question 1 + if length(question1time)>=1 + tempQuestion1time = question1time{1}; + while datetime(tempQuestion1time)<=datetime(tempSystemTime) + if strcmp(question1List{i},'NA') + question1List{i} = question1checkedBox{1}; + else + question1List{i} = [question1List{i},';',question1checkedBox{1}]; + end + question1time(1) = []; + question1checkedBox(1) = []; + if length(question1time)>=1 + tempQuestion1time = question1time{1}; + else + break; + end + end + end + %question 2 + if length(question2time)>=1 + tempQuestion2time = question2time{1}; + while datetime(tempQuestion2time)<=datetime(tempSystemTime) + if strcmp(question2List{i},'NA') + question2List{i} = question2checkedBox{1}; + else + question2List{i} = [question2List{i},';',question2checkedBox{1}]; + end + question2time(1) = []; + question2checkedBox(1) = []; + if length(question2time)>=1 + tempQuestion2time = question2time{1}; + else + break; + end + end + end + %question 3 + if length(question3time)>=1 + tempQuestion3time = question3time{1}; + while datetime(tempQuestion3time)<=datetime(tempSystemTime) + if strcmp(question3List{i},'NA') + question3List{i} = question3checkedBox{1}; + else + question3List{i} = [question3List{i},';',question3checkedBox{1}]; + end + question3time(1) = []; + question3checkedBox(1) = []; + if length(question3time)>=1 + tempQuestion3time = question3time{1}; + else + break; + end + end + end + %question 4 + if length(question4time)>=1 + tempQuestion4time = question4time{1}; + while datetime(tempQuestion4time)<=datetime(tempSystemTime) + if strcmp(question4List{i},'NA') + question4List{i} = question4checkedBox{1}; + else + question4List{i} = [question4List{i},';',question4checkedBox{1}]; + end + question4time(1) = []; + question4checkedBox(1) = []; + if length(question4time)>=1 + tempQuestion4time = question4time{1}; + else + break; + end + end + end + %question 5 + if length(question5time)>=1 + tempQuestion5time = question5time{1}; + while datetime(tempQuestion5time)<=datetime(tempSystemTime) + if strcmp(question5List{i},'NA') + question5List{i} = question5checkedBox{1}; + else + question5List{i} = [question5List{i},';',question5checkedBox{1}]; + end + question5time(1) = []; + question5checkedBox(1) = []; + if length(question5time)>=1 + tempQuestion5time = question5time{1}; + else + break; + end + end + end + end + systemTime = systemTime'; + PositionX = PositionX'; + PositionY = PositionY'; + stageTable = table(systemTime,PositionX,PositionY,question1List,question2List,question3List,question4List,question5List); writetable(stageTable,stageFileName); + % double check + t1 = table(taskinfo.question1time',taskinfo.question1checkedBox'); + writetable(t1,'q1.csv'); + t2 = table(taskinfo.question2time',taskinfo.question2checkedBox'); + writetable(t2,'q2.csv'); + t3 = table(taskinfo.question3time',taskinfo.question3checkedBox'); + writetable(t3,'q3.csv'); + t4 = table(taskinfo.question4time',taskinfo.question4checkedBox'); + writetable(t4,'q4.csv'); + t5 = table(taskinfo.question5time',taskinfo.question5checkedBox'); + writetable(t5,'q5.csv'); % audio audioExist = audiodevinfo; if (size(audioExist.input,1)>0) @@ -1071,11 +1207,8 @@ function stopTrackView_Callback(hObj, eventdata) % manage buttons set(handles.recodingStatus,'String',{'Click Start tracking button to record'}); set(handles.startTracking,'Enable','on'); - - - taskinfo.done2(11)=1; - tdone2=sum(taskinfo.done2); + tdone2=sum(taskinfo.done2); if tdone2==12 set(handles.goToPage3, 'Enable', 'on'); end @@ -1090,9 +1223,14 @@ function executeStageTimer(hObject, eventdata, hFigure) % time1=clock; handles = guidata(hFigure); handles.myData.stage = stage_get_pos(handles.myData.stage); - handles.recordTime = [handles.recordTime;datestr(clock,30)]; - handles.recordStagePositionX = [handles.recordStagePositionX; handles.myData.stage.Pos(1)]; - handles.recordStagePositionY = [handles.recordStagePositionY; handles.myData.stage.Pos(2)]; +% handles.recordTime = [handles.recordTime;datestr(clock,30)]; +% handles.recordStagePositionX = [handles.recordStagePositionX; handles.myData.stage.Pos(1)]; +% handles.recordStagePositionY = [handles.recordStagePositionY; handles.myData.stage.Pos(2)]; + + recordLength = length(handles.recordTime); + handles.recordTime{recordLength+1} = datestr(clock,30); + handles.recordStagePositionX{recordLength+1} = handles.myData.stage.Pos(1); + handles.recordStagePositionY{recordLength+1} = handles.myData.stage.Pos(2); %disp(currentTimeInfo); % time2=clock; % etime(time1,time2) @@ -1104,10 +1242,14 @@ function executeStageTimer(hObject, eventdata, hFigure) function question1Checkbox1_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(1)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B1Check'; else taskinfo.question1result(1)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B1Uncheck'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1122,10 +1264,14 @@ function question1Checkbox1_Callback(hObj, eventdata) function question1Checkbox2_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(2)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B2Check'; else taskinfo.question1result(2)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B2Uncheck'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1140,10 +1286,14 @@ function question1Checkbox2_Callback(hObj, eventdata) function question1Checkbox3_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(3)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B3Check'; else taskinfo.question1result(3)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B3Uncheck'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1158,10 +1308,14 @@ function question1Checkbox3_Callback(hObj, eventdata) function question1Checkbox4_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(4)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B4Check'; else taskinfo.question1result(4)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B4Uncheck'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1193,10 +1347,14 @@ function questionConfidence1_Callback (hObj, eventdata) function question2Checkbox1_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(1)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B1Check'; else taskinfo.question2result(1)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B1Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1211,10 +1369,14 @@ function question2Checkbox1_Callback(hObj, eventdata) function question2Checkbox2_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(2)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B2Check'; else taskinfo.question2result(2)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B2Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1229,10 +1391,14 @@ function question2Checkbox2_Callback(hObj, eventdata) function question2Checkbox3_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(3)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B3Check'; else taskinfo.question2result(3)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B3Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1247,10 +1413,14 @@ function question2Checkbox3_Callback(hObj, eventdata) function question2Checkbox4_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(4)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B4Check'; else taskinfo.question2result(4)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B4Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1281,10 +1451,14 @@ function questionConfidence2_Callback (hObj, eventdata) function question3Checkbox1_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question3result(1)=1; + taskinfo.question3checkedBox{recordLength+1} = 'B1Check'; else taskinfo.question3result(1)=0; + taskinfo.question3checkedBox{recordLength+1} = 'B1Uncheck'; end taskinfo.done2(5)=1; tdone2=sum(taskinfo.done2); @@ -1299,10 +1473,14 @@ function question3Checkbox1_Callback(hObj, eventdata) function question3Checkbox2_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question3result(2)=1; + taskinfo.question3checkedBox{recordLength+1} = 'B2Check'; else taskinfo.question3result(2)=0; + taskinfo.question3checkedBox{recordLength+1} = 'B2Uncheck'; end taskinfo.done2(5)=1; tdone2=sum(taskinfo.done2); @@ -1317,10 +1495,14 @@ function question3Checkbox2_Callback(hObj, eventdata) function question3Checkbox3_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question3result(3)=1; + taskinfo.question3checkedBox{recordLength+1} = 'B3Check'; else taskinfo.question3result(3)=0; + taskinfo.question3checkedBox{recordLength+1} = 'B3Uncheck'; end taskinfo.done2(5)=1; tdone2=sum(taskinfo.done2); @@ -1335,11 +1517,15 @@ function question3Checkbox3_Callback(hObj, eventdata) function question3Checkbox4_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question3result(4)=1; + taskinfo.question3checkedBox{recordLength+1} = 'B4Check'; else taskinfo.question3result(4)=0; - end + taskinfo.question3checkedBox{recordLength+1} = 'B4Uncheck'; + end taskinfo.done2(5)=1; tdone2=sum(taskinfo.done2); if tdone2==12 @@ -1369,14 +1555,18 @@ function questionConfidence3_Callback (hObj, eventdata) function question4Radiobutton_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; - + recordLength = length(taskinfo.question4time); + taskinfo.question4time{recordLength+1} = datestr(clock,30); taskinfo.button_desc = get(eventdata.NewValue, 'Tag'); switch taskinfo.button_desc case 'question4Radiobutton1' taskinfo.question4result = 'Yes'; + taskinfo.question4checkedBox{recordLength+1} = 'Yes'; case 'question4Radiobutton0' - taskinfo.question4result = 'No' + taskinfo.question4result = 'No'; + taskinfo.question4checkedBox{recordLength+1} = 'No'; end + taskinfo.done2(7)=1; tdone2=sum(taskinfo.done2); if tdone2==12 @@ -1407,13 +1597,16 @@ function questionConfidence4_Callback (hObj, eventdata) function question5Radiobutton_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; - + recordLength = length(taskinfo.question5time); + taskinfo.question5time{recordLength+1} = datestr(clock,30); taskinfo.button_desc = get(eventdata.NewValue, 'Tag'); switch taskinfo.button_desc case 'question5Radiobutton1' taskinfo.question5result = 'Yes'; + taskinfo.question5checkedBox{recordLength+1} = 'Yes'; case 'question5Radiobutton0' taskinfo.question5result = 'No'; + taskinfo.question5checkedBox{recordLength+1} = 'No'; end taskinfo.done2(9)=1; tdone2=sum(taskinfo.done2); diff --git a/src/tasks/task_tracking2_Breast_ICA_synoptic.m b/src/tasks/task_tracking2_Breast_ICA_synoptic.m index 9aa8f9fe..38d5e74b 100644 --- a/src/tasks/task_tracking2_Breast_ICA_synoptic.m +++ b/src/tasks/task_tracking2_Breast_ICA_synoptic.m @@ -72,7 +72,16 @@ function task_tracking2_Breast_ICA_synoptic( hObj ) handles = guidata(hObj); taskinfo.done2=zeros(1,12); taskinfo.done3=zeros(1,3); - handles.nnnn=0; + taskinfo.question1time = {}; + taskinfo.question1checkedBox = {}; + taskinfo.question2time = {}; + taskinfo.question2checkedBox = {}; + taskinfo.question3time = {}; + taskinfo.question3checkedBox = {}; + taskinfo.question4time = {}; + taskinfo.question4checkedBox = {}; + taskinfo.question5time = {}; + taskinfo.question5checkedBox = {}; %open pdf wsi_files = myData.wsi_files{taskinfo.slot}; wsi_files = handles.myData.wsi_files; @@ -1058,9 +1067,12 @@ function startTrackView_Callback(hObj, eventdata) % record stage position handles.recordStagePosition=[]; - handles.recordTime = []; - handles.recordStagePositionX = []; - handles.recordStagePositionY = []; +% handles.recordTime = []; +% handles.recordStagePositionX = []; +% handles.recordStagePositionY = []; + handles.recordTime = {}; + handles.recordStagePositionX = {}; + handles.recordStagePositionY = {}; guidata(hObj, handles); handles.stageTimer = timer('ExecutionMode','fixedrate','Period',2,... 'TimerFcn',{@executeStageTimer,handles.output}); @@ -1098,8 +1110,131 @@ function stopTrackView_Callback(hObj, eventdata) systemTime= handles.recordTime; PositionX=handles.recordStagePositionX; PositionY=handles.recordStagePositionY; - stageTable = table(systemTime,PositionX,PositionY); + % insert questions answered time to csv file + question1List=repmat({'NA'},[length(PositionX),1]); + question1checkedBox = taskinfo.question1checkedBox; + question1time = taskinfo.question1time; + question2List=repmat({'NA'},[length(PositionX),1]); + question2checkedBox = taskinfo.question2checkedBox; + question2time = taskinfo.question2time; + question3List=repmat({'NA'},[length(PositionX),1]); + question3checkedBox = taskinfo.question3checkedBox; + question3time = taskinfo.question3time; + question4List=repmat({'NA'},[length(PositionX),1]); + question4checkedBox = taskinfo.question4checkedBox; + question4time = taskinfo.question4time; + question5List=repmat({'NA'},[length(PositionX),1]); + question5checkedBox = taskinfo.question5checkedBox; + question5time = taskinfo.question5time; + for i = 1 : length(systemTime) + tempSystemTime = systemTime{i}; + %question 1 + if length(question1time)>=1 + tempQuestion1time = question1time{1}; + while datetime(tempQuestion1time)<=datetime(tempSystemTime) + if strcmp(question1List{i},'NA') + question1List{i} = question1checkedBox{1}; + else + question1List{i} = [question1List{i},';',question1checkedBox{1}]; + end + question1time(1) = []; + question1checkedBox(1) = []; + if length(question1time)>=1 + tempQuestion1time = question1time{1}; + else + break; + end + end + end + %question 2 + if length(question2time)>=1 + tempQuestion2time = question2time{1}; + while datetime(tempQuestion2time)<=datetime(tempSystemTime) + if strcmp(question2List{i},'NA') + question2List{i} = question2checkedBox{1}; + else + question2List{i} = [question2List{i},';',question2checkedBox{1}]; + end + question2time(1) = []; + question2checkedBox(1) = []; + if length(question2time)>=1 + tempQuestion2time = question2time{1}; + else + break; + end + end + end + %question 3 + if length(question3time)>=1 + tempQuestion3time = question3time{1}; + while datetime(tempQuestion3time)<=datetime(tempSystemTime) + if strcmp(question3List{i},'NA') + question3List{i} = question3checkedBox{1}; + else + question3List{i} = [question3List{i},';',question3checkedBox{1}]; + end + question3time(1) = []; + question3checkedBox(1) = []; + if length(question3time)>=1 + tempQuestion3time = question3time{1}; + else + break; + end + end + end + %question 4 + if length(question4time)>=1 + tempQuestion4time = question4time{1}; + while datetime(tempQuestion4time)<=datetime(tempSystemTime) + if strcmp(question4List{i},'NA') + question4List{i} = question4checkedBox{1}; + else + question4List{i} = [question4List{i},';',question4checkedBox{1}]; + end + question4time(1) = []; + question4checkedBox(1) = []; + if length(question4time)>=1 + tempQuestion4time = question4time{1}; + else + break; + end + end + end + %question 5 + if length(question5time)>=1 + tempQuestion5time = question5time{1}; + while datetime(tempQuestion5time)<=datetime(tempSystemTime) + if strcmp(question5List{i},'NA') + question5List{i} = question5checkedBox{1}; + else + question5List{i} = [question5List{i},';',question5checkedBox{1}]; + end + question5time(1) = []; + question5checkedBox(1) = []; + if length(question5time)>=1 + tempQuestion5time = question5time{1}; + else + break; + end + end + end + end + systemTime = systemTime'; + PositionX = PositionX'; + PositionY = PositionY'; + stageTable = table(systemTime,PositionX,PositionY,question1List,question2List,question3List,question4List,question5List); writetable(stageTable,stageFileName); + % double check + t1 = table(taskinfo.question1time',taskinfo.question1checkedBox'); + writetable(t1,'q1.csv'); + t2 = table(taskinfo.question2time',taskinfo.question2checkedBox'); + writetable(t2,'q2.csv'); + t3 = table(taskinfo.question3time',taskinfo.question3checkedBox'); + writetable(t3,'q3.csv'); + t4 = table(taskinfo.question4time',taskinfo.question4checkedBox'); + writetable(t4,'q4.csv'); + t5 = table(taskinfo.question5time',taskinfo.question5checkedBox'); + writetable(t5,'q5.csv'); % audio audioExist = audiodevinfo; if (size(audioExist.input,1)>0) @@ -1144,9 +1279,13 @@ function executeStageTimer(hObject, eventdata, hFigure) % time1=clock; handles = guidata(hFigure); handles.myData.stage = stage_get_pos(handles.myData.stage); - handles.recordTime = [handles.recordTime;datestr(clock,30)]; - handles.recordStagePositionX = [handles.recordStagePositionX; handles.myData.stage.Pos(1)]; - handles.recordStagePositionY = [handles.recordStagePositionY; handles.myData.stage.Pos(2)]; +% handles.recordTime = [handles.recordTime;datestr(clock,30)]; +% handles.recordStagePositionX = [handles.recordStagePositionX; handles.myData.stage.Pos(1)]; +% handles.recordStagePositionY = [handles.recordStagePositionY; handles.myData.stage.Pos(2)]; + recordLength = length(handles.recordTime); + handles.recordTime{recordLength+1} = datestr(clock,30); + handles.recordStagePositionX{recordLength+1} = handles.myData.stage.Pos(1); + handles.recordStagePositionY{recordLength+1} = handles.myData.stage.Pos(2); %disp(currentTimeInfo); % time2=clock; % etime(time1,time2) @@ -1158,10 +1297,14 @@ function executeStageTimer(hObject, eventdata, hFigure) function question1Checkbox1_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(1)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B1Check'; else taskinfo.question1result(1)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B1Uncheck' end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1176,10 +1319,14 @@ function question1Checkbox1_Callback(hObj, eventdata) function question1Checkbox2_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(2)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B2Check'; else taskinfo.question1result(2)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B2Uncheck'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1194,10 +1341,14 @@ function question1Checkbox2_Callback(hObj, eventdata) function question1Checkbox3_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30) if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(3)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B3Check'; else taskinfo.question1result(3)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B3Uncheck'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1212,10 +1363,14 @@ function question1Checkbox3_Callback(hObj, eventdata) function question1Checkbox4_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(4)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B4Check'; else taskinfo.question1result(4)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B4Uncheck'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1247,10 +1402,14 @@ function questionConfidence1_Callback (hObj, eventdata) function question2Checkbox1_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(1)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B1Check'; else taskinfo.question2result(1)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B1Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1265,10 +1424,14 @@ function question2Checkbox1_Callback(hObj, eventdata) function question2Checkbox2_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(2)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B2Check'; else taskinfo.question2result(2)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B2Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1283,10 +1446,14 @@ function question2Checkbox2_Callback(hObj, eventdata) function question2Checkbox3_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(3)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B3Check'; else taskinfo.question2result(3)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B3Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1301,10 +1468,14 @@ function question2Checkbox3_Callback(hObj, eventdata) function question2Checkbox4_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(4)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B4Check'; else taskinfo.question2result(4)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B4Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1319,10 +1490,14 @@ function question2Checkbox4_Callback(hObj, eventdata) function question2Checkbox5_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(5)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B5Check'; else taskinfo.question2result(5)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B5Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1337,10 +1512,14 @@ function question2Checkbox5_Callback(hObj, eventdata) function question2Checkbox6_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(6)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B6Check'; else taskinfo.question2result(6)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B6Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1355,10 +1534,14 @@ function question2Checkbox6_Callback(hObj, eventdata) function question2Checkbox7_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(7)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B7Check'; else taskinfo.question2result(7)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B7Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1389,10 +1572,14 @@ function questionConfidence2_Callback (hObj, eventdata) function question3Checkbox1_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question3result(1)=1; + taskinfo.question3checkedBox{recordLength+1} = 'B1Check'; else taskinfo.question3result(1)=0; + taskinfo.question3checkedBox{recordLength+1} = 'B1Uncheck'; end taskinfo.done2(5)=1; tdone2=sum(taskinfo.done2); @@ -1407,10 +1594,14 @@ function question3Checkbox1_Callback(hObj, eventdata) function question3Checkbox2_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question3result(2)=1; + taskinfo.question3checkedBox{recordLength+1} = 'B2Check'; else taskinfo.question3result(2)=0; + taskinfo.question3checkedBox{recordLength+1} = 'B2Uncheck'; end taskinfo.done2(5)=1; tdone2=sum(taskinfo.done2); @@ -1425,10 +1616,14 @@ function question3Checkbox2_Callback(hObj, eventdata) function question3Checkbox3_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question3result(3)=1; + taskinfo.question3checkedBox{recordLength+1} = 'B3Check'; else taskinfo.question3result(3)=0; + taskinfo.question3checkedBox{recordLength+1} = 'B3Uncheck'; end taskinfo.done2(5)=1; tdone2=sum(taskinfo.done2); @@ -1443,10 +1638,14 @@ function question3Checkbox3_Callback(hObj, eventdata) function question3Checkbox4_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question3result(4)=1; + taskinfo.question3checkedBox{recordLength+1} = 'B4Check'; else taskinfo.question3result(4)=0; + taskinfo.question3checkedBox{recordLength+1} = 'B4Uncheck'; end taskinfo.done2(5)=1; tdone2=sum(taskinfo.done2); @@ -1477,10 +1676,14 @@ function questionConfidence3_Callback (hObj, eventdata) function question4Checkbox1_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question4time); + taskinfo.question4time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question4result(1)=1; + taskinfo.question4checkedBox{recordLength+1} = 'B1Check'; else taskinfo.question4result(1)=0; + taskinfo.question4checkedBox{recordLength+1} = 'B1Uncheck'; end taskinfo.done2(7)=1; tdone2=sum(taskinfo.done2); @@ -1495,10 +1698,14 @@ function question4Checkbox1_Callback(hObj, eventdata) function question4Checkbox2_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question4time); + taskinfo.question4time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question4result(2)=1; + taskinfo.question4checkedBox{recordLength+1} = 'B2Check'; else taskinfo.question4result(2)=0; + taskinfo.question4checkedBox{recordLength+1} = 'B2Uncheck'; end taskinfo.done2(7)=1; tdone2=sum(taskinfo.done2); @@ -1513,10 +1720,14 @@ function question4Checkbox2_Callback(hObj, eventdata) function question4Checkbox3_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question4time); + taskinfo.question4time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question4result(3)=1; + taskinfo.question4checkedBox{recordLength+1} = 'B3Check'; else taskinfo.question4result(3)=0; + taskinfo.question4checkedBox{recordLength+1} = 'B3Uncheck'; end taskinfo.done2(7)=1; tdone2=sum(taskinfo.done2); @@ -1531,10 +1742,14 @@ function question4Checkbox3_Callback(hObj, eventdata) function question4Checkbox4_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question4time); + taskinfo.question4time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question4result(4)=1; + taskinfo.question4checkedBox{recordLength+1} = 'B4Check'; else taskinfo.question4result(4)=0; + taskinfo.question4checkedBox{recordLength+1} = 'B4Uncheck'; end taskinfo.done2(7)=1; tdone2=sum(taskinfo.done2); @@ -1565,6 +1780,9 @@ function questionConfidence4_Callback (hObj, eventdata) function question5Comment_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question5time); + taskinfo.question5time{recordLength+1} = datestr(clock,30); + taskinfo.question5checkedBox{recordLength+1} = 'Edit'; % Pack the results taskinfo.question5result = get(handles.question5Comment, 'String'); taskinfo.done2(9)=1; diff --git a/src/tasks/task_tracking3_LN_micromets.m b/src/tasks/task_tracking3_LN_micromets.m index c417f03a..90f6b117 100644 --- a/src/tasks/task_tracking3_LN_micromets.m +++ b/src/tasks/task_tracking3_LN_micromets.m @@ -71,6 +71,16 @@ function task_tracking3_LN_micromets( hObj ) handles = guidata(hObj); taskinfo.done2=zeros(1,12); taskinfo.done3=zeros(1,3); + taskinfo.question1time = {}; + taskinfo.question1checkedBox = {}; + taskinfo.question2time = {}; + taskinfo.question2checkedBox = {}; + taskinfo.question3time = {}; + taskinfo.question3checkedBox = {}; + taskinfo.question4time = {}; + taskinfo.question4checkedBox = {}; + taskinfo.question5time = {}; + taskinfo.question5checkedBox = {}; handles.nnnn=0; %open pdf wsi_files = myData.wsi_files{taskinfo.slot}; @@ -1029,9 +1039,12 @@ function startTrackView_Callback(hObj, eventdata) % record stage position handles.recordStagePosition=[]; - handles.recordTime = []; - handles.recordStagePositionX = []; - handles.recordStagePositionY = []; + % handles.recordTime = []; +% handles.recordStagePositionX = []; +% handles.recordStagePositionY = []; + handles.recordTime = {}; + handles.recordStagePositionX = {}; + handles.recordStagePositionY = {}; guidata(hObj, handles); handles.stageTimer = timer('ExecutionMode','fixedrate','Period',2,... 'TimerFcn',{@executeStageTimer,handles.output}); @@ -1069,8 +1082,131 @@ function stopTrackView_Callback(hObj, eventdata) systemTime= handles.recordTime; PositionX=handles.recordStagePositionX; PositionY=handles.recordStagePositionY; - stageTable = table(systemTime,PositionX,PositionY); + % insert questions answered time to csv file + question1List=repmat({'NA'},[length(PositionX),1]); + question1checkedBox = taskinfo.question1checkedBox; + question1time = taskinfo.question1time; + question2List=repmat({'NA'},[length(PositionX),1]); + question2checkedBox = taskinfo.question2checkedBox; + question2time = taskinfo.question2time; + question3List=repmat({'NA'},[length(PositionX),1]); + question3checkedBox = taskinfo.question3checkedBox; + question3time = taskinfo.question3time; + question4List=repmat({'NA'},[length(PositionX),1]); + question4checkedBox = taskinfo.question4checkedBox; + question4time = taskinfo.question4time; + question5List=repmat({'NA'},[length(PositionX),1]); + question5checkedBox = taskinfo.question5checkedBox; + question5time = taskinfo.question5time; + for i = 1 : length(systemTime) + tempSystemTime = systemTime{i}; + %question 1 + if length(question1time)>=1 + tempQuestion1time = question1time{1}; + while datetime(tempQuestion1time)<=datetime(tempSystemTime) + if strcmp(question1List{i},'NA') + question1List{i} = question1checkedBox{1}; + else + question1List{i} = [question1List{i},';',question1checkedBox{1}]; + end + question1time(1) = []; + question1checkedBox(1) = []; + if length(question1time)>=1 + tempQuestion1time = question1time{1}; + else + break; + end + end + end + %question 2 + if length(question2time)>=1 + tempQuestion2time = question2time{1}; + while datetime(tempQuestion2time)<=datetime(tempSystemTime) + if strcmp(question2List{i},'NA') + question2List{i} = question2checkedBox{1}; + else + question2List{i} = [question2List{i},';',question2checkedBox{1}]; + end + question2time(1) = []; + question2checkedBox(1) = []; + if length(question2time)>=1 + tempQuestion2time = question2time{1}; + else + break; + end + end + end + %question 3 + if length(question3time)>=1 + tempQuestion3time = question3time{1}; + while datetime(tempQuestion3time)<=datetime(tempSystemTime) + if strcmp(question3List{i},'NA') + question3List{i} = question3checkedBox{1}; + else + question3List{i} = [question3List{i},';',question3checkedBox{1}]; + end + question3time(1) = []; + question3checkedBox(1) = []; + if length(question3time)>=1 + tempQuestion3time = question3time{1}; + else + break; + end + end + end + %question 4 + if length(question4time)>=1 + tempQuestion4time = question4time{1}; + while datetime(tempQuestion4time)<=datetime(tempSystemTime) + if strcmp(question4List{i},'NA') + question4List{i} = question4checkedBox{1}; + else + question4List{i} = [question4List{i},';',question4checkedBox{1}]; + end + question4time(1) = []; + question4checkedBox(1) = []; + if length(question4time)>=1 + tempQuestion4time = question4time{1}; + else + break; + end + end + end + %question 5 + if length(question5time)>=1 + tempQuestion5time = question5time{1}; + while datetime(tempQuestion5time)<=datetime(tempSystemTime) + if strcmp(question5List{i},'NA') + question5List{i} = question5checkedBox{1}; + else + question5List{i} = [question5List{i},';',question5checkedBox{1}]; + end + question5time(1) = []; + question5checkedBox(1) = []; + if length(question5time)>=1 + tempQuestion5time = question5time{1}; + else + break; + end + end + end + end + systemTime = systemTime'; + PositionX = PositionX'; + PositionY = PositionY'; + stageTable = table(systemTime,PositionX,PositionY,question1List,question2List,question3List,question4List,question5List); writetable(stageTable,stageFileName); + % double check + t1 = table(taskinfo.question1time',taskinfo.question1checkedBox'); + writetable(t1,'q1.csv'); + t2 = table(taskinfo.question2time',taskinfo.question2checkedBox'); + writetable(t2,'q2.csv'); + t3 = table(taskinfo.question3time',taskinfo.question3checkedBox'); + writetable(t3,'q3.csv'); + t4 = table(taskinfo.question4time',taskinfo.question4checkedBox'); + writetable(t4,'q4.csv'); + t5 = table(taskinfo.question5time',taskinfo.question5checkedBox'); + writetable(t5,'q5.csv'); % audio audioExist = audiodevinfo; if (size(audioExist.input,1)>0) @@ -1115,9 +1251,14 @@ function executeStageTimer(hObject, eventdata, hFigure) % time1=clock; handles = guidata(hFigure); handles.myData.stage = stage_get_pos(handles.myData.stage); - handles.recordTime = [handles.recordTime;datestr(clock,30)]; - handles.recordStagePositionX = [handles.recordStagePositionX; handles.myData.stage.Pos(1)]; - handles.recordStagePositionY = [handles.recordStagePositionY; handles.myData.stage.Pos(2)]; +% handles.recordTime = [handles.recordTime;datestr(clock,30)]; +% handles.recordStagePositionX = [handles.recordStagePositionX; handles.myData.stage.Pos(1)]; +% handles.recordStagePositionY = [handles.recordStagePositionY; handles.myData.stage.Pos(2)]; + + recordLength = length(handles.recordTime); + handles.recordTime{recordLength+1} = datestr(clock,30); + handles.recordStagePositionX{recordLength+1} = handles.myData.stage.Pos(1); + handles.recordStagePositionY{recordLength+1} = handles.myData.stage.Pos(2); %disp(currentTimeInfo); % time2=clock; % etime(time1,time2) @@ -1130,13 +1271,16 @@ function executeStageTimer(hObject, eventdata, hFigure) function question1Radiobutton_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; - + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); taskinfo.button_desc = get(eventdata.NewValue, 'Tag'); switch taskinfo.button_desc case 'question1Radiobutton1' taskinfo.question1result = 'Benign'; + taskinfo.question1checkedBox{recordLength+1} = 'Benign'; case 'question1Radiobutton2' taskinfo.question1result = 'Metastasis'; + taskinfo.question1checkedBox{recordLength+1} = 'Metastasis'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1169,10 +1313,14 @@ function questionConfidence1_Callback (hObj, eventdata) function question2Checkbox1_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(1)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B1Check'; else taskinfo.question2result(1)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B1Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1187,10 +1335,14 @@ function question2Checkbox1_Callback(hObj, eventdata) function question2Checkbox2_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(2)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B2Check'; else taskinfo.question2result(2)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B2Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1205,10 +1357,14 @@ function question2Checkbox2_Callback(hObj, eventdata) function question2Checkbox3_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(3)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B3Check'; else taskinfo.question2result(3)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B3Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1223,10 +1379,14 @@ function question2Checkbox3_Callback(hObj, eventdata) function question2Checkbox4_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(4)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B4Check'; else taskinfo.question2result(4)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B4Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1257,10 +1417,14 @@ function questionConfidence2_Callback (hObj, eventdata) function question3Checkbox1_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question3result(1)=1; + taskinfo.question3checkedBox{recordLength+1} = 'B1Check'; else taskinfo.question3result(1)=0; + taskinfo.question3checkedBox{recordLength+1} = 'B1Uncheck'; end taskinfo.done2(5)=1; tdone2=sum(taskinfo.done2); @@ -1275,10 +1439,14 @@ function question3Checkbox1_Callback(hObj, eventdata) function question3Checkbox2_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question3result(2)=1; + taskinfo.question3checkedBox{recordLength+1} = 'B2Check'; else taskinfo.question3result(2)=0; + taskinfo.question3checkedBox{recordLength+1} = 'B2Uncheck'; end taskinfo.done2(5)=1; tdone2=sum(taskinfo.done2); @@ -1293,10 +1461,14 @@ function question3Checkbox2_Callback(hObj, eventdata) function question3Checkbox3_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question3result(3)=1; + taskinfo.question3checkedBox{recordLength+1} = 'B3Check'; else taskinfo.question3result(3)=0; + taskinfo.question3checkedBox{recordLength+1} = 'B3Uncheck'; end taskinfo.done2(5)=1; tdone2=sum(taskinfo.done2); @@ -1311,10 +1483,14 @@ function question3Checkbox3_Callback(hObj, eventdata) function question3Checkbox4_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question3result(4)=1; + taskinfo.question3checkedBox{recordLength+1} = 'B4Check'; else taskinfo.question3result(4)=0; + taskinfo.question3checkedBox{recordLength+1} = 'B4Uncheck'; end taskinfo.done2(5)=1; tdone2=sum(taskinfo.done2); @@ -1329,10 +1505,14 @@ function question3Checkbox4_Callback(hObj, eventdata) function question3Checkbox5_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question3result(5)=1; + taskinfo.question3checkedBox{recordLength+1} = 'B5Check'; else taskinfo.question3result(5)=0; + taskinfo.question3checkedBox{recordLength+1} = 'B5Uncheck'; end taskinfo.done2(5)=1; tdone2=sum(taskinfo.done2); @@ -1347,10 +1527,14 @@ function question3Checkbox5_Callback(hObj, eventdata) function question3Checkbox6_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question3result(6)=1; + taskinfo.question3checkedBox{recordLength+1} = 'B6Check'; else taskinfo.question3result(6)=0; + taskinfo.question3checkedBox{recordLength+1} = 'B6Uncheck'; end taskinfo.done2(5)=1; tdone2=sum(taskinfo.done2); @@ -1381,10 +1565,14 @@ function questionConfidence3_Callback (hObj, eventdata) function question4Checkbox1_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question4time); + taskinfo.question4time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question4result(1)=1; + taskinfo.question4checkedBox{recordLength+1} = 'B1Check'; else taskinfo.question4result(1)=0; + taskinfo.question4checkedBox{recordLength+1} = 'B1Uncheck'; end taskinfo.done2(7)=1; tdone2=sum(taskinfo.done2); @@ -1399,10 +1587,14 @@ function question4Checkbox1_Callback(hObj, eventdata) function question4Checkbox2_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question4time); + taskinfo.question4time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question4result(2)=1; + taskinfo.question4checkedBox{recordLength+1} = 'B2Check'; else taskinfo.question4result(2)=0; + taskinfo.question4checkedBox{recordLength+1} = 'B2Uncheck'; end taskinfo.done2(7)=1; tdone2=sum(taskinfo.done2); @@ -1417,10 +1609,14 @@ function question4Checkbox2_Callback(hObj, eventdata) function question4Checkbox3_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question4time); + taskinfo.question4time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question4result(3)=1; + taskinfo.question4checkedBox{recordLength+1} = 'B3Check'; else taskinfo.question4result(3)=0; + taskinfo.question4checkedBox{recordLength+1} = 'B3Uncheck'; end taskinfo.done2(7)=1; tdone2=sum(taskinfo.done2); @@ -1435,10 +1631,14 @@ function question4Checkbox3_Callback(hObj, eventdata) function question4Checkbox4_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question4time); + taskinfo.question4time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question4result(4)=1; + taskinfo.question4checkedBox{recordLength+1} = 'B4Check'; else taskinfo.question4result(4)=0; + taskinfo.question4checkedBox{recordLength+1} = 'B4Uncheck'; end taskinfo.done2(7)=1; tdone2=sum(taskinfo.done2); @@ -1453,10 +1653,14 @@ function question4Checkbox4_Callback(hObj, eventdata) function question4Checkbox5_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question4time); + taskinfo.question4time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question4result(5)=1; + taskinfo.question4checkedBox{recordLength+1} = 'B5Check'; else taskinfo.question4result(5)=0; + taskinfo.question4checkedBox{recordLength+1} = 'B5Uncheck'; end taskinfo.done2(7)=1; tdone2=sum(taskinfo.done2); @@ -1488,6 +1692,9 @@ function questionConfidence4_Callback (hObj, eventdata) function question5Comment_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question5time); + taskinfo.question5time{recordLength+1} = datestr(clock,30); + taskinfo.question5checkedBox{recordLength+1} = 'Edit'; % Pack the results taskinfo.question5result = get(handles.question5Comment, 'String'); taskinfo.done2(9)=1; diff --git a/src/tasks/task_tracking4_GIST.m b/src/tasks/task_tracking4_GIST.m index c1321f72..4a96db13 100644 --- a/src/tasks/task_tracking4_GIST.m +++ b/src/tasks/task_tracking4_GIST.m @@ -71,7 +71,16 @@ function task_tracking4_GIST( hObj ) handles = guidata(hObj); taskinfo.done2=zeros(1,12); taskinfo.done3=zeros(1,3); - handles.nnnn=0; + taskinfo.question1time = {}; + taskinfo.question1checkedBox = {}; + taskinfo.question2time = {}; + taskinfo.question2checkedBox = {}; + taskinfo.question3time = {}; + taskinfo.question3checkedBox = {}; + taskinfo.question4time = {}; + taskinfo.question4checkedBox = {}; + taskinfo.question5time = {}; + taskinfo.question5checkedBox = {}; %open pdf wsi_files = myData.wsi_files{taskinfo.slot}; wsi_files = handles.myData.wsi_files; @@ -958,9 +967,12 @@ function startTrackView_Callback(hObj, eventdata) % record stage position handles.recordStagePosition=[]; - handles.recordTime = []; - handles.recordStagePositionX = []; - handles.recordStagePositionY = []; + % handles.recordTime = []; +% handles.recordStagePositionX = []; +% handles.recordStagePositionY = []; + handles.recordTime = {}; + handles.recordStagePositionX = {}; + handles.recordStagePositionY = {}; guidata(hObj, handles); handles.stageTimer = timer('ExecutionMode','fixedrate','Period',2,... 'TimerFcn',{@executeStageTimer,handles.output}); @@ -998,8 +1010,130 @@ function stopTrackView_Callback(hObj, eventdata) systemTime= handles.recordTime; PositionX=handles.recordStagePositionX; PositionY=handles.recordStagePositionY; - stageTable = table(systemTime,PositionX,PositionY); + % insert questions answered time to csv file + question1List=repmat({'NA'},[length(PositionX),1]); + question1checkedBox = taskinfo.question1checkedBox; + question1time = taskinfo.question1time; + question2List=repmat({'NA'},[length(PositionX),1]); + question2checkedBox = taskinfo.question2checkedBox; + question2time = taskinfo.question2time; + question3List=repmat({'NA'},[length(PositionX),1]); + question3checkedBox = taskinfo.question3checkedBox; + question3time = taskinfo.question3time; + question4List=repmat({'NA'},[length(PositionX),1]); + question4checkedBox = taskinfo.question4checkedBox; + question4time = taskinfo.question4time; + question5List=repmat({'NA'},[length(PositionX),1]); + question5checkedBox = taskinfo.question5checkedBox; + question5time = taskinfo.question5time; + for i = 1 : length(systemTime) + tempSystemTime = systemTime{i}; + %question 1 + if length(question1time)>=1 + tempQuestion1time = question1time{1}; + while datetime(tempQuestion1time)<=datetime(tempSystemTime) + if strcmp(question1List{i},'NA') + question1List{i} = question1checkedBox{1}; + else + question1List{i} = [question1List{i},';',question1checkedBox{1}]; + end + question1time(1) = []; + question1checkedBox(1) = []; + if length(question1time)>=1 + tempQuestion1time = question1time{1}; + else + break; + end + end + end + %question 2 + if length(question2time)>=1 + tempQuestion2time = question2time{1}; + while datetime(tempQuestion2time)<=datetime(tempSystemTime) + if strcmp(question2List{i},'NA') + question2List{i} = question2checkedBox{1}; + else + question2List{i} = [question2List{i},';',question2checkedBox{1}]; + end + question2time(1) = []; + question2checkedBox(1) = []; + if length(question2time)>=1 + tempQuestion2time = question2time{1}; + else + break; + end + end + end + %question 3 + if length(question3time)>=1 + tempQuestion3time = question3time{1}; + while datetime(tempQuestion3time)<=datetime(tempSystemTime) + if strcmp(question3List{i},'NA') + question3List{i} = question3checkedBox{1}; + else + question3List{i} = [question3List{i},';',question3checkedBox{1}]; + end + question3time(1) = []; + question3checkedBox(1) = []; + if length(question3time)>=1 + tempQuestion3time = question3time{1}; + else + break; + end + end + end + %question 4 + if length(question4time)>=1 + tempQuestion4time = question4time{1}; + while datetime(tempQuestion4time)<=datetime(tempSystemTime) + if strcmp(question4List{i},'NA') + question4List{i} = question4checkedBox{1}; + else + question4List{i} = [question4List{i},';',question4checkedBox{1}]; + end + question4time(1) = []; + question4checkedBox(1) = []; + if length(question4time)>=1 + tempQuestion4time = question4time{1}; + else + break; + end + end + end + %question 5 + if length(question5time)>=1 + tempQuestion5time = question5time{1}; + while datetime(tempQuestion5time)<=datetime(tempSystemTime) + if strcmp(question5List{i},'NA') + question5List{i} = question5checkedBox{1}; + else + question5List{i} = [question5List{i},';',question5checkedBox{1}]; + end + question5time(1) = []; + question5checkedBox(1) = []; + if length(question5time)>=1 + tempQuestion5time = question5time{1}; + else + break; + end + end + end + end + systemTime = systemTime'; + PositionX = PositionX'; + PositionY = PositionY'; + stageTable = table(systemTime,PositionX,PositionY,question1List,question2List,question3List,question4List,question5List); writetable(stageTable,stageFileName); + t1 = table(taskinfo.question1time',taskinfo.question1checkedBox'); + writetable(t1,'q1.csv'); + t2 = table(taskinfo.question2time',taskinfo.question2checkedBox'); + writetable(t2,'q2.csv'); + t3 = table(taskinfo.question3time',taskinfo.question3checkedBox'); + writetable(t3,'q3.csv'); + t4 = table(taskinfo.question4time',taskinfo.question4checkedBox'); + writetable(t4,'q4.csv'); + t5 = table(taskinfo.question5time',taskinfo.question5checkedBox'); + writetable(t5,'q5.csv'); % audio audioExist = audiodevinfo; if (size(audioExist.input,1)>0) @@ -1044,9 +1178,14 @@ function executeStageTimer(hObject, eventdata, hFigure) % time1=clock; handles = guidata(hFigure); handles.myData.stage = stage_get_pos(handles.myData.stage); - handles.recordTime = [handles.recordTime;datestr(clock,30)]; - handles.recordStagePositionX = [handles.recordStagePositionX; handles.myData.stage.Pos(1)]; - handles.recordStagePositionY = [handles.recordStagePositionY; handles.myData.stage.Pos(2)]; +% handles.recordTime = [handles.recordTime;datestr(clock,30)]; +% handles.recordStagePositionX = [handles.recordStagePositionX; handles.myData.stage.Pos(1)]; +% handles.recordStagePositionY = [handles.recordStagePositionY; handles.myData.stage.Pos(2)]; + + recordLength = length(handles.recordTime); + handles.recordTime{recordLength+1} = datestr(clock,30); + handles.recordStagePositionX{recordLength+1} = handles.myData.stage.Pos(1); + handles.recordStagePositionY{recordLength+1} = handles.myData.stage.Pos(2); %disp(currentTimeInfo); % time2=clock; % etime(time1,time2) @@ -1058,10 +1197,14 @@ function executeStageTimer(hObject, eventdata, hFigure) function question1Checkbox1_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(1)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B1Check'; else taskinfo.question1result(1)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B1Uncheck'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1076,10 +1219,14 @@ function question1Checkbox1_Callback(hObj, eventdata) function question1Checkbox2_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(2)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B2Check'; else taskinfo.question1result(2)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B2Uncheck'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1094,10 +1241,14 @@ function question1Checkbox2_Callback(hObj, eventdata) function question1Checkbox3_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(3)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B3Check'; else taskinfo.question1result(3)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B3Uncheck'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1112,10 +1263,14 @@ function question1Checkbox3_Callback(hObj, eventdata) function question1Checkbox4_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(4)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B4Check'; else taskinfo.question1result(4)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B4Uncheck'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1147,10 +1302,14 @@ function questionConfidence1_Callback (hObj, eventdata) function question2Checkbox1_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(1)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B1Check'; else taskinfo.question2result(1)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B1Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1165,10 +1324,14 @@ function question2Checkbox1_Callback(hObj, eventdata) function question2Checkbox2_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(2)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B2Check'; else taskinfo.question2result(2)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B2Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1183,10 +1346,14 @@ function question2Checkbox2_Callback(hObj, eventdata) function question2Checkbox3_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(3)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B3Check'; else taskinfo.question2result(3)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B3Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1201,10 +1368,14 @@ function question2Checkbox3_Callback(hObj, eventdata) function question2Checkbox4_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(4)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B4Check'; else taskinfo.question2result(4)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B4Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1235,6 +1406,9 @@ function questionConfidence2_Callback (hObj, eventdata) function question3Comment_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); + taskinfo.question3checkedBox{recordLength+1} = 'Edit'; % Pack the results taskinfo.question3result = get(handles.question3Comment, 'String'); taskinfo.done2(5)=1; @@ -1267,13 +1441,16 @@ function questionConfidence3_Callback (hObj, eventdata) function question4Radiobutton_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; - + recordLength = length(taskinfo.question4time); + taskinfo.question4time{recordLength+1} = datestr(clock,30); taskinfo.button_desc = get(eventdata.NewValue, 'Tag'); switch taskinfo.button_desc case 'question4Radiobutton1' taskinfo.question4result = 'Yes'; + taskinfo.question4checkedBox{recordLength+1} = 'Yes'; case 'question4Radiobutton0' - taskinfo.question4result = 'No' + taskinfo.question4result = 'No'; + taskinfo.question4checkedBox{recordLength+1} = 'No'; end taskinfo.done2(7)=1; tdone2=sum(taskinfo.done2); @@ -1305,10 +1482,14 @@ function questionConfidence4_Callback (hObj, eventdata) function question5Checkbox1_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question5time); + taskinfo.question5time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question5result(1)=1; + taskinfo.question5checkedBox{recordLength+1} = 'B1Check'; else taskinfo.question5result(1)=0; + taskinfo.question5checkedBox{recordLength+1} = 'B1Uncheck'; end taskinfo.done2(9)=1; tdone2=sum(taskinfo.done2); @@ -1323,10 +1504,14 @@ function question5Checkbox1_Callback(hObj, eventdata) function question5Checkbox2_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question5time); + taskinfo.question5time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question5result(2)=1; + taskinfo.question5checkedBox{recordLength+1} = 'B2Check'; else taskinfo.question5result(2)=0; + taskinfo.question5checkedBox{recordLength+1} = 'B2Uncheck'; end taskinfo.done2(9)=1; tdone2=sum(taskinfo.done2); @@ -1341,10 +1526,14 @@ function question5Checkbox2_Callback(hObj, eventdata) function question5Checkbox3_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question5time); + taskinfo.question5time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question5result(3)=1; + taskinfo.question5checkedBox{recordLength+1} = 'B3Check'; else taskinfo.question5result(3)=0; + taskinfo.question5checkedBox{recordLength+1} = 'B3Uncheck'; end taskinfo.done2(9)=1; tdone2=sum(taskinfo.done2); diff --git a/src/tasks/task_tracking5_IHCproliferationIndices.m b/src/tasks/task_tracking5_IHCproliferationIndices.m index 1baaf039..1b77edce 100644 --- a/src/tasks/task_tracking5_IHCproliferationIndices.m +++ b/src/tasks/task_tracking5_IHCproliferationIndices.m @@ -70,7 +70,16 @@ function task_tracking5_IHCproliferationIndices( hObj ) handles = guidata(hObj); taskinfo.done2=zeros(1,12); taskinfo.done3=zeros(1,3); - handles.nnnn=0; + taskinfo.question1time = {}; + taskinfo.question1checkedBox = {}; + taskinfo.question2time = {}; + taskinfo.question2checkedBox = {}; + taskinfo.question3time = {}; + taskinfo.question3checkedBox = {}; + taskinfo.question4time = {}; + taskinfo.question4checkedBox = {}; + taskinfo.question5time = {}; + taskinfo.question5checkedBox = {}; %open pdf wsi_files = myData.wsi_files{taskinfo.slot}; wsi_files = handles.myData.wsi_files; @@ -948,9 +957,12 @@ function startTrackView_Callback(hObj, eventdata) % record stage position handles.recordStagePosition=[]; - handles.recordTime = []; - handles.recordStagePositionX = []; - handles.recordStagePositionY = []; + % handles.recordTime = []; +% handles.recordStagePositionX = []; +% handles.recordStagePositionY = []; + handles.recordTime = {}; + handles.recordStagePositionX = {}; + handles.recordStagePositionY = {}; guidata(hObj, handles); handles.stageTimer = timer('ExecutionMode','fixedrate','Period',2,... 'TimerFcn',{@executeStageTimer,handles.output}); @@ -988,8 +1000,130 @@ function stopTrackView_Callback(hObj, eventdata) systemTime= handles.recordTime; PositionX=handles.recordStagePositionX; PositionY=handles.recordStagePositionY; - stageTable = table(systemTime,PositionX,PositionY); + % insert questions answered time to csv file + question1List=repmat({'NA'},[length(PositionX),1]); + question1checkedBox = taskinfo.question1checkedBox; + question1time = taskinfo.question1time; + question2List=repmat({'NA'},[length(PositionX),1]); + question2checkedBox = taskinfo.question2checkedBox; + question2time = taskinfo.question2time; + question3List=repmat({'NA'},[length(PositionX),1]); + question3checkedBox = taskinfo.question3checkedBox; + question3time = taskinfo.question3time; + question4List=repmat({'NA'},[length(PositionX),1]); + question4checkedBox = taskinfo.question4checkedBox; + question4time = taskinfo.question4time; + question5List=repmat({'NA'},[length(PositionX),1]); + question5checkedBox = taskinfo.question5checkedBox; + question5time = taskinfo.question5time; + for i = 1 : length(systemTime) + tempSystemTime = systemTime{i}; + %question 1 + if length(question1time)>=1 + tempQuestion1time = question1time{1}; + while datetime(tempQuestion1time)<=datetime(tempSystemTime) + if strcmp(question1List{i},'NA') + question1List{i} = question1checkedBox{1}; + else + question1List{i} = [question1List{i},';',question1checkedBox{1}]; + end + question1time(1) = []; + question1checkedBox(1) = []; + if length(question1time)>=1 + tempQuestion1time = question1time{1}; + else + break; + end + end + end + %question 2 + if length(question2time)>=1 + tempQuestion2time = question2time{1}; + while datetime(tempQuestion2time)<=datetime(tempSystemTime) + if strcmp(question2List{i},'NA') + question2List{i} = question2checkedBox{1}; + else + question2List{i} = [question2List{i},';',question2checkedBox{1}]; + end + question2time(1) = []; + question2checkedBox(1) = []; + if length(question2time)>=1 + tempQuestion2time = question2time{1}; + else + break; + end + end + end + %question 3 + if length(question3time)>=1 + tempQuestion3time = question3time{1}; + while datetime(tempQuestion3time)<=datetime(tempSystemTime) + if strcmp(question3List{i},'NA') + question3List{i} = question3checkedBox{1}; + else + question3List{i} = [question3List{i},';',question3checkedBox{1}]; + end + question3time(1) = []; + question3checkedBox(1) = []; + if length(question3time)>=1 + tempQuestion3time = question3time{1}; + else + break; + end + end + end + %question 4 + if length(question4time)>=1 + tempQuestion4time = question4time{1}; + while datetime(tempQuestion4time)<=datetime(tempSystemTime) + if strcmp(question4List{i},'NA') + question4List{i} = question4checkedBox{1}; + else + question4List{i} = [question4List{i},';',question4checkedBox{1}]; + end + question4time(1) = []; + question4checkedBox(1) = []; + if length(question4time)>=1 + tempQuestion4time = question4time{1}; + else + break; + end + end + end + %question 5 + if length(question5time)>=1 + tempQuestion5time = question5time{1}; + while datetime(tempQuestion5time)<=datetime(tempSystemTime) + if strcmp(question5List{i},'NA') + question5List{i} = question5checkedBox{1}; + else + question5List{i} = [question5List{i},';',question5checkedBox{1}]; + end + question5time(1) = []; + question5checkedBox(1) = []; + if length(question5time)>=1 + tempQuestion5time = question5time{1}; + else + break; + end + end + end + end + systemTime = systemTime'; + PositionX = PositionX'; + PositionY = PositionY'; + stageTable = table(systemTime,PositionX,PositionY,question1List,question2List,question3List,question4List,question5List); writetable(stageTable,stageFileName); + t1 = table(taskinfo.question1time',taskinfo.question1checkedBox'); + writetable(t1,'q1.csv'); + t2 = table(taskinfo.question2time',taskinfo.question2checkedBox'); + writetable(t2,'q2.csv'); + t3 = table(taskinfo.question3time',taskinfo.question3checkedBox'); + writetable(t3,'q3.csv'); + t4 = table(taskinfo.question4time',taskinfo.question4checkedBox'); + writetable(t4,'q4.csv'); + t5 = table(taskinfo.question5time',taskinfo.question5checkedBox'); + writetable(t5,'q5.csv'); % audio audioExist = audiodevinfo; if (size(audioExist.input,1)>0) @@ -1034,9 +1168,14 @@ function executeStageTimer(hObject, eventdata, hFigure) % time1=clock; handles = guidata(hFigure); handles.myData.stage = stage_get_pos(handles.myData.stage); - handles.recordTime = [handles.recordTime;datestr(clock,30)]; - handles.recordStagePositionX = [handles.recordStagePositionX; handles.myData.stage.Pos(1)]; - handles.recordStagePositionY = [handles.recordStagePositionY; handles.myData.stage.Pos(2)]; + % handles.recordTime = [handles.recordTime;datestr(clock,30)]; +% handles.recordStagePositionX = [handles.recordStagePositionX; handles.myData.stage.Pos(1)]; +% handles.recordStagePositionY = [handles.recordStagePositionY; handles.myData.stage.Pos(2)]; + + recordLength = length(handles.recordTime); + handles.recordTime{recordLength+1} = datestr(clock,30); + handles.recordStagePositionX{recordLength+1} = handles.myData.stage.Pos(1); + handles.recordStagePositionY{recordLength+1} = handles.myData.stage.Pos(2); %disp(currentTimeInfo); % time2=clock; % etime(time1,time2) @@ -1048,10 +1187,14 @@ function executeStageTimer(hObject, eventdata, hFigure) function question1Checkbox1_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(1)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B1Check'; else taskinfo.question1result(1)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B1Uncheck'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1066,10 +1209,14 @@ function question1Checkbox1_Callback(hObj, eventdata) function question1Checkbox2_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(2)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B2Check'; else taskinfo.question1result(2)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B2Uncheck'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1084,10 +1231,14 @@ function question1Checkbox2_Callback(hObj, eventdata) function question1Checkbox3_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(3)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B3Check'; else taskinfo.question1result(3)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B3Uncheck'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1102,10 +1253,14 @@ function question1Checkbox3_Callback(hObj, eventdata) function question1Checkbox4_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question1time); + taskinfo.question1time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question1result(4)=1; + taskinfo.question1checkedBox{recordLength+1} = 'B4Check'; else taskinfo.question1result(4)=0; + taskinfo.question1checkedBox{recordLength+1} = 'B4Uncheck'; end taskinfo.done2(1)=1; tdone2=sum(taskinfo.done2); @@ -1137,10 +1292,14 @@ function questionConfidence1_Callback (hObj, eventdata) function question2Checkbox1_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(1)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B1Check'; else taskinfo.question2result(1)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B1Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1155,10 +1314,14 @@ function question2Checkbox1_Callback(hObj, eventdata) function question2Checkbox2_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(2)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B2Check'; else taskinfo.question2result(2)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B2Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1173,10 +1336,14 @@ function question2Checkbox2_Callback(hObj, eventdata) function question2Checkbox3_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(3)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B3Check'; else taskinfo.question2result(3)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B3Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1191,10 +1358,14 @@ function question2Checkbox3_Callback(hObj, eventdata) function question2Checkbox4_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question2time); + taskinfo.question2time{recordLength+1} = datestr(clock,30); if (get(hObj,'Value') == get(hObj,'Max')) taskinfo.question2result(4)=1; + taskinfo.question2checkedBox{recordLength+1} = 'B4Check'; else taskinfo.question2result(4)=0; + taskinfo.question2checkedBox{recordLength+1} = 'B4Uncheck'; end taskinfo.done2(3)=1; tdone2=sum(taskinfo.done2); @@ -1225,6 +1396,9 @@ function questionConfidence2_Callback (hObj, eventdata) function question3Comment_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; + recordLength = length(taskinfo.question3time); + taskinfo.question3time{recordLength+1} = datestr(clock,30); + taskinfo.question3checkedBox{recordLength+1} = 'Edit'; % Pack the results taskinfo.question3result = get(handles.question3Comment, 'String'); taskinfo.done2(5)=1; @@ -1257,13 +1431,16 @@ function questionConfidence3_Callback (hObj, eventdata) function question4Radiobutton_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; - + recordLength = length(taskinfo.question4time); + taskinfo.question4time{recordLength+1} = datestr(clock,30); taskinfo.button_desc = get(eventdata.NewValue, 'Tag'); switch taskinfo.button_desc case 'question4Radiobutton1' taskinfo.question4result = 'Yes'; + taskinfo.question4checkedBox{recordLength+1} = 'Yes'; case 'question4Radiobutton2' taskinfo.question4result = 'No'; + taskinfo.question4checkedBox{recordLength+1} = 'No'; end taskinfo.done2(7)=1; tdone2=sum(taskinfo.done2); @@ -1295,13 +1472,16 @@ function questionConfidence4_Callback (hObj, eventdata) function question5Radiobutton_Callback(hObj, eventdata) handles = guidata(findobj('Tag','GUI')); taskinfo = handles.myData.tasks_out{handles.myData.iter}; - + recordLength = length(taskinfo.question5time); + taskinfo.question5time{recordLength+1} = datestr(clock,30); taskinfo.button_desc = get(eventdata.NewValue, 'Tag'); switch taskinfo.button_desc case 'question5Radiobutton1' taskinfo.question5result = 'Low'; + taskinfo.question5checkedBox{recordLength+1} = 'Low'; case 'question5Radiobutton2' taskinfo.question5result = 'High'; + taskinfo.question5checkedBox{recordLength+1} = 'High'; end taskinfo.done2(9)=1; tdone2=sum(taskinfo.done2);