Mercurial > forge
comparison main/image/inst/private/istform.m @ 11662:fbd81057dab0 octave-forge
image: new spatial transformation functions
* maketform: accept input/output control points as second and third argument
* imtransform: new function
* findsbounds: new function
* private/istform: add comment on what function does
* NEWS/INDEX: update list of new functions
author | carandraug |
---|---|
date | Sun, 28 Apr 2013 02:31:13 +0000 |
parents | b6f9246b1017 |
children |
comparison
equal
deleted
inserted
replaced
11661:1b4e81051b66 | 11662:fbd81057dab0 |
---|---|
1 ## Copyright (C) 2012 Pantxo Diribarne | 1 ## Copyright (C) 2012 Pantxo Diribarne |
2 ## | 2 ## |
3 ## This program is free software; you can redistribute it and/or modify | 3 ## This program is free software; you can redistribute it and/or modify |
4 ## it under the terms of the GNU General Public License as published by | 4 ## it under the terms of the GNU General Public License as published by |
5 ## the Free Software Foundation; either version 3 of the License, or | 5 ## the Free Software Foundation; either version 3 of the License, or |
6 ## (at your option) any later version. | 6 ## (at your option) any later version. |
7 ## | 7 ## |
8 ## This program is distributed in the hope that it will be useful, | 8 ## This program is distributed in the hope that it will be useful, |
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 ## GNU General Public License for more details. | 11 ## GNU General Public License for more details. |
12 ## | 12 ## |
13 ## You should have received a copy of the GNU General Public License | 13 ## You should have received a copy of the GNU General Public License |
14 ## along with Octave; see the file COPYING. If not, see | 14 ## along with Octave; see the file COPYING. If not, see |
15 ## <http://www.gnu.org/licenses/>. | 15 ## <http://www.gnu.org/licenses/>. |
16 | 16 |
17 ## -*- texinfo -*- | 17 ## Private internal function to check if a argument is a transformation |
18 ## @deftypefn {Function File} {[@var{UV}] =} tformfwd (@var{T}, @var{XY}) | 18 ## structure (as created by maketform and to be use by findbounds, |
19 ## @deftypefnx {Function File} {[@var{U} @var{V}] =} tformfwd (@var{T}, @var{X},@var{Y}) | 19 ## imtransform, and the like) |
20 ## | |
21 ## Given to dimensionnal coordinates from one space, returns two | |
22 ## dimensionnal coordinates in the other space, as defined in | |
23 ## the transform structure @var{T}. Input and output coordinates | |
24 ## may be gigen either as a n-by-2 arrays, or as two n-by-1 vectors. | |
25 ## @seealso{maketform, cp2tform, tforminv} | |
26 ## @end deftypefn | |
27 | 20 |
28 ## Author: Pantxo Diribarne <pantxo@dibona> | 21 ## Author: Pantxo Diribarne <pantxo@dibona> |
29 | 22 |
30 function out = istform (T) | 23 function out = istform (T) |
31 out = true; | 24 out = true; |
33 out = false; | 26 out = false; |
34 else | 27 else |
35 required = {"ndims_in";"ndims_out"; ... | 28 required = {"ndims_in";"ndims_out"; ... |
36 "forward_fcn"; "inverse_fcn"; ... | 29 "forward_fcn"; "inverse_fcn"; ... |
37 "tdata"}; | 30 "tdata"}; |
38 | 31 |
39 fields = fieldnames (T); | 32 fields = fieldnames (T); |
40 tst = cellfun (@(x) any (strcmp (fields, x)), required); | 33 tst = cellfun (@(x) any (strcmp (fields, x)), required); |
41 if (! all (tst)) | 34 if (! all (tst)) |
42 out = false | 35 out = false |
43 endif | 36 endif |