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