Mercurial > octave
comparison scripts/image/private/colorspace_conversion_input_check.m @ 30893:e1788b1a315f
maint: Use "fcn" as preferred abbreviation for "function" in m-files.
* accumarray.m, accumdim.m, quadl.m, quadv.m, randi.m, structfun.m,
__is_function__.m, uigetfile.m, uimenu.m, uiputfile.m, doc_cache_create.m,
colorspace_conversion_input_check.m, imageIO.m, argnames.m, vectorize.m,
vectorize.m, normest1.m, inputname.m, nthargout.m, display_info_file.m,
decic.m, ode15i.m, ode15s.m, ode23.m, ode23s.m, ode45.m, odeset.m,
check_default_input.m, integrate_adaptive.m, ode_event_handler.m,
runge_kutta_23.m, runge_kutta_23s.m, runge_kutta_45_dorpri.m,
runge_kutta_interpolate.m, starting_stepsize.m, __all_opts__.m, fminbnd.m,
fminsearch.m, fminunc.m, fsolve.m, fzero.m, sqp.m, fplot.m, plotyy.m,
__bar__.m, __ezplot__.m, flat_entry.html, profexport.m, movfun.m, bicg.m,
bicgstab.m, cgs.m, eigs.m, gmres.m, pcg.m, __alltohandles__.m, __sprand__.m,
qmr.m, tfqmr.m, dump_demos.m:
Replace "func", "fun", "fn" in documentation and variable names with "fcn".
author | Rik <rik@octave.org> |
---|---|
date | Mon, 04 Apr 2022 18:14:56 -0700 |
parents | 796f54d4ddbf |
children | 597f3ee61a48 |
comparison
equal
deleted
inserted
replaced
30892:1a3cc2811090 | 30893:e1788b1a315f |
---|---|
27 ## rgb2ntsc, rgb2hsv, hsv2rgb, and ntsc2rgb. All of these functions need to | 27 ## rgb2ntsc, rgb2hsv, hsv2rgb, and ntsc2rgb. All of these functions need to |
28 ## handle input in the same way. The returned flags are meant to be handled | 28 ## handle input in the same way. The returned flags are meant to be handled |
29 ## by the complementary private function colorspace_conversion_revert() | 29 ## by the complementary private function colorspace_conversion_revert() |
30 | 30 |
31 function [in_arg, sz, is_im, is_nd] ... | 31 function [in_arg, sz, is_im, is_nd] ... |
32 = colorspace_conversion_input_check (func, arg_name, in_arg) | 32 = colorspace_conversion_input_check (fcn, arg_name, in_arg) |
33 | 33 |
34 cls = class (in_arg); | 34 cls = class (in_arg); |
35 sz = size (in_arg); | 35 sz = size (in_arg); |
36 | 36 |
37 ## If we have an image convert it into a color map. | 37 ## If we have an image convert it into a color map. |
38 if (! iscolormap (in_arg)) | 38 if (! iscolormap (in_arg)) |
39 if (! any (strcmp (cls, {"uint8", "int8", "int16", "uint16", ... | 39 if (! any (strcmp (cls, {"uint8", "int8", "int16", "uint16", ... |
40 "single", "double"}))) | 40 "single", "double"}))) |
41 error ("%s: %s of invalid data type '%s'", func, arg_name, cls); | 41 error ("%s: %s of invalid data type '%s'", fcn, arg_name, cls); |
42 elseif (size (in_arg, 3) != 3) | 42 elseif (size (in_arg, 3) != 3) |
43 error ("%s: %s must be a colormap or %s image", func, arg_name, arg_name); | 43 error ("%s: %s must be a colormap or %s image", fcn, arg_name, arg_name); |
44 elseif (! isreal (in_arg) || ! isnumeric (in_arg)) | 44 elseif (! isreal (in_arg) || ! isnumeric (in_arg)) |
45 error ("%s: %s must be numeric and real", func, arg_name); | 45 error ("%s: %s must be numeric and real", fcn, arg_name); |
46 endif | 46 endif |
47 is_im = true; | 47 is_im = true; |
48 | 48 |
49 ## For floating point values, R, G and B should be in the [0 1] range, | 49 ## For floating point values, R, G and B should be in the [0 1] range, |
50 ## otherwise they don't make any sense. We accept those values | 50 ## otherwise they don't make any sense. We accept those values |
58 is_nd = false; | 58 is_nd = false; |
59 elseif (nd == 4) | 59 elseif (nd == 4) |
60 is_nd = true; | 60 is_nd = true; |
61 in_arg = permute (in_arg, [1 2 4 3]); | 61 in_arg = permute (in_arg, [1 2 4 3]); |
62 elseif (nd > 4) | 62 elseif (nd > 4) |
63 error ("%s: invalid %s with more than 4 dimensions", func, arg_name); | 63 error ("%s: invalid %s with more than 4 dimensions", fcn, arg_name); |
64 endif | 64 endif |
65 in_arg = reshape (in_arg, [numel(in_arg)/3 3]); | 65 in_arg = reshape (in_arg, [numel(in_arg)/3 3]); |
66 else | 66 else |
67 is_im = false; | 67 is_im = false; |
68 is_nd = false; | 68 is_nd = false; |