ART算法——matlab实现

ART算法

算法描述

英文名称为Algebraic reconstruction technique:即代数重建算法

代数重建技术(ART)是一种用于计算机层析成像的迭代重建技术。它从一系列的角度投影(正弦图)中重建一幅图像。Gordon、Bender和Herman首次证明了它在图像重建中的应用。而这种方法被称为数值线性代数中的Kaczmarz方法。

相对于其他重建方法(如滤波反投影),ART的一个优点是,将先验知识(已知的约束条件)纳入重建过程是相对容易的。

该算法的实质是用迭代法求解线性方程组的解,我们将该方程表示为: A x = b Ax = b

代码如下:

function [ X, k ] = ART_0( A, b, X0, e0)
%ART_0:to solve linear equation Ax = b
%Input  -  A: the coefficient matrix (matrix's size is nxn)
%       -  b: the constant term(n-dimensions vector)
%       - X0: the inital point of iteration
%       -  e0: the termination condition of iteration
%Output -  X: the solution of the linear equation(n-dimensions vector)
%       -  k: the times of itation
n = length(b);
X = X0;
k = 0;
e = 2;
while (norm(e)>e0)
    for i = 1:n
        unitLen = norm(A(i,:));
        d = (b(i)-A(i,:)*X)/unitLen;
        Xf = X;
        X = X+(d.*(A(i,:)./unitLen))';
        e = norm(Xf-X);
    end
    k = k+1;
end
end

检验

输入参数:
A = [ 3 1 1 5 ] A = \left[\begin{matrix}3&1\\1&5\end{matrix} \right]

b = ( 1 1 ) b = \left(\begin{matrix}1\\1\end{matrix}\right)

e0 = eps及 X 0 = ( 0 0 ) X0 = \left(\begin{matrix}0\\0\end{matrix}\right)

结果如下:
在这里插入图片描述

可视化

我们想得到这个方程求解释的运行路径

clear; clc
%% 参数
A = [3 1;1 5];
b = [1;1];
X0 = [0;0];
e0 = eps;
%% 作直线图
figure(1)
X1 = linspace(0.1,0.6);
Y1 = -3.*X1+1;
plot(X1,Y1,'r')
hold on
X2 = X1;
Y2 = (-X2+ones(size(X2)))./5;
plot(X2,Y2,'b')
%% ART
n = length(b);
X = X0;
k = 0;
e = 2;
Xp = zeros(2,100);
while (norm(e)>e0)
    for i = 1:n
        unitLen = norm(A(i,:));
        d = (b(i)-A(i,:)*X)/unitLen;
        Xf = X;
        X = X+(d.*(A(i,:)./unitLen))';
        e = norm(Xf-X);
        Xp(1,:) = linspace(Xf(1),X(1));
        Xp(2,:) = linspace(Xf(2),X(2));
        plot(Xp(1,:),Xp(2,:),'g')
    end
    k = k+1;
end

结果如下:
在这里插入图片描述
在这里插入图片描述
我们发现这个垂直的形态并不明显,经过学姐的指正,原来是横竖两个轴的单位长度不一致导致的。我需要加上一个命令:axis equal

经过修改后图像如下:
在这里插入图片描述
放大很多倍后:
在这里插入图片描述

发布了31 篇原创文章 · 获赞 6 · 访问量 2803

猜你喜欢

转载自blog.csdn.net/weixin_29732003/article/details/103326926
今日推荐