functions in imutil.i -
|
_sedgesort_double
|
_sedgesort_double | |
| SEE | _sedgesort_long | |
|
_sedgesort_float
|
_sedgesort_float | |
| SEE | _sedgesort_long | |
|
_sedgesort_short
|
_sedgesort_short | |
| SEE | _sedgesort_long | |
|
bilinear
|
bilinear(image,arg1,arg2,grid=,minus_one=,outside=)
Interpolate regularly sampled 2D arrays using bilinear interpolation.
bilinear(image,nrebin)
or bilinear(image,dimx,dimy)
or bilinear(image,x,y,grid=1)
or bilinear(image,x,y)
bilinear(image,nrebin)
Returns image interpolated by a factor N
Output dimension = N * input dimension
The whole image is interpolated
bilinear(image,dimx,dimy)
Returns interpolated image
Output dimension = dimx * dimy
The whole image is interpolated
bilinear(image,x,y,grix=1)
Returns interpolated image on a grid of points specified
by the coordinates x & y. The output is a 2D array
of dimension numberof(x) * numberof(y).
bilinear(image,x,y)
Returns image interpolated at points of coordinates (x,y).
X and Y can be of any dimension, e.g. scalar (but in that
case it should be entered as a one element vector to avoid
confusion with the second form, e.g. bilinear(im,[245.34],[45.3])),
vectors (for instance along a line of circle) or can be 2D
array to specify an arbitrary transform (e.g. a rotation).
This is the general form of bilinear.
NOTE on the input coordinates: In the input image, the lower
left pixel has coordinates [xin(1),yin(1)]=[1,1]. Pixels are
spaced by one unit, so [xin(2),yin(1)]=[2,1],...
KEYWORD minus_one specify that the last column/row should not
be extrapolated, i.e. the output image extend from xin(1) to
xin(0) inclusive, not beyond (same for y).
EXAMPLES: if "image" is a 512x512 image:
bilinear(image,2) returns image interpolated on a 1024x1024 grid
bilinear(image,1024,800) returns image interpolated on a 1024x800 grid
xreb=100+indgen(400)/2.;
yreb=50.4+indgen(200)/2.;
bilinear(image,xreb,yreb,grid=1) returns image, interpolated in 2D
over a XY grid defined by xreb and yreb.
bilinear(image,[300.3],[200.4]) returns the interpolation of image
at point [300.3,200.4]
bilinear(image,indgen(512),indgen(512)) returns a vector of values
interpolated at [x,y] = [[1,1],[2,2],...,[512,512]]
x = (indgen(400)/3.+50)*array(1,200)(-,);
y = (array(1,400)*(indgen(200)/2.+55)(-,));
bilinear(image,x,y) returns a 2D interpolated array at indices defined
by x and Y
xy = indices(512);
alpha = 34*pi/180.;
x = cos(alpha)*xy(,,1)+sin(alpha)*xy(,,2);
y = -sin(alpha)*xy(,,1)+cos(alpha)*xy(,,2);
bilinear(image,x,y) returns image rotated by alpha
| |
| SEE ALSO: | spline2, interp2 | |
|
bin2d
|
func bin2d(in,binfact)
Returns the input 2D array "in", binned with the binning factor "binfact".
The input array X and/or Y dimensions needs not to be a multiple of
"binfact"; The final/edge pixels are in effect replicated if needed.
This routine prepares the parameters and calls the C routine _bin2d.
The input array can be of type long, float or double.
Last modified: Dec 15, 2003.
Author: F.Rigaut
| |
| SEE ALSO: | _bin2d | |
|
cart2pol
|
cart2pol(image,&r,&theta,xc=,yc=,ntheta=,nr=,tor=,
splin=,outside=)
Cartesian to Polar coordinate coordinate mapping
image : input image, in cartesian coorindate (square grid)
optional output: r: 1D vector to hold the r coordinates at
which output image is mapped theta: same for theta
KEYWORDS:
xc, yc: Center for coordinate transform. Note that this is
compatible with the center defined by dist(), or rotate2(), but is
offset by 0.5 pixels w.r.t what you read on the yorick graphic
window. I.e. the center of the bottom- left pixel is (1,1) in this
function's conventions, not (0.5,0.5).
nr, ntheta: number of points over the output radius and theta range
tor: upper output radius value (in pixels)
splin: use spline2() instead of bilinear() for the interpolation
outside: value for outliers.
| |
| SEE ALSO: | rotate2, spline2, bilinear | |
|
clip
|
func clip(inarray, mini, maxi);
Returns the argument, which has been "clipped" to mini
and maxi, i.e. in which all elements lower than "mini"
have been replaced by "mini" and all elements greater
than "maxi" by "maxi".
Either "mini" and "maxi" can be ommited, in which case
the corresponding mini or maxi is not clipped.
Equivalent to the IDL ">" and "<" operators.
Can clip in place
prompt> clip,a,0.,1.
or out of place
prompt> res = clip(a,0.,1.)
F.Rigaut, 2001/11/10.
2003/12/4: Using now a C version which is called from this routine.
| |
|
cpc
|
func cpc(im,fmin,fmax)
return clipped image at
from cmin=fraction fmin of pixel intensity
to cmax=fraction fmax of pixel intensity
0 <= fmin < fmax <= 1
example: pli,cpc(im)
| |
| SEE ALSO: | ||
|
dist
|
func dist(dim,xc=,yc=)
Return an array which elements are the distance to (xc,yc). xc and
yc can be omitted, in which case they are defaulted to size/2+1.
F.Rigaut, 2003/12/10.
| |
| SEE ALSO: | ||
|
eclat
|
func eclat(image)
Equivalent, but significantly faster than roll. Transpose the four main
quadrants of a 2D array. Mostly used for FFT applications.
The C function can be called directly in time critical loops as
_eclat_type,&image,nx,ny
with type = long, float or double (e.g. _eclat_float,...)
Can invoque in place
prompt> eclat,image
or out of place
prompt> res = eclat(image)
F.Rigaut, 2001/11/10.
| |
| SEE ALSO: | roll | |
|
gaussdev
|
func gaussdev(dims)
Returns an array (as specified by dims) of random values
following a normal distribution of mean=0 and standard
deviation = 1.
EXAMPLES:
gaussdev(100) returns a 100 element vector
gaussdev([2,512,512]) returns a 512x512 array
print,gaussdev([2,512,512])(rms)
0.991666
| |
| SEE ALSO: | poidev | |
|
is_vector
|
is_vector | |
| SEE | is_scalar | |
|
poidev
|
func poidev(vec)
Compute random values following a Poisson Distribution.
Input: array containing the desired mean value(s)
output: randomized array of same dimension
EXAMPLE:
p = poidev(array(20.,[2,128,128]));
returns a 128x128 array with pixels following a Poisson distrib.
of mean=20.
| |
| SEE ALSO: | gaussdev | |
|
rotate2
|
rotate2(image,angle,xc=,yc=,splin=,outside=)
Rotate the input image. Angle is in degrees, CCW.
KEYWORDS:
xc, yc: Center for coordinate transform. Note that this is
compatible with the center defined by dist(), or cart2pol(), but is
offset by 0.5 pixels w.r.t what you read on the yorick graphic
window. I.e. the center of the bottom- left pixel is (1,1) in this
function's conventions, not (0.5,0.5).
splin: use spline2() instead of bilinear() for the interpolation
outside: value for outliers.
| |
| SEE ALSO: | spline2, cart2pol, bilinear | |
|
sedgemedian
|
func sedgemedian(vec)
Returns the median of the input array (1D). Uses sedgesort fast
sort.
| |
| SEE ALSO: | sedgesort, median | |
|
sedgesort
|
func sedgesort(vec)
Fast sort method. Typically 2 to 5 times faster than the yorick
stock function. Only valid input is a 1D array.
WARNING! Returns the sorted vector. This is different than the
stock yorick sort, which returns a vector of indices.
| |
| SEE ALSO: | sort, sedgemedian | |
|
spline2
|
spline2(image,arg1,arg2,grid=,minus_one=,outside=,mask=)
Interpolate regularly sampled 2D arrays using 2D spline.
spline2(image,nrebin)
or spline2(image,dimx,dimy)
or spline2(image,x,y,grid=1)
or spline2(image,x,y)
spline2(image,nrebin)
Returns image interpolated by a factor N
Output dimension = N * input dimension
The whole image is interpolated
spline2(image,dimx,dimy)
Returns interpolated image
Output dimension = dimx * dimy
The whole image is interpolated
spline2(image,x,y,grix=1)
Returns interpolated image on a grid of points specified
by the coordinates x & y. The output is a 2D array
of dimension numberof(x) * numberof(y).
spline2(image,x,y)
Returns image interpolated at points of coordinates (x,y).
X and Y can be of any dimension, e.g. scalar (but in that
case it should be entered as a one element vector to avoid
confusion with the second form, e.g. spline2(im,[245.34],[45.3])),
vectors (for instance along a line of circle) or can be 2D
array to specify an arbitrary transform (e.g. a rotation).
This is the general form of spline2. It is significantly
slower than the previous forms that take advantage of the
cartesian nature of the output coordinates, so don't
use it unless it is necessary.
NOTE on the input coordinates: In the input image, the lower
left pixel has coordinates [xin(1),yin(1)]=[1,1]. Pixels are
spaced by one unit, so [xin(2),yin(1)]=[2,1],...
KEYWORD minus_one specify that the last column/row should not
be extrapolated, i.e. the output image extend from xin(1) to
xin(0) inclusive, not beyond (same for y).
KEYWORD mask can be used if some of the input image pixels
are invalid and not to be used to compute the output image.
Bad pixel can be interpolated using mask. Mask is an array
of same dimension as image. 0 mark an invalid data point.
EXAMPLES: if "image" is a 512x512 image:
spline2(image,2) returns image interpolated on a 1024x1024 grid
spline2(image,1024,800) returns image interpolated on a 1024x800 grid
xreb=100+indgen(400)/2.;
yreb=50.4+indgen(200)/2.;
spline2(image,xreb,yreb,grid=1) returns image, interpolated in 2D
over a XY grid defined by xreb and yreb.
spline2(image,[300.3],[200.4]) returns the interpolation of image
at point [300.3,200.4]
spline2(image,indgen(512),indgen(512)) returns a vector of values
interpolated at [x,y] = [[1,1],[2,2],...,[512,512]]
x = (indgen(400)/3.+50)*array(1,200)(-,);
y = (array(1,400)*(indgen(200)/2.+55)(-,));
spline2(image,x,y) returns a 2D interpolated array at indices defined
by x and Y
xy = indices(512);
alpha = 34*pi/180.;
x = cos(alpha)*xy(,,1)+sin(alpha)*xy(,,2);
y = -sin(alpha)*xy(,,1)+cos(alpha)*xy(,,2);
spline2(image,x,y) returns image rotated by alpha
| |
| SEE ALSO: | bilinear, spline | |