Skip to content
Snippets Groups Projects
Commit 59dd058e authored by Christophe Bradley Smith's avatar Christophe Bradley Smith
Browse files

Fixed sub label addition (typo in assignment and ability to check for new labels)

parent 16aaac48
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
% Prepare work space
clc
checkVersion()
% checkVersion()
% Check for miscelaneous transcriptions in the work space
miscLS = who('-regexp', '^ls(([0-9]*$)|($))');
......@@ -109,6 +109,16 @@ function lss = TransferLabels(ls, lss)
% Clear lss labels
resetLabelValues(lss)
% Update lss labels to match ls
subLabelList = split(strtrim(extract(labelDefinitionsHierarchy(lss), regexpPattern('(?<=Sublabels:).*'))));
lsSubLabelList = split(strtrim(extract(labelDefinitionsHierarchy(ls), regexpPattern('(?<=Sublabels:).*'))));
isNewLabel = ~contains(lsSubLabelList, subLabelList);
if any(isNewLabel)
curLabelDef = getLabelDefinitions(ls);
addLabelDefinitions(lss, curLabelDef.Sublabels(isNewLabel), curLabelDef.Name)
end
% Move ls labels to lss
nTrials = height(ls.Labels);
for iTrial = 1:nTrials
......@@ -122,10 +132,22 @@ for iTrial = 1:nTrials
setLabelValue(lss, iTrial, 'Words', curROI, curVal)
% Set sublabel Values
subLabelList = split(strtrim(extract(labelDefinitionsHierarchy(lss), regexpPattern('(?<=Sublabels:).*'))));
for curLabel = subLabelList'
setLabelValue(lss, iTrial, ["Words", string(curLabel)], ls.Labels.Words{1}.Sublabels.(curLabel{1}), 'LabelRowIndex', 1)
curSpans = ls.Labels.Words{iTrial};
nSpans = height(curSpans);
for iSpan = 1:nSpans
for curLabel = lsSubLabelList'
labelValues = ls.Labels.Words{iTrial}.Sublabels.(curLabel{1});
if isa(labelValues, 'cell')
labelValue = labelValues{iSpan};
else
labelValue = labelValues(iSpan);
end
setLabelValue(lss, iTrial, ["Words", string(curLabel)], labelValue, "LabelRowIndex", iSpan)
end
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment