diff --git a/Toolbox software/findArtifacts.m b/Toolbox software/findArtifacts.m index 50b0f75..3fae689 100644 --- a/Toolbox software/findArtifacts.m +++ b/Toolbox software/findArtifacts.m @@ -230,124 +230,125 @@ function findArtifacts() DIS_MIN_GR=5; clear group_mov ind_group_mov group_mov=1; -ind_group_mov{group_mov}=ind_movements(1); -for i=2:length(ind_movements) - if ind_movements(i)-ind_movements(i-1)>','CallBack',{@dir_foward_function},'Units','normalized','Position',[x y width height]); - x=posIm(1)+posIm(3)+.01; y=y+height+0.01; - uicontrol('Style','pushbutton','String','Yes','CallBack',{@mov_ok_function},'Units','normalized','Position',[x y width height]); - x=x+width+0.01; - uicontrol('Style','pushbutton','String','No','CallBack',{@mov_no_ok_function},'Units','normalized','Position',[x y width height]); - - - if ind_group_mov{quan_mov}(1)>windows_frame - START=ind_group_mov{quan_mov}(1)-windows_frame; - else - START=1; - end - if ind_group_mov{quan_mov}(end)+windows_frame>','CallBack',{@dir_foward_function},'Units','normalized','Position',[x y width height]); + x=posIm(1)+posIm(3)+.01; y=y+height+0.01; + uicontrol('Style','pushbutton','String','Yes','CallBack',{@mov_ok_function},'Units','normalized','Position',[x y width height]); + x=x+width+0.01; + uicontrol('Style','pushbutton','String','No','CallBack',{@mov_no_ok_function},'Units','normalized','Position',[x y width height]); + + + if ind_group_mov{quan_mov}(1)>windows_frame + START=ind_group_mov{quan_mov}(1)-windows_frame; + else + START=1; end - for j=1:length(ind_group_mov{quan_mov}) - mov_ok=[]; - FRA_TO_SHOW=ind_group_mov{quan_mov}(j)-START+1; - dir=0; + if ind_group_mov{quan_mov}(end)+windows_frame 1) | (dir==1 & FRA_TO_SHOW < size(video,1)) - FRA_TO_SHOW=FRA_TO_SHOW+dir; + while isempty(mov_ok) + if allIn + break + end + if (dir==-1 & FRA_TO_SHOW > 1) | (dir==1 & FRA_TO_SHOW < size(video,1)) + FRA_TO_SHOW=FRA_TO_SHOW+dir; + end + + dir=0; + subplot(1,2,1) + imagesc(squeeze(video(FRA_TO_SHOW,:,:))) + set(gca,'xticklabel','','ytickLabel','') + axis image + colormap(gray) + caxis([min_video max_video*1.2]) + if ismember(START-1+FRA_TO_SHOW, ind_group_mov{quan_mov}) + col_frame='r'; + else + col_frame='k'; + end + title(['Frame number ' num2str(START-1+FRA_TO_SHOW)],'color',col_frame) + + uicontrol('Style','text','Units','normalized','position',[xTxt yTxt width height],... + 'String',{'Does frame ' num2str(ind_group_mov{quan_mov}(j)) ' contain an artifact?'}) + + uicontrol('Style','text','Units','normalized','position',[xTxt yTxt2 width height],... + 'String',{['Checking frame ' num2str(j) ' (out of ' num2str(length(ind_group_mov{quan_mov})) ')'] ... + ['from event ' num2str(quan_mov) ' (out of ' num2str(group_mov) ')']}) + + + drawnow + clean_mov{quan_mov}=[clean_mov{quan_mov} mov_ok]; end - - dir=0; - subplot(1,2,1) - imagesc(squeeze(video(FRA_TO_SHOW,:,:))) - set(gca,'xticklabel','','ytickLabel','') - axis image - colormap(gray) - caxis([min_video max_video*1.2]) - if ismember(START-1+FRA_TO_SHOW, ind_group_mov{quan_mov}) - col_frame='r'; - else - col_frame='k'; - end - title(['Frame number ' num2str(START-1+FRA_TO_SHOW)],'color',col_frame) - - uicontrol('Style','text','Units','normalized','position',[xTxt yTxt width height],... - 'String',{'Does frame ' num2str(ind_group_mov{quan_mov}(j)) ' contain an artifact?'}) - - uicontrol('Style','text','Units','normalized','position',[xTxt yTxt2 width height],... - 'String',{['Checking frame ' num2str(j) ' (out of ' num2str(length(ind_group_mov{quan_mov})) ')'] ... - ['from event ' num2str(quan_mov) ' (out of ' num2str(group_mov) ')']}) - - - drawnow - clean_mov{quan_mov}=[clean_mov{quan_mov} mov_ok]; end end end -end -close(hf) - -if allIn - movements=ones(numFrames,1); -else - movements_original=movements; - for quan_mov=1:group_mov - movements(ind_group_mov{quan_mov})=clean_mov{quan_mov}; + close(hf) + + if allIn + movements=ones(numFrames,1); + else + movements_original=movements; + for quan_mov=1:group_mov + movements(ind_group_mov{quan_mov})=clean_mov{quan_mov}; + end end end - inputTitle = char('Inform any other artifact'); prompt = {['Are there any other frames that you want to label as artifacts? If so, which ones? (numbers separeted by spaces):']}; answer = inputdlg(prompt, inputTitle, 1);