Home > marsbar > @mardo_5 > mardo_5.m

mardo_5

PURPOSE ^

class constructor for SPM5 MarsBaR design object

SYNOPSIS ^

function [o, others] = mardo_5(params, others, varargin)

DESCRIPTION ^

 class constructor for SPM5 MarsBaR design object
 FORMAT [o, others] = mardo_5(params, others, varargin)
 Inputs
 params  - structure,containing fields, or SPM/MarsBaR design
 others  - structure, containing other fields to define

 Outputs
 o       - mardo_5 object (unless disowned)
 others  - any unrecognized fields from params, for processing by
           children

 This object is called from the mardo object contructor
 with a mardo object as input.  mardo_5 checks to see
 if the contained design is an SPM5 design, returns
 the object unchanged if not.  If it is an SPM5
 design, it claims ownership of the passed object.

 The constructor can also be called to give class functions, where the
 name of the class function is a character string which is one of:
    'spm_filter' - applies spm_filter routine to passed args
 
 $Id: mardo_5.m 607 2006-03-30 20:54:55Z matthewbrett $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [o, others] = mardo_5(params, others, varargin)
0002 % class constructor for SPM5 MarsBaR design object
0003 % FORMAT [o, others] = mardo_5(params, others, varargin)
0004 % Inputs
0005 % params  - structure,containing fields, or SPM/MarsBaR design
0006 % others  - structure, containing other fields to define
0007 %
0008 % Outputs
0009 % o       - mardo_5 object (unless disowned)
0010 % others  - any unrecognized fields from params, for processing by
0011 %           children
0012 %
0013 % This object is called from the mardo object contructor
0014 % with a mardo object as input.  mardo_5 checks to see
0015 % if the contained design is an SPM5 design, returns
0016 % the object unchanged if not.  If it is an SPM5
0017 % design, it claims ownership of the passed object.
0018 %
0019 % The constructor can also be called to give class functions, where the
0020 % name of the class function is a character string which is one of:
0021 %    'spm_filter' - applies spm_filter routine to passed args
0022 %
0023 % $Id: mardo_5.m 607 2006-03-30 20:54:55Z matthewbrett $
0024 
0025 myclass = 'mardo_5';
0026 cvs_v   = marsbar('ver'); % was CVS version; now marsbar version
0027 
0028 % Default object structure
0029 defstruct = [];
0030 
0031 if nargin < 1
0032   defstruct.cvs_version = cvs_v;
0033   o = class(defstruct, myclass, mardo_2);
0034   others = [];
0035   return
0036 end
0037 if nargin < 2
0038   others = [];
0039 end
0040 
0041 % parse out string action calls (class functions)
0042 if ischar(params)
0043   switch params
0044    case 'spm_filter'
0045     if nargin < 2
0046       error('Need filter');
0047     elseif nargin < 3
0048       o = pr_spm_filter(others);
0049     else
0050       o = pr_spm_filter(others, varargin{1});
0051     end
0052     return
0053   otherwise
0054     error(sprintf('Is "%s" a filename? Use ``mardo`` to load from files',...
0055             params));
0056   end
0057 end
0058     
0059 % Deal with passed objects of this (or child) class
0060 if isa(params, myclass)
0061   o = params;
0062   % Check for simple form of call
0063   if isempty(others), return, end
0064 
0065   % Otherwise, we are being asked to set fields of object
0066   % (Moot at the moment, as there are no fields specific for this object)
0067   [p others] = mars_struct('split', others, defstruct);
0068   return
0069 end
0070 
0071 % normal call is via mardo constructor
0072 if isa(params, 'mardo')
0073   % Check to see if this is a suitable design, return if not
0074   des = des_struct(params);
0075   if ~my_design(des), o = params; return, end
0076   % own, by making mardo_2 object for design
0077   [uo others] = mardo_2(params, others, 1);
0078   params = [];
0079 else
0080   uo = [];
0081 end
0082 
0083 if ~isa(uo, 'mardo') % mardo object not passed
0084   % umbrella object, parse out fields for (this object and children)
0085   % third argument of 0 prevents recursive call back to here
0086   [uo, params] = mardo_2(params, others, 0);
0087 else
0088   % fill params with other parameters
0089   params = mars_struct('ffillmerge', params, others);
0090 end  
0091 
0092 % parse parameters into those for this object, children
0093 [params, others] = mars_struct('ffillsplit', defstruct, params);
0094 
0095 % add cvs tag
0096 params.cvs_version = cvs_v;
0097 
0098 % set the mardo object
0099 o  = class(params, myclass, uo);
0100 
0101 % convert vols to current format
0102 o = convert_vols(o);
0103 
0104 return

Generated on Thu 17-Mar-2016 01:14:46 by m2html © 2005