%   BAT.m


%   This software is protected by german copyright and international treaties.             
%   Copyright 2004 Markus Junghöfer & Peter Peyk. All Rights Reserved.                     
%                                                                                          
%   THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE        
%   NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,    
%   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE    
%   OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
%   TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT,       
%   INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE      
%   OR DOCUMENTATION. 


global SubVec

NSub=length(SubVec);
NSess=6;

                                                                     
realign = struct(...
'subject_nb', NSub, ...
'num_sessions',NSess, ...
'sessions', [1:NSub], ...
'option', 3, ...
'modality', 3, ...
'reslice_method', 2, ...
'create', 3, ...
'mask', 0, ...
'adjust_sampling_errors',0);

for SubInd=1:NSub;
   clear F1
   ActSub=SubVec(SubInd)
   ActSubStr=int2str(ActSub);
  	if ActSub<10
     	ActSubStr=['0',ActSubStr];
  	end
	for SessInd=1:NSess
   	ActSessStr=int2str(SessInd);
   	if SessInd<10
      	ActSessStr=['0',ActSessStr];
   	end
   	FolderName=['E:\fMRIData\fMRIDataGV\',ActSubStr,'\',ActSessStr,'\'];
   	Mask=['a',ActSubStr,'*.img'];
      Tmp=spm_get('Files',FolderName,Mask);
      F1{SessInd}=Tmp;
   end
   sessions(SubInd)=struct('images',{{F1{1:NSess}}});
end

