ImageND.pm (PDL-2.081) | : | ImageND.pm (PDL-2.082) | ||
---|---|---|---|---|
skipping to change at line 55 | skipping to change at line 55 | |||
=head1 FUNCTIONS | =head1 FUNCTIONS | |||
=cut | =cut | |||
#line 95 "imagend.pd" | #line 95 "imagend.pd" | |||
use Carp; | use Carp; | |||
#line 71 "ImageND.pm" | #line 71 "ImageND.pm" | |||
#line 949 "/home/osboxes/pdl-code/blib/lib/PDL/PP.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 88 | skipping to change at line 88 | |||
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 111 "ImageND.pm" | |||
#line 950 "/home/osboxes/pdl-code/blib/lib/PDL/PP.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) | |||
skipping to change at line 111 | skipping to change at line 111 | |||
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 138 "ImageND.pm" | |||
#line 951 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm" | #line 960 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm" | |||
*convolve = \&PDL::convolve; | *convolve = \&PDL::convolve; | |||
#line 145 "ImageND.pm" | #line 145 "ImageND.pm" | |||
#line 225 "imagend.pd" | #line 225 "imagend.pd" | |||
=head2 ninterpol() | =head2 ninterpol() | |||
=for ref | =for ref | |||
skipping to change at line 159 | skipping to change at line 159 | |||
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 192 "ImageND.pm" | |||
#line 949 "/home/osboxes/pdl-code/blib/lib/PDL/PP.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 199 | skipping to change at line 199 | |||
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 239 "ImageND.pm" | |||
#line 950 "/home/osboxes/pdl-code/blib/lib/PDL/PP.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 252 | skipping to change at line 252 | |||
} | } | |||
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 296 "ImageND.pm" | |||
#line 951 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm" | #line 960 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm" | |||
*rebin = \&PDL::rebin; | *rebin = \&PDL::rebin; | |||
#line 303 "ImageND.pm" | #line 303 "ImageND.pm" | |||
#line 378 "imagend.pd" | #line 378 "imagend.pd" | |||
=head2 circ_mean_p | =head2 circ_mean_p | |||
=for ref | =for ref | |||
skipping to change at line 385 | skipping to change at line 385 | |||
$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 440 "ImageND.pm" | |||
#line 949 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm" | #line 958 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm" | |||
=head2 convolveND | =head2 convolveND | |||
=for sig | =for sig | |||
Signature: (k0(); SV *k; SV *aa; SV *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 | |||
=for usage | =for usage | |||
$new = convolveND($x, $kernel, [ {options} ]); | $new = convolveND($x, $kernel, [ {options} ]); | |||
Conolve an array with a kernel, both of which are N-dimensional. | Conolve an array with a kernel, both of which are N-dimensional. | |||
skipping to change at line 482 | skipping to change at line 482 | |||
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 546 "ImageND.pm" | |||
#line 950 "/home/osboxes/pdl-code/blib/lib/PDL/PP.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 586 | skipping to change at line 586 | |||
### 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 657 "ImageND.pm" | |||
#line 951 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm" | #line 960 "/home/osboxes/pdl-code/blib/lib/PDL/PP.pm" | |||
*convolveND = \&PDL::convolveND; | *convolveND = \&PDL::convolveND; | |||
#line 664 "ImageND.pm" | #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 | |||
End of changes. 10 change blocks. | ||||
10 lines changed or deleted | 10 lines changed or added |