%   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. 


%---------------------------------------------------------------
% batch variables defined here for analysis 'normalize'
%---------------------------------------------------------------
global SubInd SubIndStr MaskStr sptl_CO sptl_BB sptl_Vx sptl_Ornt sptl_Rglrztn
sptl_CO=0
                                                                     
sptl_BB=sptl_BB
sptl_Vx=[]
sptl_Ornt = [0 0 0 0 0 0 -1 1 1 0 0 0] %[0 0 0 0 0 0 1 1 1 0 0 0] for no flipping; [0 0 0 0 0 0 -1 1 1 0 0 0] (default) for flipping
sptl_Rglrztn=sptl_Rglrztn %Extremely Heavy 1|Heavy .1|Medium .01|Light .001|Very Light .0001

Image=['E:\fMRIData\fMRIDataGV\',SubIndStr,'\Vol.img'];
MatName=['E:\fMRIData\fMRIDataGV\',SubIndStr,'\Vol_sn3d.mat'];
clear F1 F2 F3 F4 F5 F6
SessVec=[1 2 3 4 5 6];
NSess=length(SessVec); 
for SessInd=1:NSess
   ActSess=SessVec(SessInd);
   ActSessStr=int2str(ActSess);
	if ActSess<10
  	 	ActSessStr=['0',ActSessStr];
	end
   FolderName=['E:\fMRIData\fMRIDataGV\',SubIndStr,'\',ActSessStr,'\'];
   Mask=[MaskStr,'*.img'];
   Tmp=spm_get('Files',FolderName,Mask)
   Images{SessInd}=Tmp;
end

%Images=[]

normalize = struct(...
'option', 3, ...	%'Determine Parameters Only|Write Normalised Only|Determine Parameters & Write Normalised' [1 2 3]
'nbsubjects', 1, ...			
'object_masking', 0, ...
'image', {{Image}}, ...
'objmask', {{''}}, ...
'matname', {{MatName}}, ...
'images', {{Images}}, ...
'template', 'E:\Matlab\toolbox\spm99\templates\T1.img', ...
'type', 0, ... 		%'Default Normalisation|Custom Normalisation', [0 1]
'estimates',0, ...	%Neurological (R is R)(0)'Radiological  (L is R)(1) 'Custom Affine Starting Estimates'(2)
'custom_norm',-1, ...
'nonlin_func_nb', 5, ...
'func_nb', 0, ...
'nonlin_ite_nb', 12, ...	%Default=12
'nonlin_regular', 0.01, ...	%Default=0.01=Medium regularization
'mask_brain', 0, ...
'interp', 1, ...		%Nearest Neighbour|Bilinear|Sinc (9x9x9)'],[0 1 -9]
'bounding_box', 1, ... %if custom bounding box (0) set global sptl_BB empty, takes default otherwise, spm_sn3d line 487
'voxel_sizes', 0, ...  %if custom voxel_sizes (0) set global sptl_Vx empty, takes default otherwise, spm_sn3d line 509
'voxel_sizes_custom', [1.5 1.5 1.5]);


