function [c_pcs, c_variances, c_params, c_mean, c_total_var, c_impdata] = ...
  make_combined_model(shape_model, intensity_model, shape_weight);
% MAKE_COMBINED_MODEL: Creates a combined model of shape and intensity
%                      using principal component analysis.
%
% Code written by Katherine Smith, 2003
%
%    GENERAL
%
%      [c_pcs, c_variances, c_params, c_mean, c_total_var, c_impdata] =
%         make_combined_model(shape_model, intensity_model, shape_weight);
%
%    INPUT/S
%
%      -shape_model:
%           The shape model for the combined model.
%
%      -intensity_model:
%           The intensity model for the combined model.
%
%      -shape_weight:
%           The weight W assigned to shape in the aggregation.
%           
%    OUTPUT/S
%
%      -c_pcs:
%
%      -c_variances:
%
%      -c_params:
%
%      -c_mean:
%
%      -c_total_var:
%
%      -c_impdata:
%
%    PENDING WORK
%
%      -Complete the meaning of the outputs. See st_pca for details.
%
%    KNOWN BUG/S
%
%      -None.
%
%    COMMENT/S
%
%      -
%
%    RELATED FUNCTION/S
%
%      SHOW_SHAPE_MODEL, SHOW_INTENSITY_MODEL, SHOW_COMBINED_MODEL, ST_PCA
%
%    ABOUT
%
%      -Created:     November 23rd, 2003
%      -Last update: Novermber 27th, 2003
%      -Revision:    0.0.2
%      -Author:      R. S. Schestowitz, University of Manchester
% ==============================================================

shape_weight = repmat(shape_weight, size(shape_model.params,1),1);
               % create weighing vector as long as the shape model paramaters
weighted_shape_params = shape_model.params .* shape_weight; 
               % apply some weighing
%weighted_shape_params = shape_params .* repmat(shape_weight,size(shape_params,1),1);
combined_data = [weighted_shape_params intensity_model.params]; 
               % append weight and intensity (aggregate)
[c_pcs,c_variances,c_params, c_mean, c_total_var, c_impdata] = st_pca(combined_data, 0.999999); 
               % use principal component analysis to get outputs