欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

基于matlab对比度和结构提取的多模态解剖图像融合实现

程序员文章站 2022-04-29 10:49:42
目录一、图像融合简介二、部分源代码三、运行结果四、matlab版本一、图像融合简介应用多模态图像的配准与融合技术,可以把不同状态的医学图像有机地结合起来,为临床诊断和治疗提供更丰富的信息。介绍了多模态...

一、图像融合简介

应用多模态图像的配准与融合技术,可以把不同状态的医学图像有机地结合起来,为临床诊断和治疗提供更丰富的信息。介绍了多模态医学图像配准与融合的概念、方法及意义。最后简单介绍了小波变换分析方法。

二、部分源代码

clear; close all; clc; warning off
%% a novel multi-modality anatomical image fusionmethod based on contrast and structure extraction
% f = fuseimage(i,scale)

%inputs:
%i - a mulyi-modal anatomical image sequence

%scale - scale factor of dense sift, the default value is 16

%% load images from the folder that contain multi-modal image to be fused
%i=load_images('./dataset\ct-mri\pair 1');
i=load_images('./dataset\mr-t1-mr-t2\pair 1');
%i=load_images('./dataset\mr-gad-mr-t1\pair 1');
% show source input images 
figure;
no_of_images = size(i,4);
for i = 1:no_of_images
    subplot(2,1,i); imshow(i(:,:,:,i));
end
suptitle('source images');


%%
f=fuseimage(i,16);
%% output: f - the fused image

f=rgb2gray(f);
figure;
imshow(f);
function [ f ] = fuseimage(i,scale)


addpath('pyramid_decomposition');
addpath('guided_filter');
addpath('dense_sift');

tic
%%
[h, w, c, n]=size(i);
imgs=im2double(i);
ia=zeros(h,w,c,n);
for i=1:n
ia(:,:,:,i)=enhnc(imgs(:,:,:,i));

end
%%
imgs_gray=zeros(h,w,n);
for i=1:n
    imgs_gray(:,:,i)=rgb2gray(ia(:,:,:,i));
end
%
% %dense sift calculation
dsifts=zeros(h,w,32,n, 'single');
for i=1:n
    img=imgs_gray(:,:,i);
    ext_img=img_extend(img,scale/2-1);
    [dsifts(:,:,:,i)] = densesift(ext_img, scale, 1);
    
end
%%
%local contrast
contrast_map=zeros(h,w,n);
for i=1:n
    contrast_map(:,:,i)=sum(dsifts(:,:,:,i),3);

end


%winner-take-all weighted average strategy for local contrast

[x, labels]=max(contrast_map,[],3);
clear x;
for i=1:n
    mono=zeros(h,w);
    mono(labels==i)=1;
    contrast_map(:,:,i)=mono;

end



%% structure 
h = [1 -1];
structure_map=zeros(h,w,n);

for i=1:n
structure_map(:,:,i) = abs(conv2(imgs_gray(:,:,i),h,'same')) + abs(conv2(imgs_gray(:,:,i),h','same')); %eq 13

   
end


%winner-take-all weighted average strategy for structure

[a, label]=max(structure_map,[],3);
clear x;
for i=1:n
    monoo=zeros(h,w);
    monoo(label==i)=1;
    structure_map(:,:,i)=monoo;
     
end

%%
weight_map=structure_map.*contrast_map;




%weight map refinement using guided filter
for i=1:n
    
    weight_map(:,:,i) = fastgf(weight_map(:,:,i),12,0.25,2.5);
 
end



% normalizing weight maps
%
weight_map = weight_map + 10^-25; %avoids division by zero
weight_map = weight_map./repmat(sum(weight_map,3),[1 1 n]);

%% pyramid decomposition

% create empty pyramid
pyr = gaussian_pyramid(zeros(h,w,3));
nlev = length(pyr);

% multiresolution blending
for i = 1:n
    % construct pyramid from each input image
   
    % blend
    for b = 1:nlev
        w = repmat(pyrw{b},[1 1 3]);
        
        pyr{b} = pyr{b} + w .*pyri{b};
    end
    
end

% reconstruct
f = reconstruct_laplacian_pyramid(pyr);

toc

end


三、运行结果

基于matlab对比度和结构提取的多模态解剖图像融合实现

基于matlab对比度和结构提取的多模态解剖图像融合实现

四、matlab版本

matlab版本

2014a

以上就是基于matlab对比度和结构提取的多模态解剖图像融合实现的详细内容,更多关于matlab  多模态解剖图像融合的资料请关注其它相关文章!