


Convert a NIFTI-1 object into a form of struct _______________________________________________________________________ Copyright (C) 2005 Wellcome Department of Imaging Neuroscience



0001 function t = structn(obj) 0002 % Convert a NIFTI-1 object into a form of struct 0003 % _______________________________________________________________________ 0004 % Copyright (C) 2005 Wellcome Department of Imaging Neuroscience 0005 0006 % 0007 % $Id: structn.m 253 2005-10-13 15:31:34Z guillaume $ 0008 0009 0010 if numel(obj)~=1, 0011 error('Too many elements to convert'); 0012 end; 0013 fn = fieldnames(obj); 0014 for i=1:length(fn) 0015 tmp = subsref(obj,struct('type','.','subs',fn{i})); 0016 if ~isempty(tmp) 0017 t.(fn{i}) = tmp; 0018 end; 0019 end; 0020 return;