Mercurial > octave-nkf
annotate scripts/image/private/__imread__.m @ 18298:15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
* image/private/imageIO.m: make this function check existence of the file
and handle URLs. It may also modify the input that imread() and imfinfo()
received to remove the format name if it was given as a separate argument. The
filepath will be modified to give the absolute filepath, and URLs will cause
the file to be downloaded, and the filepath for a temporary will be given (and
the file removed in the end). If the file can't be found it will thrown an error
meaning that if the file is not found, whatever function is set for that format,
it will never be called).
* image/imfinfo.m, image/imread.m: change functions for the modified call to
imageIO() and add new tests.
* image/private/__imfinfo__.m, image/private/__imread__.m: remove parsing of
input, checking for existence of file, and handling of URL since that is now
done by imageIO().
* image/imformats.m: fix tests for the new behaviour.
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Thu, 16 Jan 2014 19:12:36 +0000 |
parents | b5970988ccff |
children | 4197fc428c7d |
rev | line source |
---|---|
16944
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16915
diff
changeset
|
1 ## Copyright (C) 2013 Carnë Draug |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
17386
diff
changeset
|
2 ## Copyright (C) 2008-2013 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"); |
17917
c9f622fd7307
imread: be case insensitive when checking "Index" and "Frames" options.
Carnë Draug <carandraug@octave.org>
parents:
17911
diff
changeset
|
71 indexes(indexes) &= ismember (tolower (varargin(indexes)), {"frames", "index"}); |
17386
6dbc866379e2
Replace cellfun() occurrences with faster code where possible.
Rik <rik@octave.org>
parents:
17351
diff
changeset
|
72 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
|
73 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
|
74 options.index = varargin{indexes+1}; |
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 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
|
76 ! (ischar (options.index) && strcmpi (options.index, "all"))) |
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
|
77 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
|
78 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
|
79 endif |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
80 |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
81 ## 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
|
82 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
|
83 info = __magick_ping__ (filename, 1); |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
84 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
|
85 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
|
86 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
|
87 |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
88 ## Set default for options. |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
89 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
|
90 |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
91 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
|
92 switch (tolower (varargin{idx})) |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
93 |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
94 case {"frames", "index"} |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
95 ## 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
|
96 |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
97 case "pixelregion", |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
98 options.region = varargin{idx+1}; |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
99 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
|
100 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
|
101 varargin{idx}); |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
102 endif |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
103 for reg_idx = 1:2 |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
104 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
|
105 ## do nothing |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
106 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
|
107 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
|
108 options.region{reg_idx}(2) = 1; |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
109 else |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
110 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
|
111 varargin{idx}); |
c97a26408ee0
Implement PixelRegion option for imread().
Carnë Draug <carandraug@octave.org>
parents:
17086
diff
changeset
|
112 endif |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
113 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
|
114 floor (options.region{reg_idx}(2)): ... |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
115 floor (options.region{reg_idx}(3)); |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
116 endfor |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
117 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
|
118 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
|
119 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
|
120 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
|
121 endif |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
122 |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
123 case "info", |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
124 ## 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
|
125 ## 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
|
126 ## 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
|
127 ## 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
|
128 ## we allow to load multiple pages with one command. |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
129 |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
130 otherwise |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
131 error ("imread: invalid PARAMETER `%s'", varargin{idx}); |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
132 |
18142
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
133 endswitch |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
134 endfor |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
135 |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
18143
diff
changeset
|
136 [varargout{1:nargout}] = __magick_read__ (filename, options); |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
137 |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
138 endfunction |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
139 |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
140 ## 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
|
141 ## 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
|
142 ## string "all" |
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
143 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
|
144 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
|
145 endfunction |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
17240
diff
changeset
|
146 |