Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


writeSPMmat.m File Reference

Go to the source code of this file.


Functions

 if (exist(matin)~=2)
 fprintf (2,'Error%s:\nFile%s not found.\n', FuncName, matin)
end get its prefix if (strmatch('tam.', fliplr(matin))==1)
 if (~isfield(S,'M'))
 fprintf (2,'Error%s:\nFailed to find M in%s\n', FuncName, matin)
end if (size(S.M, 2)~=4)
end fprintf (2,'Error%s:\nM does not have 4 columns!\nM''s size is%g x%g',...FuncName, size(S.M, 1), size(S.M, 2))
end if (size(S.M, 1)~=3 &size(S.M, 1)~=4)
end fprintf (2,'Error%s:\nM does not have 3 or 4 rows!\nM''s size is%g x%g',...FuncName, size(S.M, 1), size(S.M, 2))
end if (size(S.M, 1)==4)
end if (S.M(4, 1)~=0|S.M(4, 2)~=0|S.M(4, 3)~=0|S.M(4, 4)~=1)
 fprintf (2,'Warning%s:\nAFNI expects the 4th row of M to be[0 0 0 1].\n', FuncName)
 fprintf (2,'This row is currently[%g%g%g%g] and will be ignored by AFNI.\n',...S.M(4, 1), S.M(4, 2), S.M(4, 3), S.M(4, 4))
 fprintf (2,'Proceed with caution.\n')
end end write output file if (nargin==1)
end if (exist(matout)==2)
end fprintf (2,'Error%s:\nOutput file%s exists already.\nWill not overwrite.\n',...FuncName, matout)
 if (fid< 0)
 fprintf (2,'Error%s:\nFailed in opening%s for writing.\nCheck permissions and disk space.\n',...FuncName, matout)
end fprintf (fid,'#Conversion of SPM''s%s\n', matin)
 fprintf (fid,'#transformation matrix file to ascii format.\n#\n')
 fprintf (fid,'#To convert SPM datasets to AFNI''s format, use\n')
 fprintf (fid,'#3dWarp including these options:\n')
 fprintf (fid,'#-matvec_in2out%s-matvec_fsl\n', matout)
 fprintf (fid,'#See 3dWarp-help for more info.\n#\n')
 for (i=1:1:4)
 fprintf (fid,'\t%f\t%f\t%f\t%f\n',...S.M(i, 1), S.M(i, 2), S.M(i, 3), S.M(i, 4))
end fclose (fid)

Variables

 function [err]
Purpose __pad9__
Purpose the _ASCII extension
is added to matin Output 
Parameters
Purpose the _ASCII extension
is added to matin Output Bethesda
Maryland Define the function
name for easy referencing 
FuncName = 'writeSPMmat'
Debug Flag DBG = 1
initailize return variables err = 1
does the input file exist matin = deblank(matin)
 return
end get its prefix prefixin = matin(1:length(matin)-4)
end load it S = load (matin)
end beep
end end write output file matout = [prefixin, '_ASCII.mat']
end fid = fopen(matout,'w')

Function Documentation

end fclose fid   ) 
 

for = 1:1:4  ) 
 

fprintf fid  ,
'\t%f\t%f\t%f\t%f\n ,
...S.  M(i, 1),
S.  M(i, 2),
S.  M(i, 3),
S.  M(i, 4)
 

fprintf fid  ,
'#See 3dWarp-help for more info.\n#\n
 

fprintf fid  ,
'#-matvec_in2out%s-matvec_fsl\n ,
matout 
 

fprintf fid  ,
'#3dWarp including these options:\n
 

fprintf fid  ,
'#To convert SPM datasets to AFNI''s  format,
use\n
 

fprintf fid  ,
'#transformation matrix file to ascii format.\n#\n
 

end fprintf fid  ,
'#Conversion of SPM''s%s\n ,
matin 
 

fprintf ,
'Error%s:\nFailed in opening%s for writing.\nCheck permissions and disk space.\n ,
  FuncName,
matout 
 

end fprintf ,
'Error%s:\nOutput file%s exists already.\nWill not overwrite.\n ,
  FuncName,
matout 
 

fprintf ,
'Proceed with caution.\n
 

fprintf ,
'This row is currently and will be ignored by AFNI.\n [%g%g%g%g],
...S.  M(4, 1),
S.  M(4, 2),
S.  M(4, 3),
S.  M(4, 4)
 

fprintf ,
'Warning%s:\nAFNI expects the 4th row of M to be.\n [0 0 0 1],
FuncName 
 

end fprintf ,
'Error%s:\nM does not have 3 or 4 rows!\nM''s size is%g x%g ,
  FuncName,
size(S.M, 1)  ,
size(S.M, 2) 
 

end fprintf ,
'Error%s:\nM does not have 4 columns!\nM''s size is%g x%g ,
  FuncName,
size(S.M, 1)  ,
size(S.M, 2) 
 

fprintf ,
'Error%s:\nFailed to find M in%s\n ,
FuncName  ,
matin 
 

fprintf ,
'Error%s:\nFile%s not found.\n ,
FuncName  ,
matin 
 

if  ) 
 

end if exist(matout = = 2  ) 
 

end end write output file if nargin  = = 1  ) 
 

end if S.M(4, 1)~  = 0 | S.M(4,2) ~= 0 | S.M(4,3) ~= 0 | S.M(4,4) ~= 1  ) 
 

end if size(S.M, 1)  = = 4  ) 
 

end if size(S.M, 1)~  = 3 & size(S.M,1) ~= 4  ) 
 

end if size(S.M, 2)~  = 4  ) 
 

if isfield(S,'M')  ) 
 

end get its prefix if strmatch('tam.', fliplr(matin))  = = 1  ) 
 

if exist(matin)~  = 2  ) 
 


Variable Documentation

Purpose __pad9__
 

Definition at line 15 of file writeSPMmat.m.

beep
 

Definition at line 85 of file writeSPMmat.m.

Debug Flag DBG = 1
 

Definition at line 37 of file writeSPMmat.m.

err = 1
 

Definition at line 117 of file writeSPMmat.m.

end fid = fopen(matout,'w')
 

Definition at line 99 of file writeSPMmat.m.

Purpose the _ASCII extension is added to matin Output Bethesda Maryland Define the function name for easy referencing FuncName = 'writeSPMmat'
 

Definition at line 34 of file writeSPMmat.m.

function[err]
 

Initial value:

 writeSPMmat (matin, matout)
%
%   [err] = writeSPMmat (matin, [matout])

Definition at line 1 of file writeSPMmat.m.

matin = deblank(matin)
 

Definition at line 45 of file writeSPMmat.m.

end end write output file matout = [prefixin, '_ASCII.mat']
 

Definition at line 91 of file writeSPMmat.m.

Purpose the _ASCII extension is added to matin Output Parameters
 

Definition at line 15 of file writeSPMmat.m.

else prefixin = matin(1:length(matin)-4)
 

Definition at line 56 of file writeSPMmat.m.

return
 

Definition at line 118 of file writeSPMmat.m.

end load it S = load (matin)
 

Definition at line 60 of file writeSPMmat.m.

 

Powered by Plone

This site conforms to the following standards: