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