资源简介

PCA实现图像分类,论文+代码+测试/训练样品,华工出品,必属精品。

资源截图

代码片段和文件信息

function [distanceLdistanceGLogLikelihood]=apply_model(TLmeanGmeanCgppcainvCgppcaVtot)
% This function Apply_Model uses the matrices and means from train_model.m
% to calculate the mahalanobis distance to global and local feature
% training data set which are combined to a log Likelihood ratio.
%
% [distanceLdistanceGLogLikelihood]=apply_model(TLmeanGmeanCgppca invCgppcaVtot)
%
% inputs
%   T: Matrix with all feature vectors from the test data  first 
%           feature vector T(:1)
%   G: Matrix with all feature vectors from the global (not) training data
% inputs (from train_model.m)
%   Lmean : The mean of the local feature vectors
%   Gmean : The mean of the global feature vectors
%   Cgppca : Covariance matrix after 3 PCA steps
%   invCgppca : Inverse Covariance matrix after 3 PCA steps
%   Vtot : The Rotation matrix of the 3 PCA steps% outputs
%
% outputs
%   distanceL : The distance to the local training data set
%   distanceG : The distance to the global training data set
%   LogLikelihood : The log likelihood of test feature vector to belong to 
%                   the local set.
%
%  In the 3 PCA steps the feature vectors are rotated in a way that 
%  the Mahalanobis distance to the local set can be deteremined by 
%  FeatureA‘*FeatureA and to the global set by FeatureA‘*invCgppca*FeatureA.
%  FeatureA is the mean substracted and rotated FeatureVector of a certain
%  test (image/coordinate).
%
% Literature : Kroon D.J. and van Oort E.S.B. and Slump C.H. “Multiple 
% Sclerosis Detection in Multispectral Magnetic Resonance Images with 
% Principal Components Analysis“
%
% Function is written by D.Kroon University of Twente (July 2009)

distanceL=zeros(1size(T2));
distanceG=zeros(1size(T2));
for i=1:size(T2)
    u=Vtot‘*(T(:i)-Gmean);
    v=Vtot‘*(T(:i)-Lmean);
    distanceG(i)=(u‘*invCgppca*u);
    distanceL(i)=(v‘*v);
end
offset=log(det(Cgppca));
LogLikelihood=0.5*(distanceG-distanceL)+0.5*offset;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        2019  2009-07-21 20:18  PCA_classifier_version1b\apply_model.m
     文件        4801  2010-02-11 20:01  PCA_classifier_version1b\example_classifier_ms.m
     文件        3692  2009-07-21 20:02  PCA_classifier_version1b\get_feature_vectors.c
     文件         542  2009-07-21 18:50  PCA_classifier_version1b\get_feature_vectors.m
     文件      742746  2008-08-13 18:05  PCA_classifier_version1b\Literature\MICCAI_MS_Challenge_UTwente_Final.pdf
     文件       42372  2009-07-21 20:47  PCA_classifier_version1b\TestData\patient3_FLAIR.png
     文件       51434  2009-07-21 17:26  PCA_classifier_version1b\TestData\patient3_T1.png
     文件       84151  2009-07-21 17:27  PCA_classifier_version1b\TestData\patient3_T2.png
     文件        3865  2010-02-11 19:56  PCA_classifier_version1b\train_model.m
     文件       69519  2009-07-21 17:09  PCA_classifier_version1b\TrainingData\patient1_FLAIR.png
     文件         739  2009-07-21 17:22  PCA_classifier_version1b\TrainingData\patient1_lesion.png
     文件       70981  2009-07-21 17:21  PCA_classifier_version1b\TrainingData\patient1_T1.png
     文件       82651  2009-07-21 17:22  PCA_classifier_version1b\TrainingData\patient1_T2.png
     文件       60989  2009-07-21 20:48  PCA_classifier_version1b\TrainingData\patient2_FLAIR.png
     文件         577  2009-07-21 17:25  PCA_classifier_version1b\TrainingData\patient2_lesion.png
     文件       68764  2009-07-21 17:24  PCA_classifier_version1b\TrainingData\patient2_T1.png
     文件       82603  2009-07-21 17:25  PCA_classifier_version1b\TrainingData\patient2_T2.png
     文件        1314  2014-02-12 13:04  license.txt

评论

共有 条评论