Mercurial > octave
annotate scripts/image/private/__imread__.m @ 33667:c85559c86923 default tip @
gui: Use old syntax for connections involving QScintilla.
* libgui/src/m-editor/file-editor-tab.cc
(file_editor_tab::handle_api_entries_added): Use old syntax for signal-slot
connection to avoid connection errors on Windows.
Thank you to Torsten for helping with this and the previous change.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Mon, 17 Jun 2024 19:25:26 +0200 |
parents | 2e484f9f1f18 |
children |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
32632
2e484f9f1f18
maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
32002
diff
changeset
|
3 ## Copyright (C) 2002-2024 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27216
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
16913
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 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
16913
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 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## (at your option) any later version. |
16913
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 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## GNU General Public License for more details. |
16913
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 |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
25 |
31664
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
26 ## -*- texinfo -*- |
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
27 ## @deftypefn {} {[@var{img}, @var{map}, @var{alpha}] =} __imread__ (@var{filename}) |
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
28 ## @deftypefnx {} {[@dots{}] =} __imread__ (@var{url}) |
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
29 ## @deftypefnx {} {[@dots{}] =} __imread__ (@dots{}, @var{ext}) |
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
30 ## @deftypefnx {} {[@dots{}] =} __imread__ (@dots{}, @var{idx}) |
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
31 ## @deftypefnx {} {[@dots{}] =} __imread__ (@dots{}, @var{param1}, @var{value1}, @dots{}) |
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
32 ## @deftypefnx {} {@var{info} =} __imread__ (@var{filename}) |
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
33 ## |
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
34 ## This function does all the work of @code{imread}. |
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
35 ## |
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
36 ## It exists here as private function so that @code{imread} can use other |
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
37 ## functions if @code{imformats} is configured to. It is also needed so that |
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
38 ## @code{imformats} can create a function handle for it. |
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
39 ## |
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
40 ## @seealso{imread} |
505ed551e366
doc: Ensure DOCSTRING has an output when function returns a value (bug #61681)
Rik <rik@octave.org>
parents:
30603
diff
changeset
|
41 ## @end deftypefn |
16944
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16915
diff
changeset
|
42 |
17086
3db796f89695
Rename private core_imfnc functions to follow the __fnc__ convention style.
Carnë Draug <carandraug@octave.org>
parents:
16984
diff
changeset
|
43 function varargout = __imread__ (filename, varargin) |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
44 |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
45 ## keep track of the varargin offset we're looking at each moment |
21568
3d60ed163b70
maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents:
20735
diff
changeset
|
46 offset = 1; |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
47 |
21742
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
48 ## It is possible for a file with multiple pages to have very different |
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
49 ## images on each page. Specifically, they may have different sizes. |
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
50 ## Because of this, we need to first find out the index of the images to read |
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
51 ## so we can set up defaults for things such as PixelRegion later on. |
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
|
52 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
|
53 |
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 ## Index is the only option that can be defined without the parameter/value |
21742
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
55 ## pair style. When defined here, the string "all" is invalid. |
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
56 ## Also, for Matlab compatibility, if index is defined both as an option here |
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
|
57 ## and parameter/value pair, silently ignore the first. |
21742
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
58 if (nargin >= 2 && ! ischar (varargin{1})) |
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
59 options.index = varargin{1}; |
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
|
60 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
|
61 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
|
62 endif |
21742
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
63 offset = 2; |
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
|
64 endif |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
65 |
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
|
66 if (rem (numel (varargin) - offset + 1, 2) != 0) |
21742
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
67 error ("imread: PARAM/VALUE arguments must occur in pairs"); |
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
|
68 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
|
69 |
21742
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
70 ## Check for Index/Frames argument |
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
71 idx = strcmpi ("index", varargin) | strcmpi ("frames", varargin); |
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
72 if (any (idx)) |
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
73 if (sum (idx) > 1) |
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
74 error ("imread: Index or Frames may only be specified once"); |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
75 endif |
30603
397d29f7135c
shift.m: Deprecate function in favor of circshift for Matlab compatibility.
Rik <rik@octave.org>
parents:
30564
diff
changeset
|
76 val = varargin{circshift (idx, 1)}; |
21742
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
77 if (! is_valid_index_option (val) && ! strcmpi (val, "all")) |
27216
823b4bcf79fc
unless necessary for formatting or code, use ' instead of `
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
78 error ("imread: %s must be a vector or the string 'all'", varargin{idx}); |
21742
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
79 endif |
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
80 options.index = val; |
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
|
81 endif |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
82 |
18143
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
83 ## Use information from the first image to be read to set defaults. |
21742
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
84 if (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:
18144
diff
changeset
|
85 info = __magick_ping__ (filename, 1); |
18143
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
86 else |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
18144
diff
changeset
|
87 info = __magick_ping__ (filename, options.index(1)); |
18143
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
88 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
|
89 |
18143
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
90 ## Set default for options. |
21742
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
91 options.region = {1:1:info.rows, 1:1:info.columns}; |
18143
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
92 |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
93 for idx = offset:2:(numel (varargin) - offset + 1) |
32002
939e5d952675
Use upper/lower in preference to toupper/tolower to match Matlab.
Rik <rik@octave.org>
parents:
31706
diff
changeset
|
94 switch (lower (varargin{idx})) |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
95 |
18143
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
96 case {"frames", "index"} |
21742
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
97 ## Do nothing. This option was already processed before the loop. |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
98 |
21742
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
99 case "pixelregion" |
18143
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
100 options.region = varargin{idx+1}; |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
101 if (! iscell (options.region) || numel (options.region) != 2) |
21742
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
102 error ("imread: %s must be a 2-element cell array", |
18143
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
103 varargin{idx}); |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
104 endif |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
105 for reg_idx = 1:2 |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
106 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
|
107 ## do nothing |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
108 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
|
109 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
|
110 options.region{reg_idx}(2) = 1; |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
111 else |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
112 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
|
113 varargin{idx}); |
c97a26408ee0
Implement PixelRegion option for imread().
Carnë Draug <carandraug@octave.org>
parents:
17086
diff
changeset
|
114 endif |
18143
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
115 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
|
116 floor (options.region{reg_idx}(2)): ... |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
117 floor (options.region{reg_idx}(3)); |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
118 endfor |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
119 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
|
120 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
|
121 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
|
122 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
|
123 endif |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
124 |
21742
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
125 case "info" |
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
126 ## We ignore this option. This parameter exists in Matlab to |
18143
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
127 ## 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
|
128 ## 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
|
129 ## 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
|
130 ## we allow to load multiple pages with one command. |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
131 |
18143
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
132 otherwise |
27216
823b4bcf79fc
unless necessary for formatting or code, use ' instead of `
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
133 error ("imread: invalid PARAMETER '%s'", varargin{idx}); |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
134 |
18143
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
135 endswitch |
10dca690f46f
Remove support for Octave's native image format.
Carnë Draug <carandraug@octave.org>
parents:
17917
diff
changeset
|
136 endfor |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
137 |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
18144
diff
changeset
|
138 [varargout{1:nargout}] = __magick_read__ (filename, options); |
16913
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
139 |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
140 endfunction |
d0558ee259ad
Connect imread with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
141 |
21742
c86cacc3aaf4
imread: Clean up function and its private implementation.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
142 ## Test if the value passed to the Index or Frames is valid. This option |
16984
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
143 ## 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
|
144 ## string "all" |
997efb8d0b19
imread: implement options Index, Frames, and Info.
Carnë Draug <carandraug@octave.org>
parents:
16944
diff
changeset
|
145 function bool = is_valid_index_option (arg) |
18144
b5970988ccff
image/private/__imread__.m: simplify subfunction for argument check
Carnë Draug <carandraug@octave.org>
parents:
18143
diff
changeset
|
146 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
|
147 endfunction |