1ImageND(3)            User Contributed Perl Documentation           ImageND(3)
2
3
4

NAME

6       PDL::ImageND - useful image processing in N dimensions
7

DESCRIPTION

9       These routines act on PDLs as N-dimensional objects, not as threaded
10       sets of 0-D or 1-D objects.  The file is sort of a catch-all for
11       broadly functional routines, most of which could legitimately be filed
12       elsewhere (and probably will, one day).
13
14       ImageND is not a part of the PDL core (v2.4) and hence must be explic‐
15       itly loaded.
16

SYNOPSIS

18        use PDL::ImageND;
19
20        $b = $a->convolveND($kernel,{bound=>'periodic'});
21        $b = $a->rebin(50,30,10);
22

FUNCTIONS

24       convolve
25
26         Signature: (a(m); b(n); int adims(p); int bdims(q); [o]c(m))
27
28       N-dimensional convolution (Deprecated; use convolveND)
29
30       $new = convolve $a, $kernel
31
32       Convolve an array with a kernel, both of which are N-dimensional.  This
33       routine does direct convolution (by copying) but uses quasi-periodic
34       boundary conditions: each dim "wraps around" to the next higher row in
35       the next dim.
36
37       This routine is kept for backwards compatibility with earlier scripts;
38       for most purposes you want convolveND instead: it runs faster and han‐
39       dles a variety of boundary conditions.
40
41       ninterpol()
42
43       N-dimensional interpolation routine
44
45        Signature: ninterpol(point(),data(n),[o]value())
46
47             $value = ninterpol($point, $data);
48
49       "ninterpol" uses "interpol" to find a linearly interpolated value in N
50       dimensions, assuming the data is spread on a uniform grid.  To use an
51       arbitrary grid distribution, need to find the grid-space point from the
52       indexing scheme, then call "ninterpol" -- this is far from trivial (and
53       ill-defined in general).
54
55       See also interpND, which includes boundary conditions and allows you to
56       switch the method of interpolation, but which runs somewhat slower.
57
58       rebin
59
60         Signature: (a(m); [o]b(n); int ns => n)
61
62       N-dimensional rebinning algorithm
63
64       $new = rebin $a, $dim1, $dim2,..;.  $new = rebin $a, $template; $new =
65       rebin $a, $template, {Norm => 1};
66
67       Rebin an N-dimensional array to newly specified dimensions.  Specifying
68       `Norm' keeps the sum constant, otherwise the intensities are kept con‐
69       stant.  If more template dimensions are given than for the input pdl,
70       these dimensions are created; if less, the final dimensions are main‐
71       tained as they were.
72
73       So if $a is a 10 x 10 pdl, then "rebin($a,15)" is a 15 x 10 pdl, while
74       "rebin($a,15,16,17)" is a 15 x 16 x 17 pdl (where the values along the
75       final dimension are all identical).
76
77       Expansion is performed by sampling; reduction is performed by averag‐
78       ing.  If you want different behavior, use PDL::Transform::map instead.
79       PDL::Transform::map runs slower but is more flexible.
80
81       circ_mean_p
82
83       Calculates the circular mean of an n-dim image and returns the projec‐
84       tion. Optionally takes the center to be used.
85
86          $cmean=circ_mean_p($im);
87          $cmean=circ_mean_p($im,{Center => [10,10]});
88
89       circ_mean
90
91       Smooths an image by applying circular mean.  Optionally takes the cen‐
92       ter to be used.
93
94          circ_mean($im);
95          circ_mean($im,{Center => [10,10]});
96
97       kernctr()
98
99       `centre' a kernel (auxiliary routine to fftconvolve)
100
101               $kernel = kernctr($image,$smallk);
102               fftconvolve($image,$kernel);
103
104       kernctr centres a small kernel to emulate the behaviour of the direct
105       convolution routines.
106
107       convolveND
108
109         Signature: (k0(); SV *k; SV *aa; SV *a)
110
111       Speed-optimized convolution with selectable boundary conditions
112
113       $new = convolveND($a, $kernel, [ {options} ]);
114
115       Conolve an array with a kernel, both of which are N-dimensional.
116
117       If the kernel has fewer dimensions than the array, then the extra array
118       dimensions are threaded over.  There are options that control the
119       boundary conditions and method used.
120
121       The kernel's origin is taken to be at the kernel's center.  If your
122       kernel has a dimension of even order then the origin's coordinates get
123       rounded up to the next higher pixel (e.g. (1,2) for a 3x4 kernel).
124       This mimics the behavior of the earlier convolve and fftconvolve rou‐
125       tines, so convolveND is a drop-in replacement for them.
126
127       The kernel may be any size compared to the image, in any dimension.
128
129       The kernel and the array are not quite interchangeable (as in mathemat‐
130       ical convolution): the code is inplace-aware only for the array itself,
131       and the only allowed boundary condition on the kernel is truncation.
132
133       convolveND is inplace-aware: say "convolveND(inplace $a ,$k)" to modify
134       a variable in-place.  You don't reduce the working memory that way --
135       only the final memory.
136
137       OPTIONS
138
139       Options are parsed by PDL::Options, so unique abbreviations are
140       accepted.
141
142       boundary (default: 'truncate')
143          The boundary condition on the array, which affects any pixel closer
144          to the edge than the half-width of the kernel.
145
146          The boundary conditions are the same as those accepted by range,
147          because this option is passed directly into range.  Useful options
148          are 'truncate' (the default), 'extend', and 'periodic'.  You can
149          select different boundary conditions for different axes -- see range
150          for more detail.
151
152          The (default) truncate option marks all the near-boundary pixels as
153          BAD if you have bad values compiled into your PDL.
154
155       method (default: 'auto')
156          The method to use for the convolution.  Acceptable alternatives are
157          'direct', 'fft', or 'auto'.  The direct method is an explicit copy-
158          and-multiply operation; the fft method takes the Fourier transform
159          of the input and output kernels.  The two methods give the same
160          answer to within double-precision numerical roundoff.  The fft
161          method is much faster for large kernels; the direct method is faster
162          for tiny kernels.  The tradeoff occurs when the array has about 400x
163          more pixels than the kernel.
164
165          The default method is 'auto', which chooses direct or fft convolu‐
166          tion based on the size of the input arrays.
167
168       NOTES
169
170       At the moment there's no way to thread over kernels.  That could/should
171       be fixed.
172
173       The threading over input is cheesy and should probably be fixed: cur‐
174       rently the kernel just gets dummy dimensions added to it to match the
175       input dims.  That does the right thing tersely but probably runs slower
176       than a dedicated threadloop.
177
178       The direct copying code uses PP primarily for the generic typing: it
179       includes its own threadloops.
180

AUTHORS

182       Copyright (C) Karl Glazebrook and Craig DeForest, 1997, 2003 All rights
183       reserved. There is no warranty. You are allowed to redistribute this
184       software / documentation under certain conditions. For details, see the
185       file COPYING in the PDL distribution. If this file is separated from
186       the PDL distribution, the copyright notice should be included in the
187       file.
188
189
190
191perl v5.8.8                       2006-12-02                        ImageND(3)
Impressum