SHOW_COMBINED_MODEL: Shows the combined model for each one of the modes. Code written by Katherine Smith, 2003 GENERAL show_combined_model(combined_model, ref_points_vec, n_sds, max_modes, title) INPUT/S -combined_model: The combined model to be shown. -ref_points_vec: Vector of reference points. -n_sds: Number of standard deviations to be displayed. -max_modes: Maximum number of modes? -title: A title for the figure to be displayed. OUTPUT/S -model_handle: The figure handle 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_SHAPE_MODEL ABOUT -Created: November 23rd, 2003 -Last update: March 18th, 2004 -Revision: 0.0.5 -Author: R. S. Schestowitz, University of Manchester ==============================================================
0001 function model_handle = show_combined_model(combined_model, ref_points_vec, n_sds, max_modes, title, image_width) 0002 % SHOW_COMBINED_MODEL: Shows the combined model for each one of the modes. 0003 % 0004 % Code written by Katherine Smith, 2003 0005 % 0006 % GENERAL 0007 % 0008 % show_combined_model(combined_model, ref_points_vec, n_sds, max_modes, title) 0009 % 0010 % INPUT/S 0011 % 0012 % -combined_model: 0013 % The combined model to be shown. 0014 % 0015 % -ref_points_vec: 0016 % Vector of reference points. 0017 % 0018 % -n_sds: 0019 % Number of standard deviations to be displayed. 0020 % 0021 % -max_modes: 0022 % Maximum number of modes? 0023 % 0024 % -title: 0025 % A title for the figure to be displayed. 0026 % 0027 % 0028 % OUTPUT/S 0029 % 0030 % -model_handle: 0031 % The figure handle 0032 % 0033 % PENDING WORK 0034 % 0035 % - 0036 % 0037 % KNOWN BUG/S 0038 % 0039 % -None. 0040 % 0041 % COMMENT/S 0042 % 0043 % -Number of standard variation input seems to contol the number of 0044 % figures shown. For 3, it will generate it for -3,-2,-1,-,1,2,3. 0045 % 0046 % RELATED FUNCTION/S 0047 % 0048 % SHOW_INTENSITY_MODEL, SHOW_SHAPE_MODEL 0049 % 0050 % ABOUT 0051 % 0052 % -Created: November 23rd, 2003 0053 % -Last update: March 18th, 2004 0054 % -Revision: 0.0.5 0055 % -Author: R. S. Schestowitz, University of Manchester 0056 % ============================================================== 0057 0058 % visualise combined model 0059 % intensities = intensity_mean + intensity_pcs * intensity_combined_pcs * combined_params 0060 % - gives shape free image 0061 % shape = shape_mean + shape_pcs * shapeweight^-1 * shape_combined_pcs * combined_params 0062 % - warp the shape free image to get the final image 0063 0064 shape_model = combined_model.shape_model; 0065 % get shape model from the combined model 0066 intensity_model = combined_model.intensity_model; 0067 % get intensity model from the combined model 0068 shapeweight = repmat(combined_model.shape_weight, size(shape_model.pcs,1),1); 0069 % get the weight W of the shape. 0070 n_modes = min(size(combined_model.pcs,2),max_modes); 0071 % get maximum modes UNLESS less than asked for 0072 % are available in the model. 0073 n_shape_modes = size(shape_model.pcs,2); 0074 % Get number of shape model modes. 0075 fig = figure('Name',([title])); 0076 % name the figure according to the input 0077 0078 figure_handle = figure(fig); 0079 hold on; 0080 0081 for m=1:n_modes, 0082 for index = -n_sds:n_sds, 0083 % for all the modes and all the standard deviation range 0084 % (see related function for similarity in code) 0085 example_shape_params = zeros(1,1); 0086 example_intensity_params = zeros(1,1); 0087 % set shape and intesity parameters to 0 0088 params = zeros(1,size(combined_model.params,2)); 0089 % set all parameters to 0 0090 params(m) = index * combined_model.sd(1,m); 0091 % CODE WAS MODIFIED HERE 0092 0093 example = construct_model_example(params, combined_model, ref_points_vec); 0094 % construct example from the combined model 0095 % with mode set to appropriate deviation 0096 % figure(fig),subplot(1,n_sds*2+1,i+n_sds+1),plot(example),axis([0 50 0 1.2]); 0097 0098 subplot(n_modes, n_sds * 2 + 1, (m - 1) * (n_sds * 2 + 1) + index + n_sds + 1); 0099 plot(example); 0100 axis([0 image_width -1 1.4]); 0101 % and display that example 0102 0103 end 0104 end 0105 text(1,1,'Combined Model'); 0106 hold off; 0107 model_handle = figure(figure_handle);