Skip to content

Commit

Permalink
Including voxel size & BB selection
Browse files Browse the repository at this point in the history
The warped images were generated with the SPM default value of 1.5 x 1.5
x 1.5 mm3 for the US (and pipeline), which was not ideal.
-> adding the option in the batch and the *_run_*.m functions
  • Loading branch information
ChristophePhillips committed Nov 13, 2017
1 parent a027b55 commit dbc4f8e
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 7 deletions.
10 changes: 6 additions & 4 deletions hmri_run_proc_US.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@
end

% Prepare and run 'spm_preproc' -> get tissue maps + deformation
defsa.channel = job.subjc(nm).channel;
defsa.tissue = job.tissue;
defsa.warp = job.warp;
out.subjc(nm) = spm_preproc_run(defsa);
defsa.channel = job.subjc(nm).channel;
defsa.tissue = job.tissue;
defsa.warp = job.warp;
defsa.warp.vox = mean(job.many_sdatas.vox);
defsa.warp.bb = job.many_sdatas.bb;
out.subjc(nm) = spm_preproc_run(defsa);

% Move segmentation output (if requested) and update 'out' structure:
% all *c*.nii images, deformation field (y_*.nii), parameters
Expand Down
8 changes: 7 additions & 1 deletion hmri_run_proc_pipeline.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
job_US.many_sdatas.vols_pm = job.vols_pm;
end
job_US.many_sdatas.channel.vols = job.s_vols;
% Set voxel sizes & BB
job_US.many_sdatas.vox = job.vox;
job_US.many_sdatas.bb = job.bb;

% Only spit out CSF in native space (no Dartel imported) & warped (no modulation)
job_US.tissue(3).native = [1 0];
Expand All @@ -47,7 +50,7 @@
% maps
% .def : cell-array with the deformations for each subject.

% 2/ Proceed with dartel (only of requested)
% 2/ Proceed with dartel (only if requested)
%-------------------------------------------
% including template create and warping into MNI space

Expand Down Expand Up @@ -107,6 +110,9 @@
job_Dnorm.multsdata.vols_pm = job.vols_pm;
% get the warps
job_Dnorm.multsdata.vols_field = out_Dwarp.files;
% Set voxel sizes
job_Dnorm.vox = job.vox;
job_Dnorm.bb = job.bb;
% get the output directory
job_Dnorm.output = job.output;

Expand Down
27 changes: 26 additions & 1 deletion tbx_scfg_hmri_proc_US.m
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,38 @@
many_pams.help = {['Select whole brain parameter maps (e.g. MT, ',...
'R2*, FA, etc.) from all subjects for processing, one type per entry.']};

% ---------------------------------------------------------------------
% vox Voxel sizes
% ---------------------------------------------------------------------
vox = cfg_entry;
vox.tag = 'vox';
vox.name = 'Voxel sizes';
vox.num = [1 3];
vox.strtype = 'e';
vox.val = {[1 1 1]};
vox.help = {[...
'Specify the voxel sizes of the deformation field and tissue classes ',...
'to be produced. Non-finite values will default to the voxel sizes of ',...
'the template image that was originally used to estimate the deformation.']};

%--------------------------------------------------------------------------
% bb Bounding box
%--------------------------------------------------------------------------
bb = cfg_entry;
bb.tag = 'bb';
bb.name = 'Bounding box';
bb.help = {'The bounding box (in mm) of the volume which is to be written (relative to the anterior commissure).'};
bb.strtype = 'r';
bb.num = [2 3];
bb.def = @(val)spm_get_defaults('normalise.write.bb', val{:});

% ---------------------------------------------------------------------
% many_sdatas Many subjects data
% ---------------------------------------------------------------------
many_sdatas = cfg_branch;
many_sdatas.tag = 'many_sdatas';
many_sdatas.name = 'Data & options';
many_sdatas.val = {output unlimit(rstruct) many_pams};
many_sdatas.val = {output unlimit(rstruct) many_pams vox bb};
many_sdatas.help = {'Specify images for many subjects at once.' , ...
['Processing will work on 1 subject at the time, using his ',...
'structural image(s) to estimate the segmentation and warping parameters. ', ...
Expand Down
27 changes: 26 additions & 1 deletion tbx_scfg_hmri_proc_pipeline.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,31 @@
'Gaussian blurring kernel in mm. Three values should be entered',...
'denoting the FWHM in the x, y and z directions.']};

% ---------------------------------------------------------------------
% vox Voxel sizes
% ---------------------------------------------------------------------
vox = cfg_entry;
vox.tag = 'vox';
vox.name = 'Voxel sizes';
vox.num = [1 3];
vox.strtype = 'e';
vox.val = {[1 1 1]};
vox.help = {[...
'Specify the voxel sizes of the deformation field and tissue classes ',...
'to be produced. Non-finite values will default to the voxel sizes of ',...
'the template image that was originally used to estimate the deformation.']};

%--------------------------------------------------------------------------
% bb Bounding box
%--------------------------------------------------------------------------
bb = cfg_entry;
bb.tag = 'bb';
bb.name = 'Bounding box';
bb.help = {'The bounding box (in mm) of the volume which is to be written (relative to the anterior commissure).'};
bb.strtype = 'r';
bb.num = [2 3];
bb.def = @(val)spm_get_defaults('normalise.write.bb', val{:});

% ---------------------------------------------------------------------
% proc_pipel Preprocess maps -> pipelines
% ---------------------------------------------------------------------
Expand All @@ -149,7 +174,7 @@
['- US+Dartel+Smooth -> applies US, builds Dartel template and warps' ...
'into MNI, then smoothes (weighted-average)']
}'; %#ok<*NBRAK>
proc_pipel.val = {output vols many_pams fwhm pipe_c};
proc_pipel.val = {output vols many_pams vox bb fwhm pipe_c};
proc_pipel.prog = @hmri_run_proc_pipeline;
proc_pipel.vout = @vout_proc_pipeline;
proc_pipel.check = @check_data;
Expand Down

0 comments on commit dbc4f8e

Please sign in to comment.