Skip to content

Commit

Permalink
fine tune for mocap digitization
Browse files Browse the repository at this point in the history
  • Loading branch information
neuromechanist committed Mar 9, 2020
1 parent c94b0b4 commit fa63d97
Show file tree
Hide file tree
Showing 4 changed files with 647 additions and 9 deletions.
6 changes: 3 additions & 3 deletions code/importMocapTakeElocs.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@
% find first non-NAN for the recording the the eloctrode location.
% Instant the marker for that electrode location was created
fNN(i) = find(~isnan(UP(:,i*3)),1,'first');
f1{i,1:3} = nanmean(face{1}(fNN(i)-win:fNN(i),:)) ;
f2{i,1:3} = nanmean(face{2}(fNN(i)-win:fNN(i),:)) ;
f3{i,1:3} = nanmean(face{3}(fNN(i)-win:fNN(i),:)) ;
f1{i,1:3} = nanmean(face{1}(fNN(i):fNN(i)+win,:)) ;
f2{i,1:3} = nanmean(face{2}(fNN(i):fNN(i)+win,:)) ;
f3{i,1:3} = nanmean(face{3}(fNN(i):fNN(i)+win,:)) ;
e{i,1:3} = UP(fNN(i),i*3-2:i*3);
end
f1.Properties.VariableNames = {'X','Y','Z'};
Expand Down
10 changes: 5 additions & 5 deletions mocapDigitization.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,23 @@

gTD = 0; % going to detail, plots additional figures during the process
win = 50; % sampling window of probe, a parameter set in Motive, to average over to get face marker positions.
ne = 35; % number of electrodes in a strip
ne = 36; % number of electrodes in a strip
addpath(genpath(['code' filesep]));
addpath(genpath(['dependencies' filesep]));
fs = filesep;
fPath = pwd; % function path

%% parse out the inputs
opts = arg_define(varargin, ...
arg({'repoPath','RepoPath','repository_path'},[fPath fs 'sample' fs 'probe' fs] ,[],'The repository containing folders w/ subject name.'), ...
arg({'subj','Subject','subject'}, 'H2',[],'Default smaple is the Structure sensor.'), ...
arg({'repoPath','RepoPath','repository_path'},[fPath fs 'sample' fs 'mocap' fs] ,[],'The repository containing folders w/ subject name.'), ...
arg({'subj','Subject','subject'}, 'M1',[],'Default smaple is the Structure sensor.'), ...
arg({'savePath','SavePath','save_path'}, [],[],'The path for the electrode locations output'), ...
arg({'saveFlag','save_flag','SaveFlag'}, 0,[0 1],'Save flag, change it to one if you need the eloc files'));

p2l.repo = string(opts.repoPath);
subj = string(opts.subj);
p2l.mocap = p2l.repo + subj + string(fs);
if isempty(opts.savePath), opts.savePath = p2l.scan; end
if isempty(opts.savePath), opts.savePath = p2l.mocap; end
p2l.save = string(opts.savePath);
saveF = opts.saveFlag;

Expand Down Expand Up @@ -99,7 +99,7 @@
% we need to use the face markers as the new local cooridnates:

% first find which face marker is which
[ieloc.lM, ieloc.fH, ieloc.rM] = sortFaceMarkers(ieloc.f1,ieloc.f2,ieloc.f3,0,gTD);
[ieloc.lM, ieloc.fH, ieloc.rM] = sortFaceMarkers(ieloc.f1,ieloc.f2,ieloc.f3,1,gTD);
% then let's convert global coord. to local:
for i = 1:size(ieloc,1)
[~,lE(i,:)] = updateOrigin([ieloc.lM{i,:};ieloc.fH{i,:};ieloc.rM{i,:}],ieloc.e{i,:});
Expand Down
2 changes: 1 addition & 1 deletion mocapProbeDigitization.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
p2l.repo = string(opts.repoPath);
subj = string(opts.subj);
p2l.probe = p2l.repo + subj + string(fs);
if isempty(opts.savePath), opts.savePath = p2l.scan; end
if isempty(opts.savePath), opts.savePath = p2l.probe; end
p2l.save = string(opts.savePath);
saveF = opts.saveFlag;

Expand Down
Loading

0 comments on commit fa63d97

Please sign in to comment.