function [b] = vipblkroidisplay(varargin) %#ok
% VIPBLKROIDISPLAY Mask dynamic dialog function for ROI Display block

% Copyright 2003-2006 The MathWorks, Inc.
% $Date: 2010/08/30 03:23:08 $ $Revision: 1.1.6.1 $

if nargin==0
    action = 'dynamic';   % mask callback
else
    action = 'icon';
end

blk = gcbh;

switch action
    case 'icon'
        b = get_labels(blk);

    case 'dynamic'
        % Execute dynamic dialogs
        mask_enables = get_param(blk,'maskenables');
        mask_visibilities = get_param(blk,'maskvisibilities');
        mask_visibilities{1} = 'on';
        mask_enables{1} = 'on';
        whichColor = get_param(blk, 'display');
        if strcmp(whichColor,'User-specified intensity')
            mask_visibilities{2} = 'on';
            mask_enables{2} = 'on';
        else
            mask_visibilities{2} = 'off';
            mask_enables{2} = 'off';
        end
        mask_visibilities{3} = 'on';
        mask_enables{3} = 'on';
        origSrc = get_param(blk, 'roiValSrc');
        if strcmp(origSrc,'Input port')
            mask_visibilities{4} = 'off';
            mask_enables{4} = 'off';
        else
            mask_visibilities{4} = 'on';
            mask_enables{4} = 'on';
        end
        set_param(blk,'maskenables',mask_enables, ...
            'maskvisibilities',mask_visibilities);
    otherwise
        error('vipblks:vipblkroidisplay:unhandledCase', 'unhandled case');
end


% ----------------------------------------------------------
function ports = get_labels(blk)
        ports.icon = 'ROI \nDisplay';
        origSrc = get_param(blk, 'roiValSrc');
        if (strcmp(origSrc,'Input port'))
            ports.iport1=1;
            ports.itxt1='I';
            ports.iport2=2;
            ports.itxt2='ROI';
        else
            ports.iport1=1;
            ports.itxt1='';
            ports.iport2=1;
            ports.itxt2='';
            ports.iport3=1;
            ports.itxt3='';
        end


        % end of vipblkroidisplay.m
