Mercurial > octave-nkf
annotate scripts/image/private/__imread__.m @ 19899:e9f89866074c
maint: Cleanup some .m files to follow Octave coding conventions.
* accumarray.m, validateattributes.m, iscolormap.m, __imread__.m,
__imwrite__.m, imwrite_filename.m, strread.m, getappdata.m,
appearance/annotation.m, shrinkfaces.m, rundemos.m, runtests.m,
datenum.m, datestr.m: Break long lines before && and ||.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 26 Feb 2015 13:13:40 -0500 |
parents | 9fc020886ae9 |
children |
rev | line source |
---|---|
19731
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
18298
diff
changeset
|
1 ## Copyright (C) 2013-2015 Carnë Draug |
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
18298
diff
changeset
|
2 ## Copyright (C) 2008-2015 Thomas L. Scofield |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
3 ## Copyright (C) 2008 Kristian Rumberg |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
4 ## Copyright (C) 2006 Thomas Weber |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
5 ## Copyright (C) 2005 Stefan van der Walt |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
6 ## Copyright (C) 2002 Andy Adler |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
7 ## |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
8 ## This file is part of Octave. |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
9 ## |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
10 ## Octave is free software; you can redistribute it and/or modify it |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
11 ## under the terms of the GNU General Public License as published by |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
12 ## the Free Software Foundation; either version 3 of the License, or (at |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
13 ## your option) any later version. |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
14 ## |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
15 ## Octave is distributed in the hope that it will be useful, but |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
18 ## General Public License for more details. |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
19 ## |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
20 ## You should have received a copy of the GNU General Public License |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
21 ## along with Octave; see the file COPYING. If not, see |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
22 ## <http://www.gnu.org/licenses/>. |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
23 |
16944
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16915
diff
changeset
|
24 ## This function does all the work of imread. It exists here as private |
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16915
diff
changeset
|
25 ## function so that imread can use other functions if imformats is |
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16915
diff
changeset
|
26 ## configured to. It is also needed so that imformats can create a |
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16915
diff
changeset
|
27 ## function handle for it. |
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16915
diff
changeset
|
28 |
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16915
diff
changeset
|
29 ## Author: Carnë Draug <carandraug@octave.org> |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
30 ## Author: Thomas L. Scofield <scofield@calvin.edu> |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
31 ## Author: Kristian Rumberg <kristianrumberg@gmail.com> |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
32 ## Author: Thomas Weber <thomas.weber.mail@gmail.com> |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
33 ## Author: Stefan van der Walt <stefan@sun.ac.za> |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
34 ## Author: Andy Adler |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
35 |
17086
3db796f89695
Rename private core_imfnc functions to follow the __fnc__ convention style.
Carnë Draug <carandraug@octave.org>
parents:
16984
diff
changeset
|
36 function varargout = __imread__ (filename, varargin) |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
37 |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
38 if (nargin < 1) |
16915
cb90f31a4d26
core_imread: specify imread function name print_usage() in private function.
Carnë Draug <carandraug@octave.org>
parents:
16913
diff
changeset
|
39 print_usage ("imread"); |
16944
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16915
diff
changeset
|
40 elseif (! ischar (filename)) |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
41 error ("imread: FILENAME must be a string"); |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
42 endif |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
43 |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
44 ## keep track of the varargin offset we're looking at each moment |
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
45 offset = 1; |
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
46 |
17240
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
47 ## It is possible for an file with multiple pages to have very different |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
48 ## images on each page. Specifically, they may have different sizes. Because |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
49 ## of this, we need to first find out the index of the images to read so |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
50 ## we can set up defaults for things such as PixelRegion later on. |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
51 options = struct ("index", 1); # default image index |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
52 |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
53 ## Index is the only option that can be defined without the parameter/value |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
54 ## pair style. When defining it here, the string "all" is invalid though. |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
55 ## Also, for matlab compatibility, if index is defined both as an option here |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
56 ## and parameter/value pair, silently ignore the first. |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
57 if (nargin >= offset + 1 && ! ischar (varargin{offset})) |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
58 if (! is_valid_index_option (options.index)) |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
59 error ("imread: IDX must be a numeric vector"); |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
60 endif |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
61 options.index = varargin{offset}; |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
62 offset++; |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
63 endif |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
64 |
17240
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
65 if (rem (numel (varargin) - offset + 1, 2) != 0) |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
66 error ("imread: no pair for all arguments (odd number left over)"); |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
67 endif |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
68 |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
69 ## Check key/value options. |
17386
6dbc866379e2
Replace cellfun() occurrences with faster code where possible.
Rik <rik@octave.org>
parents:
17351
diff
changeset
|
70 indexes = cellfun ("isclass", varargin, "char"); |
19867
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19731
diff
changeset
|
71 indexes(indexes) &= ismember (tolower (varargin(indexes)), |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19731
diff
changeset
|
72 {"frames", "index"}); |
17386
6dbc866379e2
Replace cellfun() occurrences with faster code where possible.
Rik <rik@octave.org>
parents:
17351
diff
changeset
|
73 indexes = find (indexes); |
17240
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
74 if (indexes) |
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
75 options.index = varargin{indexes+1}; |
19899
e9f89866074c
maint: Cleanup some .m files to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
76 if (! is_valid_index_option (options.index) |
e9f89866074c
maint: Cleanup some .m files to follow Octave coding conventions.
John W. Eaton <jwe@octave.org>
parents:
19867
diff
changeset
|
77 && ! (ischar (options.index) && strcmpi (options.index, "all"))) |
17240
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
78 error ("imread: value for %s must be a vector or the string `all'"); |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
79 endif |
17240
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
80 endif |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
81 |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
82 ## Use information from the first image to be read to set defaults. |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
83 if (ischar (options.index) && strcmpi (options.index, "all")) |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
18143
diff
changeset
|
84 info = __magick_ping__ (filename, 1); |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
85 else |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
18143
diff
changeset
|
86 info = __magick_ping__ (filename, options.index(1)); |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
87 endif |
17240
d757c98636d8
Use first image to be read rather than first image in file to set defaults.
Carnë Draug <carandraug@octave.org>
parents:
17227
diff
changeset
|
88 |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
89 ## Set default for options. |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
90 options.region = {1:1:info.rows 1:1:info.columns}; |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
91 |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
92 for idx = offset:2:(numel (varargin) - offset + 1) |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
93 switch (tolower (varargin{idx})) |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
94 |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
95 case {"frames", "index"} |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
96 ## Do nothing. This options were already processed before the loop. |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
97 |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
98 case "pixelregion", |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
99 options.region = varargin{idx+1}; |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
100 if (! iscell (options.region) || numel (options.region) != 2) |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
101 error ("imread: value for %s must be a 2 element cell array", |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
102 varargin{idx}); |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
103 endif |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
104 for reg_idx = 1:2 |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
105 if (numel (options.region{reg_idx}) == 3) |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
106 ## do nothing |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
107 elseif (numel (options.region{reg_idx}) == 2) |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
108 options.region{reg_idx}(3) = options.region{reg_idx}(2); |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
109 options.region{reg_idx}(2) = 1; |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
110 else |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
111 error ("imread: range for %s must be a 2 or 3 element vector", |
17118
c97a26408ee0
Implement PixelRegion option for imread().
Carnë Draug <carandraug@octave.org>
parents:
17086
diff
changeset
|
112 varargin{idx}); |
c97a26408ee0
Implement PixelRegion option for imread().
Carnë Draug <carandraug@octave.org>
parents:
17086
diff
changeset
|
113 endif |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
114 options.region{reg_idx} = floor (options.region{reg_idx}(1)): ... |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
115 floor (options.region{reg_idx}(2)): ... |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
116 floor (options.region{reg_idx}(3)); |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
117 endfor |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
118 if (options.region{1}(end) > info.rows) |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
119 error ("imread: end ROWS for PixelRegions option is larger than image height"); |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
120 elseif (options.region{2}(end) > info.columns) |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
121 error ("imread: end COLS for PixelRegions option is larger than image width"); |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
122 endif |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
123 |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
124 case "info", |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
125 ## We ignore this option. This parameter exists in Matlab to |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
126 ## speed up the reading of multipage TIFF by passing a structure |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
127 ## that contains information about the start on the file of each |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
128 ## page. We can't control it through GraphicsMagic but at least |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
129 ## we allow to load multiple pages with one command. |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
130 |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
131 otherwise |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
132 error ("imread: invalid PARAMETER `%s'", varargin{idx}); |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
133 |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
134 endswitch |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
135 endfor |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
136 |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
18143
diff
changeset
|
137 [varargout{1:nargout}] = __magick_read__ (filename, options); |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
138 |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
139 endfunction |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
140 |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
141 ## Tests if the value passed to the Index or Frames is valid. This option |
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
142 ## can be defined in two places, but only in one place can it also be the |
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
143 ## string "all" |
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
144 function bool = is_valid_index_option (arg) |
18143
b5970988ccff
image/private/__imread__.m: simplify subfunction for argument check
Carnë Draug <carandraug@octave.org>
parents:
18142
diff
changeset
|
145 bool = isvector (arg) && isnumeric (arg) && isreal (arg); |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
146 endfunction |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17240
diff
changeset
|
147 |