0001 function num = num_nodes( mdl );
0002
0003
0004
0005
0006
0007 if ischar(mdl) && strcmp(mdl,'UNIT_TEST'); do_unit_test; return; end
0008
0009 switch mdl.type
0010 case 'image'; fmdl = mdl.fwd_model;
0011 case 'inv_model'; fmdl = mdl.fwd_model;
0012 case 'fwd_model'; fmdl = mdl;
0013 otherwise;
0014 error('can''t process model of type %s', mdl.type );
0015 end
0016
0017 num = size(fmdl.nodes,1);
0018
0019 function do_unit_test
0020 mdl = mk_common_model('a2c2',8);
0021 ne = num_nodes( mdl );
0022 unit_test_cmp('test1',ne,41);
0023
0024 ne = num_nodes( mdl.fwd_model );
0025 unit_test_cmp('test2',ne,41);
0026
0027 ne = num_nodes( mk_image( mdl ));
0028 unit_test_cmp('test3',ne,41);
0029
0030 mdl = mk_common_model('n3r2',[16,2]);
0031 ne = num_nodes( mk_image( mdl ));
0032 unit_test_cmp('test4',ne,252);