Mercurial > octave
annotate scripts/image/private/imageIO.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 | 1c89599167a6 |
children | fcd87f68af4f |
rev | line source |
---|---|
16906
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
1 ## Copyright (C) 2013 Carnë Draug |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
2 ## |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
4 ## |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
8 ## your option) any later version. |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
9 ## |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
13 ## General Public License for more details. |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
14 ## |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
18 |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
19 ## This function the image input functions imread() and imfinfo() to the |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
20 ## functions that will actually be used, based on their format. See below |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
21 ## on the details on how it identifies the format, and to what it defaults. |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
22 ## |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
23 ## It will change the input arguments that were passed to imread() and |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
24 ## imfinfo(). It will change the filename to provide the absolute filepath |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
25 ## for the file, it will extract the possible format name from the rest of |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
26 ## the input arguments (in case there was one), and will give an error if |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
27 ## the file can't be found. |
16906
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
28 ## |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
29 ## Usage: |
16906
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
30 ## |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
31 ## func - Function name to use on error message. |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
32 ## core_func - Function handle for the default function to use if we can't |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
33 ## find the format in imformats. |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
34 ## fieldname - Name of the field in the struct returned by imformats that |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
35 ## has the function to use. |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
36 ## filename - Most likely the first input argument from the function that |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
37 ## called this. May be missing the file extension which can be |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
38 ## on varargin. |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
39 ## varargin - Followed by all the OTHER arguments passed to imread and |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
40 ## imfinfo. |
16944
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16906
diff
changeset
|
41 |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
42 function varargout = imageIO (func, core_func, fieldname, filename, varargin) |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
43 |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
44 ## First thing: figure out the filename and possibly download it. |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
45 ## The first attempt is to try the filename and see if it exists. If it |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
46 ## does not, we try to add the next argument since the file extension can |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
47 ## be given as a separate argument. If we still can't find the file, it |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
48 ## can be a URL. Lastly, if we still didn't found a file, try adding the |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
49 ## extension to the URL |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
50 |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
51 file_2_delete = false; # will we have to remove the file in the end? |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
52 persistent abs_path = @(x) file_in_path (IMAGE_PATH, tilde_expand (x)); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
53 |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
54 ## Filename was given with file extension |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
55 fn = abs_path (filename); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
56 if (isempty (fn) && ! isempty (varargin)) |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
57 ## Maybe if we add a file extension |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
58 fn = abs_path ([filename "." varargin{1}]); |
16906
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
59 endif |
16944
1b3b3ee88284
Add optional extension argument to image IO functions.
Carnë Draug <carandraug@octave.org>
parents:
16906
diff
changeset
|
60 |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
61 ## Maybe we have an URL |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
62 if (isempty (fn)) |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
63 file_2_delete = true; # mark file for deletion |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
64 [fn, ~] = urlwrite (filename, tmpnam ()); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
65 ## Maybe the URL is missing the file extension |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
66 if (isempty (fn) && ! isempty (varargin)) |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
67 [fn, ~] = urlwrite ([filename "." varargin{1}], tmpnam ()); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
68 endif |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
69 |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
70 if (isempty (fn)) |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
71 error ("%s: unable to find file %s", func, filename); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
72 endif |
16906
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
73 endif |
18298
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
74 |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
75 ## unwind_protect block because we may have a file to remove in the end |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
76 unwind_protect |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
77 |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
78 ## When guessing the format to use, we first check if the second |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
79 ## argument is a format defined in imformats. If so, we remove it |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
80 ## from the rest of arguments before passing them on. If not, we |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
81 ## try to guess the format from the file extension. Finally, if |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
82 ## we still don't know the format, we use the Octave core functions |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
83 ## which is the same for all formats. |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
84 foo = []; # the function we will use |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
85 |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
86 ## We check if the call to imformats (ext) worked using |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
87 ## "isempty (fieldnames (fmt))" because when it fails, the returned |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
88 ## struct is not considered empty. |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
89 |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
90 ## try the second input argument |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
91 if (! isempty (varargin) && ischar (varargin{1})) |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
92 fmt = imformats (varargin{1}); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
93 if (! isempty (fieldnames (fmt))) |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
94 foo = fmt.(fieldname); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
95 varargin(1) = []; # remove format name from arguments |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
96 endif |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
97 endif |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
98 |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
99 ## try extension from file name |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
100 if (isempty (foo)) |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
101 [~, ~, ext] = fileparts (fn); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
102 if (! isempty (ext)) |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
103 ## remove dot from extension |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
104 ext = ext(2:end); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
105 endif |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
106 fmt = imformats (ext); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
107 if (! isempty (fieldnames (fmt))) |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
108 foo = fmt.(fieldname); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
109 endif |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
110 endif |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
111 |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
112 ## use the core function |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
113 if (isempty (foo)) |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
114 foo = core_func; |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
115 endif |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
116 |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
117 [varargout{1:nargout}] = foo (fn, varargin{:}); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
118 |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
119 unwind_protect_cleanup |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
120 if (file_2_delete) |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
121 unlink (fn); |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
122 endif |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
123 end_unwind_protect |
15db54c4a572
Fix input parsing for imageIO functions and make imread accept URL (bug #41234)
Carnë Draug <carandraug@octave.org>
parents:
17338
diff
changeset
|
124 |
16906
bfad37d33435
Connect imfinfo with imformats.
Carnë Draug <carandraug@octave.org>
parents:
diff
changeset
|
125 endfunction |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
16984
diff
changeset
|
126 |