|
19 | 19 |
|
20 | 20 | jobsToAdd = numel(matlabbatch) + 1; |
21 | 21 |
|
| 22 | + if opt.anatOnly |
| 23 | + maxJobsToAdd = 4; |
| 24 | + else |
| 25 | + maxJobsToAdd = 5; |
| 26 | + end |
| 27 | + |
22 | 28 | % set the deformation field for all the images we are about to normalize |
23 | 29 | % we reuse a previously created deformation field if it is there |
24 | 30 | % otherwise we link to a segmentation module by using a dependency |
25 | 31 | deformationField = getDeformationField(matlabbatch, BIDS, opt); |
26 | 32 |
|
27 | | - for iJob = jobsToAdd:(jobsToAdd + 5) |
28 | | - |
| 33 | + for iJob = jobsToAdd:(jobsToAdd + maxJobsToAdd) |
29 | 34 | % we set images to be resampled at the voxel size we had at acquisition |
30 | 35 | matlabbatch = setBatchNormalize(matlabbatch, deformationField, voxDim); |
31 | | - |
32 | 36 | end |
33 | 37 |
|
34 | | - printBatchName('normalise functional images', opt); |
35 | | - |
36 | | - matlabbatch{jobsToAdd}.spm.spatial.normalise.write.subj.resample(1) = ... |
37 | | - cfg_dep('Coregister: Estimate: Coregistered Images', ... |
38 | | - returnDependency(opt, 'coregister'), ... |
39 | | - substruct('.', 'cfiles')); |
| 38 | + if ~opt.anatOnly |
| 39 | + printBatchName('normalise functional images', opt); |
| 40 | + matlabbatch{jobsToAdd}.spm.spatial.normalise.write.subj.resample(1) = ... |
| 41 | + cfg_dep('Coregister: Estimate: Coregistered Images', ... |
| 42 | + returnDependency(opt, 'coregister'), ... |
| 43 | + substruct('.', 'cfiles')); |
| 44 | + jobsToAdd = jobsToAdd + 1; |
| 45 | + end |
40 | 46 |
|
41 | 47 | % NORMALIZE STRUCTURAL |
42 | 48 | biasCorrectedImage = getBiasCorrectedImage(matlabbatch, BIDS, opt); |
43 | | - |
44 | 49 | printBatchName('normalise anatomical images', opt); |
45 | | - matlabbatch{jobsToAdd + 1}.spm.spatial.normalise.write.subj.resample(1) = biasCorrectedImage; |
46 | | - |
47 | | - % size 3 allow to run RunQA / original voxel size at acquisition |
48 | | - matlabbatch{jobsToAdd + 1}.spm.spatial.normalise.write.woptions.vox = [1 1 1]; |
| 50 | + matlabbatch{jobsToAdd}.spm.spatial.normalise.write.subj.resample(1) = biasCorrectedImage; |
| 51 | + % TODO why do we choose this resolution for this normalization? |
| 52 | + matlabbatch{jobsToAdd}.spm.spatial.normalise.write.woptions.vox = [1 1 1]; |
| 53 | + jobsToAdd = jobsToAdd + 1; |
49 | 54 |
|
50 | 55 | % NORMALIZE TISSUE PROBABILITY MAPS |
51 | 56 | [gmTpm, wmTpm, csfTpm] = getTpms(matlabbatch, BIDS, opt); |
52 | 57 |
|
53 | 58 | printBatchName('normalise grey matter tissue probability map', opt); |
54 | | - matlabbatch{jobsToAdd + 2}.spm.spatial.normalise.write.subj.resample(1) = gmTpm; |
| 59 | + matlabbatch{jobsToAdd}.spm.spatial.normalise.write.subj.resample(1) = gmTpm; |
| 60 | + jobsToAdd = jobsToAdd + 1; |
55 | 61 |
|
56 | 62 | printBatchName('normalise white matter tissue probability map', opt); |
57 | | - matlabbatch{jobsToAdd + 3}.spm.spatial.normalise.write.subj.resample(1) = wmTpm; |
| 63 | + matlabbatch{jobsToAdd}.spm.spatial.normalise.write.subj.resample(1) = wmTpm; |
| 64 | + jobsToAdd = jobsToAdd + 1; |
58 | 65 |
|
59 | 66 | printBatchName('normalise csf tissue probability map', opt); |
60 | | - matlabbatch{jobsToAdd + 4}.spm.spatial.normalise.write.subj.resample(1) = csfTpm; |
| 67 | + matlabbatch{jobsToAdd}.spm.spatial.normalise.write.subj.resample(1) = csfTpm; |
| 68 | + jobsToAdd = jobsToAdd + 1; |
61 | 69 |
|
62 | 70 | % NORMALIZE SKULSTRIPPED STRUCTURAL |
63 | 71 | skullstrippedImage = getSkullstrippedImage(matlabbatch, BIDS, opt); |
64 | | - |
65 | 72 | printBatchName('normalise skullstripped anatomical images', opt); |
66 | | - matlabbatch{jobsToAdd + 5}.spm.spatial.normalise.write.subj.resample(1) = skullstrippedImage; |
67 | | - |
68 | | - % size 3 allow to run RunQA / original voxel size at acquisition |
69 | | - matlabbatch{jobsToAdd + 5}.spm.spatial.normalise.write.woptions.vox = [1 1 1]; |
| 73 | + matlabbatch{jobsToAdd}.spm.spatial.normalise.write.subj.resample(1) = skullstrippedImage; |
| 74 | + % TODO why do we choose this resolution for this normalization? |
| 75 | + matlabbatch{jobsToAdd}.spm.spatial.normalise.write.woptions.vox = [1 1 1]; |
70 | 76 |
|
71 | 77 | end |
72 | 78 |
|
|
0 commit comments