Skip to content

Commit cfe72dc

Browse files
committed
make resliceRoiImage more flexible
1 parent 734776b commit cfe72dc

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

src/roi/resliceRoiImages.m

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
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
419

520
% TODO
621
% - allow option to binarize output?
722

23+
matlabbatch = {};
24+
reslicedImages = '';
25+
826
% check if files are in the same space
927
% if not we reslice the ROI to have the same resolution as the data image
1028
sts = checkRoiOrientation(referenceImage, imagesToCheck);
@@ -13,9 +31,11 @@
1331

1432
else
1533

16-
matlabbatch = {};
1734
matlabbatch = setBatchReslice(matlabbatch, referenceImage, imagesToCheck);
18-
spm_jobman('run', matlabbatch);
35+
36+
if ~dryRun
37+
spm_jobman('run', matlabbatch);
38+
end
1939

2040
basename = spm_file(imagesToCheck, 'basename');
2141
reslicedImages = spm_file(imagesToCheck, 'basename', ...

0 commit comments

Comments
 (0)