help
help > RE: conn_batch how to do all 1st-level analyses
Apr 22, 2016 05:04 PM | Stephen L. - Coma Science Group, GIGA-Consciousness, Hospital & University of Liege
RE: conn_batch how to do all 1st-level analyses
I fixed both of my issues (not running all analyses + no way to
conn_batch Dynamic FC analysis) by directly using conn_process.m,
which is the script that is called to do all the heavy job.
So indeed, it seems that conn_batch can only run one type of 1st-level analysis: either Seed-to-Voxel/ROI-to-ROI or Voxel-to-Voxel. Not both, and no way to run Dynamic FC even if conn_batch should support it because of BATCH.Setup.analyses = 4.
So, what I do to workaround this limitation is basically to:
1. first run conn_batch like before, so that I get all the setup, denoising and one analysis steps done for me (and it's easier to fill BATCH-like struct than the CONN_x internal struct, conn_batch fills the gaps for me)
2. then I simply load CONN_x into the workspace and call conn_process() on it. Since I already filled CONN_x with everything needed to perform all analyses, I just have to run the missing analyses, thus I just need to call conn_process().
Practical example: before I had something like that:
% SETUP
conn_file = 'my_conn_project.mat';
CONN_x.filename = conn_file;
CONN_x.Setup.isnew = 1;
CONN_x.Analysis.measures = conn_v2v('measurenames'); % load all available kind of measures and force Voxel-to-Voxel analysis
% ... lots of other CONN_x assignments...
% Automatic batch processing of all steps
CONN_x.Setup.done = 1;
CONN_x.Denoising.done = 1;
CONN_x.Analysis.done = 1;
CONN_x.Results.done = 1;
% Running the batch
conn_batch(CONN_x);
% Open batch in GUI
clear CONN_x data;
conn;
conn('load', conn_file); % Load the parameters/results
conn gui_setup; % refresh the GUI after loading the file
Now, I have the same thing, but before opening the batch in GUI I run additional analyses:
% ... all the code above ...
% Running the batch
conn_batch(CONN_x);
% Running missing analyses
% First: load the CONN_x batch struct, conn_process will access it as a global.
clear CONN_x;
load(conn_file); % will load var CONN_x into workspace
global CONN_x;
CONN_x.gui.overwrite = 'Yes' % avoid CONN GUI asking us what to do, overwrite files directly
% Compute Seed-to-Voxel 1st-level analysis
conn_process('analyses_seed');
% Compute ROI-to-ROI 1st-level analysis
conn_process('analyses_seedandroi');
% Compute Dynamic FC (functional connectivity) 1st-level analysis
if inter_or_intra == 1 % CONN v16a cannot yet do inter subjects (across independent conditions/groups) dynamic FC, it can only work on intra-subject project over multiple sessions
conn_process('analyses_dyn');
elseif inter_or_intra == 0
fprintf('Skipping Dynamic FC: CONN does not yet support inter-subjects project (works on multiple sessions but not multiple independent subjects groups/conditions).\n');
end
% Save the new struct and results!
if isfield(CONN_x,'filename'), conn save; end;
% Open batch in GUI
clear CONN_x data;
conn;
conn('load', conn_file); % Load the parameters/results
conn gui_setup; % refresh the GUI after loading the file
The full script I use can be found on my github (under MIT license, feel free to use/remix it):
github dot com/lrq3000/neuro_experiments_tools/blob/master/matlab/conn_subjects_loader/conn_subjects_loader.m
So indeed, it seems that conn_batch can only run one type of 1st-level analysis: either Seed-to-Voxel/ROI-to-ROI or Voxel-to-Voxel. Not both, and no way to run Dynamic FC even if conn_batch should support it because of BATCH.Setup.analyses = 4.
So, what I do to workaround this limitation is basically to:
1. first run conn_batch like before, so that I get all the setup, denoising and one analysis steps done for me (and it's easier to fill BATCH-like struct than the CONN_x internal struct, conn_batch fills the gaps for me)
2. then I simply load CONN_x into the workspace and call conn_process() on it. Since I already filled CONN_x with everything needed to perform all analyses, I just have to run the missing analyses, thus I just need to call conn_process().
Practical example: before I had something like that:
% SETUP
conn_file = 'my_conn_project.mat';
CONN_x.filename = conn_file;
CONN_x.Setup.isnew = 1;
CONN_x.Analysis.measures = conn_v2v('measurenames'); % load all available kind of measures and force Voxel-to-Voxel analysis
% ... lots of other CONN_x assignments...
% Automatic batch processing of all steps
CONN_x.Setup.done = 1;
CONN_x.Denoising.done = 1;
CONN_x.Analysis.done = 1;
CONN_x.Results.done = 1;
% Running the batch
conn_batch(CONN_x);
% Open batch in GUI
clear CONN_x data;
conn;
conn('load', conn_file); % Load the parameters/results
conn gui_setup; % refresh the GUI after loading the file
Now, I have the same thing, but before opening the batch in GUI I run additional analyses:
% ... all the code above ...
% Running the batch
conn_batch(CONN_x);
% Running missing analyses
% First: load the CONN_x batch struct, conn_process will access it as a global.
clear CONN_x;
load(conn_file); % will load var CONN_x into workspace
global CONN_x;
CONN_x.gui.overwrite = 'Yes' % avoid CONN GUI asking us what to do, overwrite files directly
% Compute Seed-to-Voxel 1st-level analysis
conn_process('analyses_seed');
% Compute ROI-to-ROI 1st-level analysis
conn_process('analyses_seedandroi');
% Compute Dynamic FC (functional connectivity) 1st-level analysis
if inter_or_intra == 1 % CONN v16a cannot yet do inter subjects (across independent conditions/groups) dynamic FC, it can only work on intra-subject project over multiple sessions
conn_process('analyses_dyn');
elseif inter_or_intra == 0
fprintf('Skipping Dynamic FC: CONN does not yet support inter-subjects project (works on multiple sessions but not multiple independent subjects groups/conditions).\n');
end
% Save the new struct and results!
if isfield(CONN_x,'filename'), conn save; end;
% Open batch in GUI
clear CONN_x data;
conn;
conn('load', conn_file); % Load the parameters/results
conn gui_setup; % refresh the GUI after loading the file
The full script I use can be found on my github (under MIT license, feel free to use/remix it):
github dot com/lrq3000/neuro_experiments_tools/blob/master/matlab/conn_subjects_loader/conn_subjects_loader.m
Threaded View
| Title | Author | Date |
|---|---|---|
| Stephen L. | Apr 22, 2016 | |
| Stephen L. | Apr 22, 2016 | |
| Alfonso Nieto-Castanon | Apr 25, 2016 | |
| Stephen L. | Apr 26, 2016 | |
| Stephen L. | Apr 22, 2016 | |
| Stephen L. | Apr 22, 2016 | |
