[AIT logo]

Institut für Astronomie und Astrophysik

Abteilung Astronomie

Sand 1, D-72076 Tübingen, Germany
New Address!   --   Neue Adresse!
[Uni logo]


FREBIN Source code in frebin.pro

FREBIN

Name
   FREBIN
Purpose
   Shrink or expand the size of an array an arbitary amount using interpolation
Explanation
   FREBIN is an alternative to CONGRID or REBIN.    Like CONGRID it
   allows expansion or contraction by an arbitary amount. ( REBIN requires
   integral factors of the original image size.)    Like REBIN it conserves
   flux by ensuring that each input pixel is equally represented in the output
   array.
Calling Sequence
   result = FREBIN( image, nsout, nlout, [ /TOTAL] )
Input Parameters
    image - input image, 1-d or 2-d numeric array
    nsout - number of samples in the output image, numeric scalar
Optional Input Parameters
    nlout - number of lines in the output image, numeric scalar
            If not supplied, then set equal to 1
Keyword Parameters
   /total - if set, the output pixels will be the sum of pixels within
          the appropriate box of the input image.  Otherwise they will
          be the average.    Use of the /TOTAL keyword conserves surface flux.
Output Parameters
    The resized image is returned as the function result.    If the input
    image is of type DOUBLE or FLOAT then the resized image is of the same
    type.     If the input image is BYTE, INTEGER or LONG then the output
    image is usually of type FLOAT.   The one exception is expansion by
    integral amount (pixel duplication), when the output image is the same
    type as the input image.
Example
     Suppose one has an 800 x 800 image array, im, that must be expanded to
     a size 850 x 900 while conserving surface flux:
     IDL> im1 = frebin(im,850,900,/total)
     im1 will be a 850 x 900 array, and total(im1) = total(im)
Note
    If the input image sizes are a multiple of the output image sizes
    then FREBIN is equivalent to the IDL REBIN function for compression,
    and simple pixel duplication on expansion.
    If the number of output pixels are not integers, the output image
    size will be truncated to an integer.  The platescale, however, will
    reflect the non-integer number of pixels.  For example, if you want to
    bin a 100 x 100 integer image such that each output pixel is 3.1
    input pixels in each direction use:
           n = 100/3.1   ; 32.2581
          image_out = frebin(image,n,n)
     The output image will be 32 x 32 and a small portion at the trailing
     edges of the input image will be ignored.
Procedures Used
    None.
Revision History
    Adapted from May 1998 STIS  version, written D. Lindler, ACC
    Added /NOZERO, use INTERPOLATE instead of CONGRID, June 98 W. Landsman
    Fixed for nsout non-integral but a multiple of image size  Aug 98 D.Lindler
    DJL, Oct 20, 1998, Modified to work for floating point image sizes when
               expanding the image.
    Improve speed by addressing arrays in memory order W.Landsman Dec/Jan 2001

Last modified by pro2html on 2002 January 16 at 04:40 UTC

[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]

Jörn Wilms (wilms@astro.uni-tuebingen.de)
Updated automatically