"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "GENERATED/PDL/ImageND.pm" between
PDL-2.082.tar.gz and PDL-2.083.tar.gz

About: PDL (Perl Data Language) aims to turn perl into an efficient numerical language for scientific computing (similar to IDL and MatLab).

ImageND.pm  (PDL-2.082):ImageND.pm  (PDL-2.083)
skipping to change at line 53 skipping to change at line 53
use warnings; use warnings;
#line 53 "ImageND.pm" #line 53 "ImageND.pm"
=head1 FUNCTIONS =head1 FUNCTIONS
=cut =cut
#line 95 "imagend.pd" #line 95 "imagend.pd"
use Carp; use Carp;
#line 71 "ImageND.pm" #line 66 "ImageND.pm"
#line 958 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
=head2 convolve =head2 convolve
=for sig =for sig
Signature: (a(m); b(n); indx adims(p); indx bdims(q); [o]c(m)) Signature: (a(m); b(n); indx adims(p); indx bdims(q); [o]c(m))
=for ref =for ref
N-dimensional convolution (Deprecated; use convolveND) N-dimensional convolution (Deprecated; use convolveND)
skipping to change at line 86 skipping to change at line 84
This routine is kept for backwards compatibility with earlier scripts; This routine is kept for backwards compatibility with earlier scripts;
for most purposes you want L<convolveND|PDL::ImageND/convolveND> instead: for most purposes you want L<convolveND|PDL::ImageND/convolveND> instead:
it runs faster and handles a variety of boundary conditions. it runs faster and handles a variety of boundary conditions.
=for bad =for bad
convolve does not process bad values. convolve does not process bad values.
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
=cut =cut
#line 111 "ImageND.pm"
#line 959 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
# Custom Perl wrapper # Custom Perl wrapper
sub PDL::convolve{ sub PDL::convolve{
my($x,$y,$c) = @_; my($x,$y,$c) = @_;
barf("Usage: convolve(a(*), b(*), [o]c(*)") if $#_<1 || $#_>2; barf("Usage: convolve(a(*), b(*), [o]c(*)") if $#_<1 || $#_>2;
$c = PDL->null if $#_<2; $c = PDL->null if $#_<2;
&PDL::_convolve_int( $x->clump(-1), $y->clump(-1), &PDL::_convolve_int( $x->clump(-1), $y->clump(-1),
long([$x->dims]), long([$y->dims]), long([$x->dims]), long([$y->dims]),
($c->getndims>1? $c->clump(-1) : $c) ($c->getndims>1? $c->clump(-1) : $c)
); );
$c->setdims([$x->dims]); $c->setdims([$x->dims]);
if($x->is_inplace) { if($x->is_inplace) {
$x .= $c; $x .= $c;
$x->set_inplace(0); $x->set_inplace(0);
return $x; return $x;
} }
return $c; return $c;
} }
#line 138 "ImageND.pm"
#line 960 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
*convolve = \&PDL::convolve; *convolve = \&PDL::convolve;
#line 145 "ImageND.pm"
#line 225 "imagend.pd" #line 225 "imagend.pd"
=head2 ninterpol() =head2 ninterpol()
=for ref =for ref
N-dimensional interpolation routine N-dimensional interpolation routine
=for sig =for sig
skipping to change at line 157 skipping to change at line 148
use PDL::Math 'floor'; use PDL::Math 'floor';
use PDL::Primitive 'interpol'; use PDL::Primitive 'interpol';
print 'Usage: $x = ninterpolate($point(s), $data);' if $#_ != 1; print 'Usage: $x = ninterpolate($point(s), $data);' if $#_ != 1;
my ($p, $y) = @_; my ($p, $y) = @_;
my ($ip) = floor($p); my ($ip) = floor($p);
# isolate relevant N-cube # isolate relevant N-cube
$y = $y->slice(join (',',map($_.':'.($_+1),list $ip))); $y = $y->slice(join (',',map($_.':'.($_+1),list $ip)));
for (list ($p-$ip)) { $y = interpol($_,$y->xvals,$y); } for (list ($p-$ip)) { $y = interpol($_,$y->xvals,$y); }
$y; $y;
} }
#line 192 "ImageND.pm" #line 173 "ImageND.pm"
#line 958 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
=head2 rebin =head2 rebin
=for sig =for sig
Signature: (a(m); [o]b(n); int ns => n) Signature: (a(m); [o]b(n); int ns => n)
=for ref =for ref
N-dimensional rebinning algorithm N-dimensional rebinning algorithm
skipping to change at line 197 skipping to change at line 186
Expansion is performed by sampling; reduction is performed by averaging. Expansion is performed by sampling; reduction is performed by averaging.
If you want different behavior, use L<PDL::Transform::map|PDL::Transform/map> If you want different behavior, use L<PDL::Transform::map|PDL::Transform/map>
instead. PDL::Transform::map runs slower but is more flexible. instead. PDL::Transform::map runs slower but is more flexible.
=for bad =for bad
rebin does not process bad values. rebin does not process bad values.
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
=cut =cut
#line 239 "ImageND.pm"
#line 959 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
# Custom Perl wrapper # Custom Perl wrapper
sub PDL::rebin { sub PDL::rebin {
my($x) = shift; my($x) = shift;
my($opts) = ref $_[-1] eq "HASH" ? pop : {}; my($opts) = ref $_[-1] eq "HASH" ? pop : {};
my(@idims) = $x->dims; my(@idims) = $x->dims;
my(@odims) = ref $_[0] ? $_[0]->dims : @_; my(@odims) = ref $_[0] ? $_[0]->dims : @_;
my($i,$y); my($i,$y);
foreach $i (0..$#odims) { foreach $i (0..$#odims) {
skipping to change at line 250 skipping to change at line 236
$norm *= $idims[$i]/$odims[$i]; $norm *= $idims[$i]/$odims[$i];
} }
} }
return $x * $norm; return $x * $norm;
} else { } else {
# Explicit copy so i) can't corrupt input PDL through this link # Explicit copy so i) can't corrupt input PDL through this link
# ii) don't waste space on invisible elements # ii) don't waste space on invisible elements
return $x -> copy; return $x -> copy;
} }
} }
#line 296 "ImageND.pm"
#line 960 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
*rebin = \&PDL::rebin; *rebin = \&PDL::rebin;
#line 303 "ImageND.pm"
#line 378 "imagend.pd" #line 378 "imagend.pd"
=head2 circ_mean_p =head2 circ_mean_p
=for ref =for ref
Calculates the circular mean of an n-dim image and returns Calculates the circular mean of an n-dim image and returns
the projection. Optionally takes the center to be used. the projection. Optionally takes the center to be used.
skipping to change at line 325 skipping to change at line 307
$sum = zeroes($rad->max+1); $sum = zeroes($rad->max+1);
PDL::indadd $x->clump(-1), $rad->clump(-1), $sum; # this does the real work PDL::indadd $x->clump(-1), $rad->clump(-1), $sum; # this does the real work
$norm = zeroes($rad->max+1); $norm = zeroes($rad->max+1);
PDL::indadd pdl(1), $rad->clump(-1), $norm; # equivalent to get norm PDL::indadd pdl(1), $rad->clump(-1), $norm; # equivalent to get norm
$sum /= $norm; $sum /= $norm;
$a1 = $x->clump(-1); $a1 = $x->clump(-1);
$a1 .= $sum->index($rad->clump(-1)); $a1 .= $sum->index($rad->clump(-1));
return $x; return $x;
} }
#line 378 "ImageND.pm"
#line 454 "imagend.pd" #line 454 "imagend.pd"
=head2 kernctr =head2 kernctr
=for ref =for ref
`centre' a kernel (auxiliary routine to fftconvolve) `centre' a kernel (auxiliary routine to fftconvolve)
=for usage =for usage
$kernel = kernctr($image,$smallk); $kernel = kernctr($image,$smallk);
fftconvolve($image,$kernel); fftconvolve($image,$kernel);
skipping to change at line 383 skipping to change at line 363
for ($n=0, $y=$i; $n <= $#ni; $n++, $y >>= 1) { for ($n=0, $y=$i; $n <= $#ni; $n++, $y >>= 1) {
next CHUNK if $stri[$n][$y & 1] eq ''; next CHUNK if $stri[$n][$y & 1] eq '';
$stri .= $stri[$n][$y & 1]; $stri .= $stri[$n][$y & 1];
$strk .= $strk[$n][$y & 1]; $strk .= $strk[$n][$y & 1];
} }
chop ($stri); chop ($strk); chop ($stri); chop ($strk);
(my $t = $newk->slice($stri)) .= $kern->slice($strk); (my $t = $newk->slice($stri)) .= $kern->slice($strk);
} }
$newk; $newk;
} }
#line 440 "ImageND.pm" #line 399 "ImageND.pm"
#line 958 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
=head2 convolveND =head2 convolveND
=for sig =for sig
Signature: (k0(); pdl *k; pdl *aa; pdl *a) Signature: (k0(); pdl *k; pdl *aa; pdl *a)
=for ref =for ref
Speed-optimized convolution with selectable boundary conditions Speed-optimized convolution with selectable boundary conditions
skipping to change at line 480 skipping to change at line 458
The direct copying code uses PP primarily for the generic typing: it includes The direct copying code uses PP primarily for the generic typing: it includes
its own broadcastloops. its own broadcastloops.
=for bad =for bad
convolveND does not process bad values. convolveND does not process bad values.
It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
=cut =cut
#line 546 "ImageND.pm"
#line 959 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
use PDL::Options; use PDL::Options;
# Perl wrapper conditions the data to make life easier for the PP sub. # Perl wrapper conditions the data to make life easier for the PP sub.
sub PDL::convolveND { sub PDL::convolveND {
my($a0,$k,$opt0) = @_; my($a0,$k,$opt0) = @_;
my $inplace = $a0->is_inplace; my $inplace = $a0->is_inplace;
my $x = $a0->new_or_inplace; my $x = $a0->new_or_inplace;
skipping to change at line 513 skipping to change at line 488
} else { } else {
my $z = $x->flat->index(0) + $k->flat->index(0); my $z = $x->flat->index(0) + $k->flat->index(0);
$type = $z->get_datatype; $type = $z->get_datatype;
} }
$x = $x->convert($type); $x = $x->convert($type);
$k = $k->convert($type); $k = $k->convert($type);
## Handle options -- $def is a static variable so it only gets set up once. ## Handle options -- $def is a static variable so it only gets set up once.
our $def; our $def;
unless(defined($def)) { unless(defined($def)) {
$def = new PDL::Options( { $def = PDL::Options->new( {
Method=>'a', Method=>'a',
Boundary=>'t' Boundary=>'t'
} }
); );
$def->minmatch(1); $def->minmatch(1);
$def->casesens(0); $def->casesens(0);
} }
my $opt = $def->options(PDL::Options::ifhref($opt0)); my $opt = $def->options(PDL::Options::ifhref($opt0));
skipping to change at line 584 skipping to change at line 559
} else { } else {
print "convolveND: using direct method\n" if($PDL::debug); print "convolveND: using direct method\n" if($PDL::debug);
### The first argument is a dummy to set $GENERIC. ### The first argument is a dummy to set $GENERIC.
&PDL::_convolveND_int( $k->flat->index(0), $k, $aa, $x ); &PDL::_convolveND_int( $k->flat->index(0), $k, $aa, $x );
} }
$x; $x;
} }
#line 657 "ImageND.pm"
#line 960 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm"
*convolveND = \&PDL::convolveND; *convolveND = \&PDL::convolveND;
#line 664 "ImageND.pm"
#line 34 "imagend.pd" #line 34 "imagend.pd"
=head1 AUTHORS =head1 AUTHORS
Copyright (C) Karl Glazebrook and Craig DeForest, 1997, 2003 Copyright (C) Karl Glazebrook and Craig DeForest, 1997, 2003
All rights reserved. There is no warranty. You are allowed All rights reserved. There is no warranty. You are allowed
to redistribute this software / documentation under certain to redistribute this software / documentation under certain
conditions. For details, see the file COPYING in the PDL conditions. For details, see the file COPYING in the PDL
distribution. If this file is separated from the PDL distribution, distribution. If this file is separated from the PDL distribution,
the copyright notice should be included in the file. the copyright notice should be included in the file.
=cut =cut
#line 683 "ImageND.pm" #line 626 "ImageND.pm"
# Exit with OK status # Exit with OK status
1; 1;
 End of changes. 16 change blocks. 
34 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)