Skip to content

Commit 03a4c35

Browse files
authored
Merge pull request #46 from cpp-lln-lab/olf
[ENH] improve roi plotting
2 parents 6b8bac3 + becc14f commit 03a4c35

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

src/roi/plotDataInRoi.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,11 @@ function labelAxis(roiAs, rows, cols, subplotList, roiImages, dataLabel)
222222
subplot(rows, cols, subplotList(1, i));
223223

224224
bf = bids.File(roiImages{i});
225-
title(sprintf('roi: %s', bf.entities.label));
225+
desc = '';
226+
if isfield(bf.entities, 'desc')
227+
desc = sprintf('- desc: %s', bf.entities.desc);
228+
end
229+
title(sprintf('roi: %s%s', bf.entities.label, desc));
226230

227231
subplot(rows, cols, subplotList(end, i));
228232

src/roi/resliceRoiImages.m

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
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: Returns the matlabbatch without running it.
16+
% :type dryRun: logical
17+
%
18+
% (C) Copyright 2021 CPP ROI developers
419

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

23+
if nargin < 3
24+
dryRun = false;
25+
end
26+
27+
matlabbatch = {};
28+
829
% check if files are in the same space
930
% if not we reslice the ROI to have the same resolution as the data image
1031
sts = checkRoiOrientation(referenceImage, imagesToCheck);
@@ -13,9 +34,11 @@
1334

1435
else
1536

16-
matlabbatch = {};
1737
matlabbatch = setBatchReslice(matlabbatch, referenceImage, imagesToCheck);
18-
spm_jobman('run', matlabbatch);
38+
39+
if ~dryRun
40+
spm_jobman('run', matlabbatch);
41+
end
1942

2043
basename = spm_file(imagesToCheck, 'basename');
2144
reslicedImages = spm_file(imagesToCheck, 'basename', ...

0 commit comments

Comments
 (0)