Skip to content

Commit

Permalink
Minor fixes to aamod_reslice_rois
Browse files Browse the repository at this point in the history
  • Loading branch information
jpeelle committed Jan 16, 2014
1 parent ca85733 commit 817df23
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
24 changes: 5 additions & 19 deletions aa_modules/aamod_reslice_rois.m
Expand Up @@ -2,7 +2,7 @@
%
% Alejandro Vicente-Grabovetsky Dec-2008

function [aap,resp] = aamod_reslice_rois( aap, task, subj)
function [aap,resp] = aamod_reslice_rois(aap, task, subj)

resp='';

Expand All @@ -11,18 +11,13 @@

% Get meanEPImage
mEPIimg = aas_getfiles_bystream(aap,subj,'meanepi');
if isempty(mEPIimg)
aas_log(aap, true, 'Problem finding mean functional image.');
elseif size(mEPIimg,1) > 1
if size(mEPIimg,1) > 1
aas_log(aap, false, 'Found more than 1 mean functional images, using first.');
end
mEPIimg = deblank(mEPIimg(1,:));

% Get roi image(s)
Rimg = aas_getfiles_bystream(aap,subj,'rois');
if isempty(Rimg)
aas_log(aap, true, 'Problem finding ROI image.');
end
Rimg = aas_getfiles_bystream(aap,subj,'roi');

% Test format, ensure it is V.dt = [2 0];
for c=1:size(Rimg,1)
Expand All @@ -47,18 +42,9 @@
for r = 1:length(Rimg(:,1))
Rcurr = deblank(Rimg(r,:));
[Rpth, Rfn, Rext] = fileparts(Rcurr);

if ~exist(Rcurr, 'file')
error(sprintf('The ROI %s file does not exist', ...
Rcurr))
end

% Reslice to EPI...
spm_reslice({mEPIimg, Rcurr}, resFlags);

% Delete ROI in MNI space...
unix(['rm -rf ' Rcurr]);

spm_reslice({mEPIimg, Rcurr}, resFlags);
Rcurr = fullfile(Rpth, ['r' Rfn, Rext]);

% Check the content of the resliced ROI!
Expand All @@ -71,7 +57,7 @@
outstream = [outstream, Rcurr];
end

aap=aas_desc_outputs(aap,subj,'rois',outstream);
aap=aas_desc_outputs(aap,subj,'roi',outstream);

%% Save graphical output to common diagnostics directory
mriname = aas_prepare_diagnostic(aap,subj);
Expand Down
10 changes: 5 additions & 5 deletions aa_modules/aamod_reslice_rois.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<aap>
<tasklist>
<currenttask domain='subject' mfile_alias='aamod_reslice_rois' desc='SPM reslice' modality='MRI'>
<currenttask domain='subject' desc='SPM reslice' modality='MRI'>

<qsub>
<timeBase>0.5</timeBase>
Expand All @@ -10,13 +10,13 @@

<permanenceofoutput>1</permanenceofoutput>

<inputstreams>
<stream>meanepi</stream>
<stream>rois</stream>
<inputstreams>
<stream>roi</stream>
<stream ismodified='0'>meanepi</stream>
</inputstreams>

<outputstreams>
<stream>rois</stream>
<stream>roi</stream>
</outputstreams>

</currenttask>
Expand Down

0 comments on commit 817df23

Please sign in to comment.