【三维光流估计】基于三维光流估计算法的医学器官运动估计

1.软件版本

matlab2013b

2.本算法理论知识

 

 

 

 

 

3.部分源码

clc;
clear;
close all;
warning off;
 
tic;

len    = 76;
sizes  = 128;          %图片缩小比例,越小处理速度越快。由于3D图非常耗资源,所以得小点。。
areas  = min(64,sizes);%光流场计算范围缩放
sel    = 1;%是否显示原三维图

%1.读取图像数据
%1.读取图像数据
for pp = 1:10
    pp
    %读取连续的图片
    if pp  <= 9
       str1 = ['CT_PIC\Export000',num2str(pp),'\SR0000']
       str2 = ['CT_PIC\Export000',num2str(pp),'\SR0000\*.jpg']
    else
       str1 = ['CT_PIC\Export00',num2str(pp),'\SR0000']
       str2 = ['CT_PIC\Export00',num2str(pp),'\SR0000\*.jpg']    
    end
    folder     = str1;
    list       = dir(str2);
    I2         = func_read_serial_pic(folder,list,len,sizes);
    
    for i = 1:length(I2)
        D(:,:,i) = I2{i};
    end  
    Images{pp} = D;
end     
  
%显示三维图像
for pp = 1:10
   [x,y,z,D] = reducevolume(Images{pp},[1,1,1]);
   D = smooth3(D);
   if sel == 1
      figure;
      p  = patch(isosurface(x,y,z,D, 1,'verbose'), 'FaceColor', 'red', 'EdgeColor', 'none');
      p2 = patch(isocaps(x,y,z,D, 5), 'FaceColor', 'interp', 'EdgeColor', 'none');
      view(3); 
      axis square;  
      daspect([1 1 .4])
      colormap(gray(100))
      camlight; 
      lighting gouraud
      isonormals(x,y,z,D,p2);    
   end
   pause(0.01); 
end     
     
%2计算光流场
%2计算光流场
for i = 2:10
   [u,v,w]=func_cal_demons(Images{i-1},Images{i},1);
   U{i-1} = u;
   V{i-1} = v;
   W{i-1} = w;
end   

%显示三维光流场
step = 4;
[x,y,z]    = meshgrid(1:step:sizes,1:step:sizes,1:len);
 
for k = 1:9
    figure(20);
    for j = [10,20,30,40,50,60,70]%设置这个参数,可以减少或增加显示的数目,方便观察
        quiver3(x(:,:,j),y(:,:,j),z(:,:,j),U{k}(1:step:sizes,1:step:sizes,j),V{k}(1:step:sizes,1:step:sizes,j),W{k}(1:step:sizes,1:step:sizes,j));
        axis([0,sizes,0,sizes,-5,80]);
        hold on
    end
    hold off
    pause(1);
end 


%3数据输出
%注意,MATLAB可将图像直接保存为ascii数据,然后你在Tecplot中进行调用

%4.计算时间统计分析
toc;

%5.释放存储空间,退出程序,这个步骤注释掉,方便观察每个步骤产生的数据;
%clc;
%clear all;

4.仿真结论

生成立体的心脏图片,其仿真结果如下所示:

通过仿真,可以得到如下的三维光流图:

5.参考文献

[1]基于冠状动脉造影图像序列的心脏及血管运动估计的研究.  2004.A09-27

猜你喜欢

转载自blog.csdn.net/ccsss22/article/details/124958572