-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Group mode #34
base: main
Are you sure you want to change the base?
Group mode #34
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
function configParams = functional_pipeline(subjectDir, varargin) | ||
function configParams = functional_pipeline(subjectSelection, varargin) | ||
% FUNCTIONAL_PIPELINE Reconstruct structural connectivity. | ||
% | ||
% functional_pipeline(SUBJECTDIR) reconstructs functional connectivity of | ||
% a subjects T1 and rs-fMRI data in the SUBJECTDIR directory using default | ||
% parameters. | ||
% | ||
% functional_pipeline(SUBJECTLISTFILE) takes a file in which each line is | ||
% a subject directory, and calls functional_pipeline for each directory. | ||
% | ||
% functional_pipeline(SUBJECTDIR, 'Param1', VAL1, 'Param2', VAL2, ...) | ||
% specifies additional parameter name-value pairs chosen from: | ||
% | ||
|
@@ -62,20 +65,63 @@ | |
|
||
|
||
% PARSE INPUT | ||
[subjectDir, varargin{:}] = convertStringsToChars(subjectDir, varargin{:}); | ||
[subjectSelection, varargin{:}] = convertStringsToChars(subjectSelection, varargin{:}); | ||
|
||
assert(ischar(subjectDir), ... | ||
assert(ischar(subjectSelection), ... | ||
'CATO:functional_pipeline:subjectDirNotText', ... | ||
'subjectDir must be a row vector of characters or string scalar.'); | ||
assert(isdir(subjectDir), ... | ||
assert(isdir(subjectSelection) | isfile(subjectSelection), ... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function |
||
'CATO:functional_pipeline:subjectDirNotDir', ... | ||
'subjectDir (%s) is not a directory.', subjectDir); | ||
'subjectDir (%s) is not a directory.', subjectSelection); | ||
|
||
[configFile, runType, configParamsCl] = parseVarargin(varargin{:}); | ||
% parseVarargin does also error handling. | ||
%% Group mode | ||
|
||
if isfile(subjectSelection) | ||
subjectListFile = subjectSelection; | ||
fprintf('\n--------strarting group run----------\n') | ||
|
||
% read file | ||
fi = fopen(subjectListFile); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of using Additionally, using Maybe, Small note: The file handle is commonly referred to as |
||
|
||
fprintf('Processing subjects in %s\n\n', subjectListFile); | ||
|
||
% read line by line, keep track of processed/failed/unrecognized | ||
subjectDir = fgetl(fi); | ||
processedSubjects = 0; | ||
failedSubjects = 0; | ||
unrecognizedSubjects = 0; | ||
|
||
while ischar(subjectDir) | ||
if isdir(subjectDir) | ||
try | ||
configParams = functional_pipeline(subjectDir, varargin{:}); | ||
processedSubjects = processedSubjects + 1; | ||
catch | ||
failedSubjects = failedSubjects + 1; | ||
end | ||
else | ||
unrecognizedSubjects = unrecognizedSubjects + 1; | ||
warning('CATO:functional_pipeline:subjectDirNotDir', ... | ||
'subjectDir (%s) is not a directory', subjectDir); | ||
end | ||
subjectDir = fgetl(fi); | ||
end | ||
|
||
fprintf('\n---------group run finished----------\n') | ||
fprintf('Processed %d subjects, %d failed, %d unrecognized\n\n', ... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice that the code keeps track of the unsuccessful subjects! It might also be a good idea to provide a list of the subject names that were unsuccessful as this might help users to identify issues quickly. Maybe this list can be displayed alongside the statistics? To keep this CATO usable with this feature, it might be helpful to truncate the list to a manageable size (e.g. 100 or 1,000) when the number of subjects is very large. |
||
processedSubjects, failedSubjects, unrecognizedSubjects); | ||
|
||
fclose(fi); | ||
return | ||
end | ||
|
||
subjectDir = subjectSelection; | ||
|
||
%% Setup | ||
|
||
[configFile, runType, configParamsCl] = parseVarargin(varargin{:}); | ||
% parseVarargin does also error handling. | ||
|
||
% Setup path (note this is done before log files or other stuff). | ||
oldPath = pwd; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would update
subjectDirNotText
tosubjectSelectionNotText
(here and at the other locations), such that the internal error ID matches the variable.