============================================================== COMPUTE_PDF: GENERAL pdf_values = compute_pdf(image_set, points_set, keep, label, norm_type, shape_weight) INPUT/S OUTPUT/S -pdf_values: PENDING WORK - KNOWN BUG/S -None. COMMENT/S RELATED FUNCTION/S ABOUT -Created: February 2004 -Last update: February 2004 -Revision: 0.0.1 -Author: R. S. Schestowitz, University of Manchester ==============================================================
0001 function pdf_values = compute_pdf(image_set, points_set, kernel, shape_weight) 0002 % ============================================================== 0003 % COMPUTE_PDF: 0004 % 0005 % GENERAL 0006 % 0007 % pdf_values = compute_pdf(image_set, points_set, keep, label, norm_type, shape_weight) 0008 % 0009 % INPUT/S 0010 % 0011 % 0012 % 0013 % OUTPUT/S 0014 % 0015 % -pdf_values: 0016 % 0017 % PENDING WORK 0018 % 0019 % - 0020 % 0021 % KNOWN BUG/S 0022 % 0023 % -None. 0024 % 0025 % COMMENT/S 0026 % 0027 % 0028 % RELATED FUNCTION/S 0029 % 0030 % 0031 % 0032 % ABOUT 0033 % 0034 % -Created: February 2004 0035 % -Last update: February 2004 0036 % -Revision: 0.0.1 0037 % -Author: R. S. Schestowitz, University of Manchester 0038 % ============================================================== 0039 0040 % [intensity_model.pcs,intensity_model.variances,intensity_model.params, intensity_model.mean, intensity_model.var_r, intensity_model.total_var, intensity_model.impdata] = st_pca(image_set', keep); 0041 % [shape_model.pcs,shape_model.variances,shape_model.params, shape_model.mean, shape_model.var_r, shape_model.total_var, shape_model.impdata] = st_pca(points_set', keep); 0042 % % get shape and intensity model 0043 % c_model.shape_weight = ones(1,size(shape_model.pcs,2)); 0044 % % set weight to be a column vector of 1's? Would that mean equal weighing for shape and intensity? 0045 % intensity_model.sd = std(intensity_model.params); 0046 % % get and record standard deviation 0047 % shape_model.sd = std(shape_model.params); 0048 % if(strcmp(norm_type,'variance')) 0049 % % combine params - initially normalise to variance described in model 0050 % total_shape_variance = sum(shape_model.variances); 0051 % total_intensity_variance = sum(intensity_model.variances); 0052 % if(total_shape_variance ~= 0) 0053 % c_model.shape_weight(:) = sqrt(total_intensity_variance/total_shape_variance); 0054 % end 0055 % % disp(['Shapeweight: ',num2str(c_model.shape_weight(1))]); 0056 for i = 1:size(image_set,2), 0057 current_intensity_sample = image_set(:,i); 0058 % paramater used to be 1 and passed in as a single parameter to pdf 0059 % function 0060 if (strcmp(kernel,'Normal')), 0061 parameter = mle(kernel,current_intensity_sample); 0062 pdf_values(i,:) = pdf(kernel, current_intensity_sample, parameter(1), parameter(2))'; 0063 elseif (strcmp(kernel,'Exponential')), 0064 parameter = 1; 0065 % this is an arbitrary useless value that needs to be 0066 % tested 0067 pdf_values(i,:) = pdf(kernel, current_intensity_sample, parameter)'; 0068 % EXTENSIONS NEED TO BE PLACED HERE UNDER <ELSEIF> STATEMENTS 0069 else 0070 parameter = 1; 0071 % this is just a generic expression that makes sure all 0072 % kernels work. 0073 pdf_values(i,:) = pdf(kernel, current_intensity_sample, parameter)'; 0074 end 0075 end 0076 % c_model.shape_weight(:) = shape_weight; 0077 % elseif(strcmp(norm_type,'edge')) 0078 % edges = abs(diff(image_set,1,2)); 0079 % mean_edge_strength = sum(edges(:))/size(edges(:),1); 0080 % c_model.shape_weight(:) = mean_edge_strength; 0081 % % disp(['edge weight: ',num2str(mean_edge_strength)]); 0082 % 0083 % [c_model.pcs, c_model.variances, c_model.params, c_model.mean, c_model.total_var, c_model.impdata] = make_combined_model(shape_model, intensity_model, c_model.shape_weight); 0084 % c_model.sd = sqrt(c_model.variances); 0085 % c_model.intensity_model = intensity_model; 0086 % 0087 % % intensity_model 0088 % % shape_model 0089 % % figure; 0090 % % plot(intensity_model); 0091 % % attempt to look at the models built from the data (RSS) 0092 % 0093 % c_model.shape_model = shape_model; 0094 % c_model.n_shape_modes = size(shape_model.sd,2); 0095 % c_model.label = label; 0096 % % save some of the values to be returned by the function