Home > rest_20090422 > rest_spm5_files > @create_file_array > create_file_array.m

create_file_array

PURPOSE ^

Function for creating file_array objects.

SYNOPSIS ^

function a = create_file_array(varargin)

DESCRIPTION ^

 Function for creating file_array objects.
 FORMAT a = file_array(fname,dim,dtype,offset,scl_slope,scl_inter)
 a         - file_array object
 fname     - filename
 dim       - dimensions (default = [0 0] )
 dtype     - datatype   (default = 'uint8-le')
 offset    - offset into file (default = 0)
 scl_slope - scalefactor (default = 1)
 scl_inter - DC offset, such that dat = raw*scale + inter (default = 0)
 _______________________________________________________________________
 Copyright (C) 2005 Wellcome Department of Imaging Neuroscience

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

create_file_array.m

SOURCE CODE ^

0001 function a = create_file_array(varargin)
0002 % Function for creating file_array objects.
0003 % FORMAT a = file_array(fname,dim,dtype,offset,scl_slope,scl_inter)
0004 % a         - file_array object
0005 % fname     - filename
0006 % dim       - dimensions (default = [0 0] )
0007 % dtype     - datatype   (default = 'uint8-le')
0008 % offset    - offset into file (default = 0)
0009 % scl_slope - scalefactor (default = 1)
0010 % scl_inter - DC offset, such that dat = raw*scale + inter (default = 0)
0011 % _______________________________________________________________________
0012 % Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
0013 
0014 %
0015 % $Id: file_array.m 315 2005-11-28 16:48:59Z john $
0016 
0017 
0018 if nargin==1
0019     if isstruct(varargin{1}),
0020         a = class(varargin{1},'create_file_array');
0021         return;
0022     elseif isa(varargin{1},'create_file_array'),
0023         a = varargin{1};
0024         return;
0025     end;
0026 end;
0027 a = struct('fname','','dim',[0 0],'dtype',2,...
0028            'be',0,'offset',0,'pos',[],'scl_slope',[],'scl_inter',[]);
0029 %a = class(a,'file_array');
0030 
0031 if nargin>=1, a =     fname(a,varargin{1}); end;
0032 if nargin>=2, a =       dim(a,varargin{2}); end;
0033 if nargin>=3, a =     dtype(a,varargin{3}); end;
0034 if nargin>=4, a =    offset(a,varargin{4}); end;
0035 if nargin>=5, a = scl_slope(a,varargin{5}); end;
0036 if nargin>=6, a = scl_inter(a,varargin{6}); end;
0037 
0038 a.pos = ones(size(a.dim));
0039 a     = class(a,'create_file_array');

Generated on Wed 29-Apr-2009 01:06:38 by m2html © 2005