Home > Source > Model > show_combined_model.m

show_combined_model

PURPOSE ^

==============================================================

SYNOPSIS ^

function model_handle = show_combined_model(combined_model, ref_points_vec, n_sds, max_modes, title, image_width)

DESCRIPTION ^

 ==============================================================
 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
 ==============================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

Generated on Thu 13-May-2004 18:00:46 by m2html © 2003