You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: display_segmentation.m
    path of file: ./repos/gptoolbox/external/toolbox_fast_marching
    
    the code of the file until where you have to start completion: 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
%   

    
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 Peyre

if min(B(:))>=0
    if max(B(:))>2
        % more that one phase
        B = cat(3, B>2, mod(B,2) );
    end