From e30032b49509cbd080a41985ed3a5ef78c29e32b Mon Sep 17 00:00:00 2001 From: cbsmith2 <cbsmith2@uab.edu> Date: Tue, 11 Mar 2025 09:42:39 -0500 Subject: [PATCH] Changed default file name in save ui, Fixed issue for transfering empty labels, Fixed equality check to use only ROI, removed ls as a default option --- README.md | 4 +++- SaveTranscriptions.m | 23 +++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6523545..cf0ae6c 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,6 @@ SaveTranscription is a script that manages saving transcription files to make it ## Usage -Run the code in MATLAB and follow any prompts you may see. For ease of use adhere the to the convention that the file you load into the Command Window is the lss file and the file exported from the app is the ls file. \ No newline at end of file +Run the code in MATLAB and follow any prompts you may see. For ease of use adhere the to the convention that the file you load into the Command Window is the lss file and the file exported from the app is the ls file. + +Add explanation of variables \ No newline at end of file diff --git a/SaveTranscriptions.m b/SaveTranscriptions.m index 8ab8108..0e1d4e2 100644 --- a/SaveTranscriptions.m +++ b/SaveTranscriptions.m @@ -3,7 +3,7 @@ clc % Check for miscelaneous transcriptions in the work space -miscLS = who('-regexp', '^ls.*[0-9]'); +miscLS = who('-regexp', '^ls(([0-9]$)|($))'); newLS = CheckmiscLS(miscLS); if ~isempty(newLS); ls = eval(newLS); end @@ -21,7 +21,9 @@ lss = TransferLabels(ls, lss); reviewerInit = input('Please enter your initials: ', 's'); % Save latest transcription and progress -uisave({'lss', 'remainingFiles'}, ['lss_' reviewerInit '.mat']) +uisave({'lss', 'remainingFiles', 'reviewerInit'}, '*.mat') +% ['lss_' reviewerInit '.mat'] + %% Functions function ls = CheckmiscLS(miscLS) @@ -31,9 +33,9 @@ if isempty(miscLS); return; end fprintf(2, 'Warning: multiple potential ''ls'' files were found in the work space. \n\n') nLS = length(miscLS); -lsNames = string(['ls'; miscLS]); +lsNames = string(miscLS); formatPat = '\t%i. %s\n'; -formattedstring = compose(formatPat, (0:nLS)', lsNames); +formattedstring = compose(formatPat, (1:nLS)', lsNames); listSet = join(formattedstring' , ''); validResp = 0:nLS; @@ -43,14 +45,14 @@ while true userResp = input('Resp:'); if any(ismember(validResp, userResp)) - fprintf('%s has been selected.', lsNames(userResp + 1)) + fprintf('%s has been selected.', lsNames(userResp)) break else fprintf('%i is an invalid response.', userResp) end end -ls = lsNames(userResp + 1); +ls = lsNames(userResp); end @@ -78,7 +80,7 @@ function remainingFiles = FindRemainingFiles(ls, lss, remainingFiles) nFiles = lss.NumMembers; isUntouched = false(nFiles, 1); for i = 1:nFiles - isUntouched(i) = isequal(ls.Labels.Words{i}, lss.Labels.Words{i}); + isUntouched(i) = isequal(ls.Labels.Words{i}.ROILimits, lss.Labels.Words{i}.ROILimits); end % Account for previosuly edited files @@ -103,7 +105,12 @@ resetLabelValues(lss) % Move ls labels to lss nTrials = height(ls.Labels); for iTrial = 1:nTrials - setLabelValue(lss, iTrial, 'Words', ls.Labels.Words{iTrial}.ROILimits, ls.Labels.Words{iTrial}.Value) + curROI = ls.Labels.Words{iTrial}.ROILimits; + curVal = ls.Labels.Words{iTrial}.Value; + if isempty(curROI) + continue + end + setLabelValue(lss, iTrial, 'Words', curROI, curVal) end end -- GitLab