function dout=roicolor(a,low,high)
%ROICOLOR Define region of interest (ROI) by color.
%	BW = ROICOLOR(X,LOW,HIGH) returns the region of interest as the
%	binary matrix BW.  BW will contain 1's where the values in
%	X are between LOW and HIGH and zeros everywhere else.
%	  BW = (X >= LOW) & (X <= HIGH);
%
%	BW = ROICOLOR(X,V) returns the binary matrix BW which has 1's
%	where the values in X are equal to the values in the
%	vector V.
%
%	See also ROIPOLY.

%	Clay M. Thompson 2-10-93
%	Copyright (c) 1993 by The MathWorks, Inc.
%	$Revision: 1.8 $  $Date: 1993/09/07 19:10:52 $

if nargin==2,
  v = low(:);
  d = zeros(size(a));
  for i=1:length(v),
    d(:) = d | (a==v(i));
  end

else
  d = (a >= low) & (a <= high);
end

if nargout==0,
  b = ones(size(a));
  b(d) = a(d);
  if min(min(a))<1, imageg(b), else image(b), end
  return
end
dout = d;
