Skip to content

Commit

Permalink
feat: adapt sample scripts for parallel testing
Browse files Browse the repository at this point in the history
  • Loading branch information
juancarlosfarah committed Oct 8, 2021
1 parent bf33a5e commit f5f5f75
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
% get data folder relative to this file
filePath = fileparts(which(mfilename));
pathToDataFolder = fullfile(filePath, '../../../../../neurochi/data/');
pathToWorkspace = fullfile(pathToDataFolder, 'w1');
pathToWorkspace = fullfile(pathToDataFolder, 'workspace');
pathToDataset = fullfile(pathToDataFolder, 'input');
% for intermediary pipelines, send output to the transfer folder
pathToOutput = fullfile(pathToDataFolder, 'transfer');
Expand All @@ -27,8 +27,8 @@
config.pathToDataset = pathToDataset;
config.pathToOutput = pathToOutput;
% helps debug by not running all subjects
config.numSubjects = 1;
config.parallel = false;
config.numSubjects = 2;
config.parallel = true;

% sequence level configurations
config.sequence.startStep = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
% get data folder relative to this file
filePath = fileparts(which(mfilename));
pathToDataFolder = fullfile(filePath, '../../../../../neurochi/data/');
pathToWorkspace = fullfile(pathToDataFolder, 'w1');
pathToWorkspace = fullfile(pathToDataFolder, 'workspace');
pathToDataset = fullfile(pathToDataFolder, 'input');
% for intermediary pipelines, send output to the transfer folder
pathToOutput = fullfile(pathToDataFolder, 'transfer');
Expand All @@ -26,8 +26,8 @@
config.pathToDataset = pathToDataset;
config.pathToOutput = pathToOutput;
% helps debug by not running all subjects
config.numSubjects = 1;
config.parallel = false;
config.numSubjects = 2;
config.parallel = true;
config.numPcaComponents = 5;

% sequence level configurations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
% get data folder relative to this file
filePath = fileparts(which(mfilename));
pathToDataFolder = fullfile(filePath, '../../../../../neurochi/data/');
pathToWorkspace = fullfile(pathToDataFolder, 'w1');
pathToWorkspace = fullfile(pathToDataFolder, 'workspace');
pathToDataset = fullfile(pathToDataFolder, 'input');
pathToParcellations = fullfile(pathToDataFolder, 'parcs');
% for intermediary pipelines, send output to the transfer folder
Expand All @@ -28,8 +28,8 @@
config.pathToParcellations = pathToParcellations;
config.pathToOutput = pathToOutput;
% helps debug by not running all subjects
config.numSubjects = 1;
config.parallel = false;
config.numSubjects = 2;
config.parallel = true;

% sequence level configurations
config.sequence.startStep = 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [config] = BuildSegmentationConfiguration()
function [config] = BuildSegmentationConfiguration(parcellation)
%BUILDSEGMENTATIONCONFIGURATION Builds configuration for a pipeline.
% Builds a configuration for a pipeline that performs segmentation.
%
Expand All @@ -13,7 +13,7 @@
% get data folder relative to this file
filePath = fileparts(which(mfilename));
pathToDataFolder = fullfile(filePath, '../../../../../neurochi/data/');
pathToWorkspace = fullfile(pathToDataFolder, 'w1');
pathToWorkspace = fullfile(pathToDataFolder, 'workspace');
pathToDataset = fullfile(pathToDataFolder, 'input');
pathToParcellations = fullfile(pathToDataFolder, 'parcs');
% for intermediary pipelines, send output to the transfer folder
Expand All @@ -28,9 +28,9 @@
config.pathToParcellations = pathToParcellations;
config.pathToOutput = pathToOutput;
% helps debug by not running all subjects
config.numSubjects = 1;
config.parcellation = 'schaefer_2018_400_subc';
config.parallel = false;
config.numSubjects = 2;
config.parcellation = parcellation;
config.parallel = true;

% sequence level configurations
config.sequence.startStep = 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function [config] = BuildTransformParcellationConfiguration()
function [config] = BuildTransformParcellationConfiguration(parcellation)
%BUILDTRANSFORMPARCELLATIONCONFIGURATION Builds configuration for pipeline.
% Builds a configuration for a pipeline that transforms a parcellation.
%
Expand All @@ -13,7 +13,7 @@
% get data folder relative to this file
filePath = fileparts(which(mfilename));
pathToDataFolder = fullfile(filePath, '../../../../../neurochi/data/');
pathToWorkspace = fullfile(pathToDataFolder, 'w1');
pathToWorkspace = fullfile(pathToDataFolder, 'workspace');
pathToDataset = fullfile(pathToDataFolder, 'input');
pathToParcellations = fullfile(pathToDataFolder, 'parcs');
% for intermediary pipelines, send output to the transfer folder
Expand All @@ -28,15 +28,15 @@
config.pathToParcellations = pathToParcellations;
config.pathToOutput = pathToOutput;
% helps debug by not running all subjects
config.numSubjects = 1;
config.numSubjects = 2;
% select the parcellation to transform
% (must be present in `pathToParcellations`)
% usually you use first a parcellation
% e.g. 'schaefer_2018_400_subc.nii'
% and then a ventricle atlas
% e.g. 'mask_ventricles_MNIch2.nii.gz'
config.parcellation = 'schaefer_2018_400_subc.nii';
config.parallel = false;
config.parcellation = parcellation;
config.parallel = true;

% sequence level configurations
config.sequence.startStep = 1;
Expand Down
3 changes: 2 additions & 1 deletion src/matlab/scripts/registerParcellationScript.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
clearvars;

% build configuration
config = BuildSampleConfiguration();
parcellation = 'shen_MNI152';
config = BuildSampleConfiguration(parcellation);

pipeline = BuildRegisterParcellationPipeline(config.common.pathToWorkspace, ...
config.common.pathToDataset, ...
Expand Down
3 changes: 2 additions & 1 deletion src/matlab/scripts/segmentationScript.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
addpath(genpath(fullfile(filePath, '../../matlab')));

% build configuration
config = BuildSegmentationConfiguration();
parcellation = 'shen_MNI152';
config = BuildSegmentationConfiguration(parcellation);

pipeline = BuildSegmentationPipeline(config.parcellation, ...
config.pathToWorkspace, ...
Expand Down
3 changes: 2 additions & 1 deletion src/matlab/scripts/transformParcellationScript.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
addpath(genpath(fullfile(filePath, '../../matlab')));

% build configuration
config = BuildTransformParcellationConfiguration();
parcellation = 'shen_MNI152';
config = BuildTransformParcellationConfiguration(parcellation);

pipeline = BuildTransformParcellationPipeline(config.parcellation, ...
config.pathToWorkspace, ...
Expand Down

0 comments on commit f5f5f75

Please sign in to comment.