Skip to content

Commit

Permalink
update to 2.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
291ce4321ac committed Mar 9, 2023
1 parent 0838e25 commit 52ecadf
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 3 deletions.
2 changes: 1 addition & 1 deletion conversiontools/cs_conversion_tools/imappmat.m
Expand Up @@ -90,7 +90,7 @@
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% IF IPT IS INSTALLED
if license('test', 'image_toolbox') && ifversion('>=','R2011b')
if hasipt() && ifversion('>=','R2011b')
if iptmode
outpict = imapplymatrix(mat,inpict,offset,outclass);
else
Expand Down
2 changes: 1 addition & 1 deletion conversiontools/cs_conversion_tools/maxchroma.m
Expand Up @@ -52,7 +52,7 @@
% between these points and the face is small, any clipping error is minimal. SRLAB methods have similar
% limitations due to undercuts on the blue and yellow corners. LUV does not have this issue.

for k = 1:2:length(varargin);
for k = 1:2:length(varargin)
switch lower(varargin{k})
case {'h','hue'}
H = varargin{k+1};
Expand Down
21 changes: 21 additions & 0 deletions conversiontools/hasipt.m
@@ -0,0 +1,21 @@
function outflag = hasipt()
% FLAG = HASIPT()
% Check whether the current installation has Image Processing Toolbox installed.
% State is persistent to reduce cost of repeated calls.
% Output is a logical scalar.

% for testing purposes
enable = true;

persistent hasIPT
if isempty(hasIPT)
hasIPT = license('test', 'image_toolbox');
end

if enable
outflag = hasIPT;
else
outflag = false; %#ok<UNRCH>
quietwarning('HASIPT(): license checking is disabled for testing!')
end

2 changes: 1 addition & 1 deletion conversiontools/imcast.m
Expand Up @@ -54,7 +54,7 @@
% at least in R2019b, this toolset is split across both IPT and the base toolbox

% IF IPT IS INSTALLED
if license('test', 'image_toolbox')
if hasipt()
switch outclass
case 'uint8'
outpict = im2uint8(inpict);
Expand Down
13 changes: 13 additions & 0 deletions conversiontools/isimageclass.m
@@ -0,0 +1,13 @@
function yeahitis = isimageclass(inpict)
% ISIMAGECLASS(INPICT)
% Check if an array is of a standard image class.
% Returns true for the following datatypes:
% 'double','single','uint8','uint16','int16','logical'
%
% See also: ismono, issolidcolor, isopaque

% yes, ~isempty(find(strcmp())) is faster than ismember()
% about 50x as fast in R2009b; about 2x-4x as fast in R2015b
% it's also very slightly faster than any(strcmp()) or summation in newer versions
yeahitis = strismember(class(inpict),{'double','single','uint8','uint16','int16','logical'});

9 changes: 9 additions & 0 deletions conversiontools/quietwarning.m
@@ -0,0 +1,9 @@
function quietwarning(varargin)
% QUIETWARNING(MESSAGE)
% Print a simple warning message with backtrace momentarily disabled.
% That's all this does; other functionality of warning() not supported.

S = warning('query','backtrace');
warning off backtrace
warning(varargin{:})
warning(S.state,'backtrace')

0 comments on commit 52ecadf

Please sign in to comment.