Skip to content

Commit

Permalink
the ability to skip strip analysis and do re-referencing directly aft…
Browse files Browse the repository at this point in the history
…er fine-ref
  • Loading branch information
mnagaoglu committed Nov 22, 2018
1 parent 533789c commit f469aaf
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions util/gui_utils/ExecuteModules.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ function ExecuteModules(inputPath, handles)
RevasMessage(['[[ Making Fine Reference Frame ]] ' inputPath], parametersStructure);
% Set the parameters
parametersStructure.enableVerbosity = handles.config.fineVerbosity;
parametersStructure.overwrite = handles.config.fineOverwrite;
parametersStructure.numberOfIterations = handles.config.fineNumIterations;
parametersStructure.stripHeight = handles.config.fineStripHeight;
parametersStructure.stripWidth = handles.config.fineStripWidth;
Expand All @@ -166,7 +167,11 @@ function ExecuteModules(inputPath, handles)
parametersStructure.axesHandles = [handles.axes1 handles.axes2 handles.axes3];

% Call the function
fineRefFrame = FineRef(coarseRefFrame, inputPath, parametersStructure);
[fineRefFrame, fineRefEyePositions, fineRefTimeArray] = ...
FineRef(coarseRefFrame, inputPath, parametersStructure); %#ok<*ASGLU>
eyePositionTraces = fineRefEyePositions;
timeArray = fineRefTimeArray;
save([inputPath(1:end-4) '_refframe.mat'],'eyePositionTraces','timeArray','-append');
end

%% Strip Analysis Module
Expand Down Expand Up @@ -289,11 +294,13 @@ function ExecuteModules(inputPath, handles)
end

%% Re-referencing Module
RevasMessage(['[[ Re-referencing ]] ' inputPath], parametersStructure);

if logical(handles.config.togValues('reref')) && strcmp(handles.config.rerefGlobalFullPath, '')
RevasMessage(['[[ Re-referencing ]] ' inputPath], parametersStructure);
RevasMessage('No valid global reference frame provided, skipping Re-Referencing', parametersStructure);

elseif logical(handles.config.togValues('reref')) && ~logical(abortTriggered)
RevasMessage(['[[ Re-referencing ]] ' inputPath], parametersStructure);

% Set the parameters
parametersStructure.verbosity = handles.config.rerefVerbosity;
parametersStructure.overwrite = handles.config.rerefOverwrite;
Expand All @@ -314,7 +321,7 @@ function ExecuteModules(inputPath, handles)
% Load a fine ref if we didn't run the previous module in this
% session.
if ~exist('fineRefFrame', 'var')
if ~isempty(strfind(originalInputVideoPath, '_dwt'))%JG replace ~isempty(strfind(
if ~isempty(strfind(originalInputVideoPath, '_dwt'))%JG replaced ~isempty(strfind(
rawVideoPath = originalInputVideoPath(1:strfind(originalInputVideoPath, '_dwt')-1);
elseif ~isempty(strfind(originalInputVideoPath, '_nostim'))
rawVideoPath = originalInputVideoPath(1:strfind(originalInputVideoPath, '_nostim')-1);
Expand Down Expand Up @@ -371,8 +378,16 @@ function ExecuteModules(inputPath, handles)
end
end


% if strip analysis is skipped, only fine ref is done, then use the eye
% position traces from refframe.mat file
if ~logical(handles.config.togValues('strip'))
inputPath = [inputPath(1:end-4) '_refframe.mat'];
end

% Call the function
[~,inputPath] = ReReference(inputPath, fineRefFrame, globalRefFrame, parametersStructure);
[~,inputPath] = ReReference(inputPath, fineRefFrame, globalRefFrame, ...
parametersStructure);

% Write output file as csv
load(inputPath, ...
Expand Down

0 comments on commit f469aaf

Please sign in to comment.