Home > marsbar > @maroi_box > maroi_box.m

maroi_box

PURPOSE ^

maroi_box - class constructor

SYNOPSIS ^

function o = maroi_box(params)

DESCRIPTION ^

 maroi_box - class constructor
 inputs [defaults]
  params  - a structure containing any fields for a maroi parent and
            .centre - a 1x3 coordinate in mm 
            .widths - 1x3 widths in X Y Z in mm

 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function o = maroi_box(params)
0002 % maroi_box - class constructor
0003 % inputs [defaults]
0004 %  params  - a structure containing any fields for a maroi parent and
0005 %            .centre - a 1x3 coordinate in mm
0006 %            .widths - 1x3 widths in X Y Z in mm
0007 %
0008 % $Id$
0009 
0010 myclass = 'maroi_box';
0011 defstruct = struct('centre', [0 0 0], 'widths', [0 0 0]);
0012 
0013 if nargin < 1
0014   params = [];
0015 end
0016 if isa(params, myclass)
0017   o = params;
0018   return
0019 end
0020 
0021 % fill with defaults
0022 pparams = mars_struct('ffillmerge', defstruct, params);
0023 
0024 % umbrella object, parse out fields for (this object and children)
0025 [uo, pparams] = maroi_shape(pparams);
0026 
0027 % reparse parameters into those for this object, children
0028 [pparams, others] = mars_struct('split', pparams, defstruct);
0029 
0030 % check resulting input
0031 if size(pparams.centre, 2) == 1
0032   pparams.centre = pparams.centre';
0033 end
0034 if size(pparams.widths, 2) == 1
0035   pparams.widths = pparams.widths';
0036 end
0037 if size(pparams.widths, 2) == 1
0038   pparams.widths = ones(1,3) * pparams.widths;
0039 end
0040 
0041 o = class(pparams, myclass, uo);
0042 return

Generated on Wed 11-May-2022 16:26:09 by m2html © 2003-2019