|
1 | | -% (C) Copyright 2021 CPP ROI developers |
2 | | - |
3 | | -function reslicedImages = resliceRoiImages(referenceImage, imagesToCheck) |
| 1 | +function [reslicedImages, matlabbatch] = resliceRoiImages(referenceImage, imagesToCheck, dryRun) |
| 2 | + % |
| 3 | + % Check if images are in the same orientation and reslice if necessarrry. |
| 4 | + % |
| 5 | + % USAGE:: |
| 6 | + % |
| 7 | + % reslicedImages = resliceRoiImages(referenceImage, imagesToCheck, dryRun) |
| 8 | + % |
| 9 | + % :param referenceImage: |
| 10 | + % :type referenceImage: path |
| 11 | + % |
| 12 | + % :param imagesToCheck: |
| 13 | + % :type imagesToCheck: path or cellstr |
| 14 | + % |
| 15 | + % :param dryRun: Only returns |
| 16 | + % :type dryRun: logical |
| 17 | + % |
| 18 | + % (C) Copyright 2021 CPP ROI developers |
4 | 19 |
|
5 | 20 | % TODO |
6 | 21 | % - allow option to binarize output? |
7 | 22 |
|
| 23 | + matlabbatch = {}; |
| 24 | + reslicedImages = ''; |
| 25 | + |
8 | 26 | % check if files are in the same space |
9 | 27 | % if not we reslice the ROI to have the same resolution as the data image |
10 | 28 | sts = checkRoiOrientation(referenceImage, imagesToCheck); |
|
13 | 31 |
|
14 | 32 | else |
15 | 33 |
|
16 | | - matlabbatch = {}; |
17 | 34 | matlabbatch = setBatchReslice(matlabbatch, referenceImage, imagesToCheck); |
18 | | - spm_jobman('run', matlabbatch); |
| 35 | + |
| 36 | + if ~dryRun |
| 37 | + spm_jobman('run', matlabbatch); |
| 38 | + end |
19 | 39 |
|
20 | 40 | basename = spm_file(imagesToCheck, 'basename'); |
21 | 41 | reslicedImages = spm_file(imagesToCheck, 'basename', ... |
|
0 commit comments