annotate src/of-image-1-fixes.patch @ 4378:a3af3be14136

of-image: update image patch from image repo * src/of-image-1-fixes.patch: update patch
author John D
date Sun, 09 Apr 2017 16:38:37 -0400
parents 74c7af6a36c0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4378
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
1 diff -r c8bc315fa273 inst/bwperim.m
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
2 --- a/inst/bwperim.m Sat Feb 11 23:54:52 2017 +0000
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
3 +++ b/inst/bwperim.m Sun Apr 09 09:03:52 2017 -0400
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
4 @@ -20,7 +20,7 @@
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
5 ##
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
6 ## Values from the matrix @var{bw} are considered part of an object perimeter
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
7 ## if their value is non-zero and is connected to at least one zero-valued
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
8 -## element.
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
9 +## element, or to the outside of @var{bw}.
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
10 ##
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
11 ## Element connectivity @var{conn}, to define the size of objects, can be
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
12 ## specified with a numeric scalar (number of elements in the neighborhood):
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
13 @@ -71,7 +71,7 @@
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
14 for dim = 1:min (ndims (perim), ndims (conn))
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
15 conn_idx = tmp_conn_idx;
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
16 conn_idx{dim} = [1 3];
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
17 - if (p_size(dim) == 1 || ! any (conn(conn_idx{:})(:)))
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
18 + if (! any (conn(conn_idx{:})(:)))
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
19 continue
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
20 endif
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
21
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
22 @@ -262,3 +262,23 @@
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
23 %! c = a;
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
24 %! c(3:6,3:6,3) = false;
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
25 %! assert (bwperim (a, 4), c)
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
26 +
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
27 +## test dimensions of length 1 (1x1, Nx1, etc) (bug #50153)
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
28 +%!test
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
29 +%! conn_self = logical ([0 0 0; 0 1 0; 0 0 0]);
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
30 +%! assert (bwperim (true), true)
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
31 +%! assert (bwperim (true, conn_self), false)
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
32 +%! assert (bwperim (true (1, 6)), true (1, 6))
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
33 +%! assert (bwperim (true (1, 6), conn_self), false (1, 6))
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
34 +%! assert (bwperim (true (6, 1)), true (6, 1))
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
35 +%!
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
36 +%! bw_3d = true (1, 1, 6);
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
37 +%! assert (bwperim (bw_3d), bw_3d)
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
38 +%! assert (bwperim (bw_3d, conn_self), false (1, 1, 6))
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
39 +%! assert (bwperim (bw_3d, true (3)), bw_3d)
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
40 +%!
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
41 +%! perim_3d = bw_3d;
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
42 +%! perim_3d(1, 1, 2:end-1) = false;
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
43 +%! conn_3d = false (3, 3, 3);
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
44 +%! conn_3d(2, 2, :) = true;
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
45 +%! assert (bwperim (true (1, 1, 6), conn_3d), perim_3d)
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
46 diff -r c8bc315fa273 src/config.h.in
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
47 --- a/src/config.h.in Sat Feb 11 23:54:52 2017 +0000
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
48 +++ b/src/config.h.in Sun Apr 09 09:03:52 2017 -0400
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
49 @@ -1,2 +1,5 @@
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
50 /* Define if octave::math::min exists as replacement to xmin. */
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
51 #undef HAVE_MIN_IN_OCTAVE_MATH_NAMESPACE
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
52 +
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
53 +/* Define if octave::feval exists as replacement to feval. */
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
54 +#undef HAVE_FEVAL_IN_OCTAVE_NAMESPACE
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
55 diff -r c8bc315fa273 src/configure.ac
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
56 --- a/src/configure.ac Sat Feb 11 23:54:52 2017 +0000
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
57 +++ b/src/configure.ac Sun Apr 09 09:03:52 2017 -0400
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
58 @@ -70,6 +70,20 @@
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
59 [Define if octave::math::min exists as replacement to xmin.])
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
60 fi
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
61
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
62 +AC_CACHE_CHECK(
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
63 + [whether feval is in the octave namespace],
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
64 + [octave_image_cv_feval_in_octave_namespace],
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
65 + [AC_COMPILE_IFELSE(
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
66 + [AC_LANG_PROGRAM([#include <parse.h>],
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
67 + [octave::feval ("eye")])],
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
68 + [octave_image_cv_feval_in_octave_namespace=yes],
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
69 + [octave_image_cv_feval_in_octave_namespace=no])])
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
70 +
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
71 +if test "$octave_image_cv_feval_in_octave_namespace" = yes; then
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
72 + AC_DEFINE([HAVE_FEVAL_IN_OCTAVE_NAMESPACE], [1],
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
73 + [Define if octave::feval exists as replacement to feval.])
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
74 +fi
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
75 +
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
76 CXXFLAGS="$image_save_CXXFLAGS"
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
77
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
78
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
79 diff -r c8bc315fa273 src/imreconstruct.cc
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
80 --- a/src/imreconstruct.cc Sat Feb 11 23:54:52 2017 +0000
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
81 +++ b/src/imreconstruct.cc Sun Apr 09 09:03:52 2017 -0400
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
82 @@ -24,8 +24,6 @@
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
83 // This should still be more efficient than using subscript indices to find
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
84 // when we are on the border.
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
85
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
86 -#include "config.h"
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
87 -
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
88 #include <functional>
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
89 #include <queue>
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
90
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
91 @@ -38,20 +36,8 @@
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
92
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
93 using namespace octave::image;
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
94
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
95 -namespace octave_image
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
96 -{
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
97 - // Temporary wrapper until we no longer support Octave 4.0 (bug #48618)
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
98 - template <typename T>
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
99 - inline T
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
100 - min (T x, T y)
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
101 - {
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
102 -#if defined HAVE_MIN_IN_OCTAVE_MATH_NAMESPACE
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
103 - return octave::math::min (x, y);
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
104 -#else
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
105 - return xmin (x, y);
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
106 -#endif
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
107 - }
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
108 -}
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
109 +#define WANTS_MIN 1
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
110 +#include "octave-wrappers.h"
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
111
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
112 /*
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
113 ## A dirty implementation of the fast hybrid reconstruction as m file
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
114 diff -r c8bc315fa273 src/octave-wrappers.h
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
115 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
116 +++ b/src/octave-wrappers.h Sun Apr 09 09:03:52 2017 -0400
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
117 @@ -0,0 +1,70 @@
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
118 +// Copyright (C) 2017 Carnë Draug <carandraug@octave.org>
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
119 +//
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
120 +// This program is free software; you can redistribute it and/or
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
121 +// modify it under the terms of the GNU General Public License as
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
122 +// published by the Free Software Foundation; either version 3 of the
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
123 +// License, or (at your option) any later version.
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
124 +//
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
125 +// This program is distributed in the hope that it will be useful, but
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
126 +// WITHOUT ANY WARRANTY; without even the implied warranty of
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
127 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
128 +// General Public License for more details.
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
129 +//
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
130 +// You should have received a copy of the GNU General Public License
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
131 +// along with this program; if not, see
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
132 +// <http://www.gnu.org/licenses/>.
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
133 +
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
134 +// Core is going through a bunch of changes, and moving a lot of
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
135 +// functions into the octave namespace and deprecating thw old
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
136 +// functions. We want to be compatible with older versions and we
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
137 +// don't want to scare users with deprecation warnings so we have our
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
138 +// own wrappers so nothing breaks.
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
139 +//
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
140 +// We don't want to have a file per function we need to wrap; we don't
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
141 +// want to repeat the wrapper in each file that needs it; we don't
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
142 +// want to disable the deprecation warnings (so that we get warnings
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
143 +// next time we something else gets deprecated); and we don't want to
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
144 +// include all needed headers.
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
145 +//
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
146 +// It is the job of the file that includes this to include the
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
147 +// required headers, at least as long as core only changes the
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
148 +// namespace and not the header file.
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
149 +//
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
150 +// This wrappers are all temporary until we no longer support the
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
151 +// Octave version that made the change.
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
152 +
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
153 +#include "config.h"
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
154 +
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
155 +namespace octave_image
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
156 +{
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
157 + // Temporary wrapper until we no longer support Octave 4.0 (bug #48618)
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
158 +#if defined WANTS_MIN && ! defined HAS_MIN
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
159 +#define HAS_MIN 1
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
160 + template <typename T>
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
161 + inline T
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
162 + min (T x, T y)
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
163 + {
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
164 +#if defined HAVE_MIN_IN_OCTAVE_MATH_NAMESPACE
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
165 + return octave::math::min (x, y);
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
166 +#else
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
167 + return xmin (x, y);
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
168 +#endif
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
169 + }
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
170 +#endif
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
171 +
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
172 + // Temporary wrapper until we no longer support Octave 4.2 (bug #50180)
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
173 +#if defined WANTS_FEVAL && ! defined HAS_FEVAL
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
174 +#define HAS_FEVAL 1
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
175 + inline octave_value_list
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
176 + feval (const std::string& name,
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
177 + const octave_value_list& args,
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
178 + int nargout = 0)
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
179 + {
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
180 +#if defined HAVE_FEVAL_IN_OCTAVE_NAMESPACE
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
181 + return octave::feval (name, args, nargout);
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
182 +#else
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
183 + return ::feval (name, args, nargout);
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
184 +#endif
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
185 + }
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
186 +#endif
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
187 +}
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
188 diff -r c8bc315fa273 src/strel.cc
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
189 --- a/src/strel.cc Sat Feb 11 23:54:52 2017 +0000
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
190 +++ b/src/strel.cc Sun Apr 09 09:03:52 2017 -0400
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
191 @@ -27,6 +27,9 @@
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
192 #include <octave/parse.h> // gives us feval so we can use @strel
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
193 #include <octave/oct-map.h>
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
194
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
195 +#define WANTS_FEVAL 1
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
196 +#include "octave-wrappers.h"
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
197 +
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
198 // Constructors
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
199
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
200 // Expects a @strel object, or a boolean matrix (or something
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
201 @@ -49,13 +52,13 @@
4357
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
202 strel_args(0) = "arbitrary";
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
203 strel_args(1) = se;
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
204 // We are leaving the input check up to @strel
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
205 - se = feval ("strel", strel_args)(0);
4378
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
206 + se = octave_image::feval ("strel", strel_args)(0);
4357
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
207 if (error_state)
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
208 return;
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
209 }
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
210
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
211 - nhood = feval ("getnhood", se)(0).bool_array_value ();
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
212 - height = feval ("getheight", se)(0).array_value ();
4378
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
213 + nhood = octave_image::feval ("getnhood", se)(0).bool_array_value ();
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
214 + height = octave_image::feval ("getheight", se)(0).array_value ();
4357
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
215
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
216 // Maybe we should handle this better but how? This makes imerode
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
217 // and imdilate work with a [] strel
4378
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
218 @@ -68,8 +71,9 @@
4357
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
219 ini_ctor ();
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
220 origin = default_origin ();
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
221
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
222 - const octave_value se_seq = feval ("getsequence", se)(0);
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
223 - const octave_idx_type seq_numel = feval ("numel", se_seq)(0).idx_type_value ();
4378
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
224 + const octave_value se_seq = octave_image::feval ("getsequence", se)(0);
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
225 + const octave_idx_type seq_numel
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
226 + = octave_image::feval ("numel", se_seq)(0).idx_type_value ();
4357
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
227
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
228 // This is to emulate the strel_obj(idx) syntax in function form
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
229 static const char *fields[] = {"type", "subs", 0};
4378
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
230 @@ -86,10 +90,13 @@
4357
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
231 ref.setfield ("subs", Cell (octave_value (subs+1)));
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
232 subsref_args(1) = ref;
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
233 // Equivalent to "selem = strel_obj(subs)"
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
234 - const octave_value_list elem = feval ("subsref", subsref_args)(0);
4378
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
235 + const octave_value_list elem
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
236 + = octave_image::feval ("subsref", subsref_args)(0);
4357
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
237
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
238 - const boolNDArray elem_nhood = feval ("getnhood", elem)(0).bool_array_value ();
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
239 - const NDArray elem_height = feval ("getheight", elem)(0).array_value ();
4378
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
240 + const boolNDArray elem_nhood
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
241 + = octave_image::feval ("getnhood", elem)(0).bool_array_value ();
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
242 + const NDArray elem_height
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
243 + = octave_image::feval ("getheight", elem)(0).array_value ();
4357
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
244
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
245 decomposition.push_back (strel (elem_nhood, elem_height));
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
246 }
4378
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
247 diff -r c8bc315fa273 src/watershed.cc
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
248 --- a/src/watershed.cc Sat Feb 11 23:54:52 2017 +0000
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
249 +++ b/src/watershed.cc Sun Apr 09 09:03:52 2017 -0400
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
250 @@ -21,6 +21,9 @@
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
251 #include <octave/Cell.h>
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
252 #include <octave/oct-map.h>
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
253
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
254 +#define WANTS_FEVAL 1
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
255 +#include "octave-wrappers.h"
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
256 +
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
257 #include "connectivity.h"
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
258 using namespace octave::image;
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
259
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
260 @@ -57,7 +60,7 @@
4357
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
261 args(0) = im;
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
262 args(1) = conn.mask;
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
263 args(2) = conn.mask;
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
264 - const octave_value gradient = feval ("mmgradm", args)(0);
4378
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
265 + const octave_value gradient = octave_image::feval ("mmgradm", args)(0);
4357
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
266 return ov2T<T> (gradient);
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
267 }
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
268
4378
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
269 @@ -68,7 +71,8 @@
4357
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
270 octave_value_list args (2);
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
271 args(0) = im;
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
272 args(1) = conn.mask;
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
273 - const octave_value regional_min = feval ("imregionalmin", args)(0);
4378
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
274 + const octave_value regional_min = octave_image::feval ("imregionalmin",
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
275 + args)(0);
4357
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
276 return regional_min.bool_array_value ();
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
277 }
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
278
4378
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
279 @@ -78,7 +82,7 @@
4357
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
280 octave_value_list args (2);
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
281 args(0) = bw;
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
282 args(1) = conn.mask;
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
283 - const octave_value label = feval ("bwlabeln", args)(0);
4378
a3af3be14136 of-image: update image patch from image repo
John D
parents: 4357
diff changeset
284 + const octave_value label = octave_image::feval ("bwlabeln", args)(0);
4357
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
285 return label.array_value ();
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
286 }
74c7af6a36c0 * of-image-1-fixes.patch: New file.
John W. Eaton <jwe@octave.org>
parents:
diff changeset
287