comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: What is like CONGRID, but averages on reduction?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: What is like CONGRID, but averages on reduction? [message #5102] Wed, 11 October 1995 00:00
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
grunes@news.nrl.navy.mil (Mitchell R Grunes) wrote:
> Subject: What is like CONGRID, but averages on reduction?
> I need to reduce the size of an array by an arbitrary (non-integral)
> factor, using an averaging algorithm. Is there such a routine
> in IDL and/or PV-WAVE?
> When I display an image that is larger than the window, I use:
> A=REBIN(A,XSZ,YSZ)
> or
> A=CONGRID(A,XSZ,YSZ)
> The problem with REBIN is that XSZ and YSZ must be integral factors
> of the size of A. This means that I often can not take advantage
> of the whole screen. But it is able to average things down (as
> long as I don't set /SAMPLE), so bright and dark points don't get
> lost.

If it's image display you are most concerned with, then try the TVIM
procedure from the excellent ESRG user library package. You can get it from
ftp.crseo.ucsb.edu in pub/idl/esrg_idl_3.2.tar.Z

In your example, the array could be displayed in three ways:

A=INTARR(9,9)
A(3,3)=1
; This will display a square at (3,3)
TVIM,A
; This will display a smoothed peak at (3,3), from bilinear interpolation
TVIM,A,INTERP=1
; This will display a smoothed peak at (3,3) which most accurately represents
; the cell center value of the pixels, but introduces an extrapolation on the
; outer edges, which can have a noticeable effect on small image arrays.
TVIM,A,INTERP=2

TVIM is the best way I have found to display images of arbitrary size scaled to
fit the current graphics window. It also offers very nice color scale and
labelling options (it displays the image in a plot window), and offers very
easy interfacing to Postscript output via the ESRG library TOGGLE command.

Full credit goes to Paul Ricchiazzi of the Earth Space Research Group at UCSB
for creating one of the most useful IDL procedures I've found. I hardly ever
use TV or TVSCL any more - TVIM is much more useful.

Cheers,
Liam.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Scaling of axes 1:1?
Next Topic: Problem: !D.Y_SIZE in PS portrait

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:52:57 PDT 2025

Total time taken to generate the page: 0.00483 seconds