display_segmentation.m.svn-base

来自「fast marching method」· SVN-BASE 代码 · 共 51 行

SVN-BASE
51
字号
function display_segmentation(B,M)% display_segmentation - display a level set segmentation%%   display_segmentation(B,M);%%   B should be <0 inside the region of interest%   M is a background image%   %   See also: perform_active_contour%%   Copyright (c) 2007 Gabriel Peyreif min(B(:))>=0    if max(B(:))>2        % more that one phase        B = cat(3, B>2, mod(B,2) );    end    for k=1:size(B,3)        B(:,:,k) = rescale(B(:,:,k),-1,1);    endendnb_phase = size(B,3);n = size(B,1);M = rescale(M);if nb_phase==1    M1 = M;    M1(B<0) = M1(B<0)*.2;    M = cat(3,M,M1,M1);elseif nb_phase==2    % 2 phases    M1 = M; M2 = M;    M1(B(:,:,1)<0) = M1(B(:,:,1)<0)*.2;    M2(B(:,:,2)<0) = M2(B(:,:,2)<0)*.2;    M = cat(3,M,M1,M2);else    error('Only 1/2 phase accepted');endhold on;imagesc(M); axis image; axis off; axis([1 n 1 n]);for k=1:nb_phase    [c,h] = contour(B(:,:,k),[0 0], 'r');    set(h, 'LineWidth', 2);endhold off;colormap gray(256);axis ij;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?