本文程序是根据论文"Xu Z. Medical image fusion using multi-level local extrema[J]. Information Fusion, 2014, 19: 38-48."编写的,其中用到的提取局部极值平滑滤波的程序是论文"Subr K, Soler C, Durand F. Edge-preserving multiscale image decomposition based on local extrema[C]//ACM Transactions on Graphics (TOG). ACM, 2009, 28(5): 147."提供的,但是论文提供的代码只能处理3通道图像,为了方便,修改了一下,改成了只处理1通道灰度图的处理程序。
医学图像融合程序为:
%% Xu Z. Medical image fusion using multi-level local extrema[J]. Information Fusion, 2014, 19: 38-48.
%% Fusion matlab code
clear all;
path_A = '..\Medical Images\source1_1.tif'; path_B = '..\Medical Images\source1_2.tif';
% path_A = '..\Medical Images\source2_1.tif'; path_B = '..\Medical Images\source2_2.tif';
img1 = double(imread(path_A))/255.0;
img2 = double(imread(path_B))/255.0;
if(size(img1,3)~=1)
img1=rgb2gray(img1);
end
if(size(img2,3)~=1)
img2=rgb2gray(img2);
end
%% ---------- LocalExtrema Decomposition --------------
nLevel = 4;
M1=zeros(size(img1));
C1 = cell(1, nLevel);
D1 = cell(1, nLevel);
d1 = cell(1,nLevel);
for L = 1:nLevel,
k=2*L+1;
C1{L}=localExtrema(img1,k);
D1{L} = img1 - C1{L};
M1=M1+C1{L};
if L==nLevel
M1=M1/nLevel;