============================================================== SHOW_SHAPE_MODEL: Shows the shape model for each one of the modes. Code written by Katherine Smith, 2003 GENERAL show_shape_model(shape_model, ref_points_vec, ref_images_vec, n_sds) INPUT/S -shape_model: The shape model to be shown. -ref_points_vec: Vector of reference points. -ref_images_vec: Vector of reference images. -n_sds: Number of standard deviations to be shown? OUTPUT/S -None. PENDING WORK - KNOWN BUG/S -None. COMMENT/S -Number of standard variation input seems to contol the number of figures shown. For 3, it will generate it for -3,-2,-1,-,1,2,3. RELATED FUNCTION/S SHOW_INTENSITY_MODEL, SHOW_COMBINED_MODEL ABOUT -Created: November 23rd, 2003 -Last update: Novermber 26th, 2003 -Revision: 0.0.2 -Author: R. S. Schestowitz, University of Manchester ==============================================================
0001 function figure_handle = show_shape_model(shape_model, ref_points_vec, ref_images_vec, n_sds, image_width) 0002 % ============================================================== 0003 % SHOW_SHAPE_MODEL: Shows the shape model for each one of the modes. 0004 % 0005 % Code written by Katherine Smith, 2003 0006 % 0007 % GENERAL 0008 % 0009 % show_shape_model(shape_model, ref_points_vec, ref_images_vec, n_sds) 0010 % 0011 % INPUT/S 0012 % 0013 % -shape_model: 0014 % The shape model to be shown. 0015 % 0016 % -ref_points_vec: 0017 % Vector of reference points. 0018 % 0019 % -ref_images_vec: 0020 % Vector of reference images. 0021 % 0022 % -n_sds: 0023 % Number of standard deviations to be shown? 0024 % 0025 % 0026 % OUTPUT/S 0027 % 0028 % -None. 0029 % 0030 % PENDING WORK 0031 % 0032 % - 0033 % 0034 % KNOWN BUG/S 0035 % 0036 % -None. 0037 % 0038 % COMMENT/S 0039 % 0040 % -Number of standard variation input seems to contol the number of 0041 % figures shown. For 3, it will generate it for -3,-2,-1,-,1,2,3. 0042 % 0043 % RELATED FUNCTION/S 0044 % 0045 % SHOW_INTENSITY_MODEL, SHOW_COMBINED_MODEL 0046 % 0047 % ABOUT 0048 % 0049 % -Created: November 23rd, 2003 0050 % -Last update: Novermber 26th, 2003 0051 % -Revision: 0.0.2 0052 % -Author: R. S. Schestowitz, University of Manchester 0053 % ============================================================== 0054 0055 n_modes = size(shape_model.pcs,2); 0056 % get the number of modes 0057 fig = figure('Name',(['Shape Model'])); 0058 figure_handle = figure(fig); 0059 0060 for m=1:n_modes 0061 for i=-n_sds:n_sds 0062 % Smith: what are the parameters corresponding to this sd 0063 % create example with these parameters 0064 % RSS: it seems like it shows in a figure the deviations from either side 0065 % in the range of parameters 0066 example_params = repmat(i*shape_model.sd(1,m),size(shape_model.pcs,1),1); 0067 % get the parameters by extracting the mode of variation from 0068 % the model. 0069 example_points = example_params.*shape_model.pcs(:,m) + shape_model.mean'; 0070 % get the points with the modes of variation applies to the mean 0071 example = interp1(ref_points_vec, ref_images_vec, example_points); 0072 % interpolate in 1-D 0073 figure(fig); 0074 % subplot(1,n_sds*2+1,i+n_sds+1); 0075 subplot( n_modes, n_sds * 2 + 1, (m - 1) * (n_sds * 2 + 1) + i + n_sds + 1); 0076 plot(example); 0077 axis([0 image_width -0.3 1]); 0078 if (m == 1 & i ==1), 0079 text(1,1,'Shape Model'); 0080 end 0081 % plot figures for that mode. For m modes of varation and n standard 0082 % deviations, (2*n+1) * m figures will be shown in total?? 0083 end 0084 end