Skip to content

Commit

Permalink
fix crashes when attempting to delete non-existant previous results
Browse files Browse the repository at this point in the history
  • Loading branch information
jooh committed Jul 31, 2018
1 parent 2d0ff01 commit 26e066e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions aa_modules/aamod_norm_write_dartel.m
Expand Up @@ -132,11 +132,14 @@
f = basename(P);
P = P(f(:,1) ~= 'w',:);
imgs = strvcat(imgs, P);
% delete previous because otherwise nifti write routine doesn't
% save disc space when you reslice to a coarser voxel
% delete any previous results because otherwise nifti write routine
% doesn't save disc space when you reslice to a coarser voxel
for c=1:size(P,1)
[pth fle ext]=fileparts(P(c,:));
[s w] = aas_shell(['rm ' fullfile(pth,[aap.spm.defaults.normalise.write.prefix fle ext])],true); % quietly
previous = fullfile(pth,[aap.spm.defaults.normalise.write.prefix fle ext]);
if exist(previous,'file') > 0
[s w] = aas_shell(['rm ' previous],true); % quietly
end
end;
job.data.subj.images = cellstr(imgs);

Expand Down Expand Up @@ -192,4 +195,4 @@
otherwise
aas_log(aap,1,sprintf('Unknown task %s',task));
end;
end
end

0 comments on commit 26e066e

Please sign in to comment.