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

Home » Public Forums » archive » REBIN Question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: REBIN Question [message #11250 is a reply to message #11091] Wed, 18 March 1998 00:00 Go to previous messageGo to previous message
pford is currently offline  pford
Messages: 33
Registered: September 1996
Member
Thanks to all who replied. I see that I need to use reform, but now I
understand why rebin was giving the "odd" results.

Patrick Ford, MD
pford@bcm.tmc.edu


Armand J.L.Jongen (a.j.jongen@amc.uva.nl) wrote:
: Hi Patrick

: Patrick Ford, MD wrote:
: > =

: > REBIN question
: > =

: > Either I have uncovered a bug in REBIN in the Mac version of IDL V 5.0.=
: 3
: > or I don=B9t fully understand how REBIN works. I want to take a 2-D by=
: te
: > array at_target that is 64X64 in size and make it into a 1-D byte array=

: > with the same number of elements and vis versa. The results are not wh=
: at
: > I am expecting so I used the code below to test it. The displayed image=
: s
: > are not even close to each other.
: > =

: > Would someone be kind enough to explain why and how I can do this other=

: > than using the code below(test2) the offending section.
: > =

: > Thanks.
: > =


: I finally understand what you want to do and what is happening. The
: trick is =

: that rebin does change the contents of the array by bilineair
: interpolation when
: maximizing a dimension and neighbourhood averaging when minimizing. By
: doing =

: rebin(at_target, 64*64) on a bytarr(64,64) you rescale this array, =

: thus getting a bytarr(4096,1). BUT! Rebin uses neighborhood averaging
: whereby
: your code:

: > at_target=3D bytarr(64,64)
: > at_target(0:63,0:63) =3D 255B
: > at_target(10:20,10:20) =3D 200B;

: produces a bytarr(4096,1) with roughly

: at_target(640:1280,1) EQ 200B

: If you then again use rebin(at_target,64,64) this image will be
: stretched
: in the second dimension whereby making at_target(10:20,*) EQ 200B. So
: instead
: of a square you end up with a line!

: This is not what you want to do. You should use REFORM instead which
: will only
: change the way in which the array-elements are indexed and NOT alter the
: actual
: data. Doing this in both instances will give the desired result.

: pro test
: window,5,xsize=3D 128, ysize =3D 128
: window,6,xsize=3D 128, ysize =3D 128
: =

: at_target=3D bytarr(64,64)
: at_target(0:63,0:63) =3D 255B
: at_target(10:20,10:20) =3D 200B;
: =

: wset,5
: tvscl, at_target
: wset,6
: ; REBIN modifies the data
: ; tvscl, rebin(rebin(at_target, 64*64),64,64)
: ; REFORM does NOT modify the data
: tvscl, reform(reform(at_target, 64*64),64,64)
: end

: Hope this makes things a bit clear. Cheers,

: Armand

: -- =

: ************************************************************ ************
: Armand J.L. Jongen Academic Medical Centre
: Laser Centre
: Phone +31-20-5667418 \\||||// Meibergdreef 9
: Fax +31-20-6975594 | ~ ~ | 1105 AZ Amsterdam
: E-mail a.j.jongen@amc.uva.nl [| o o |] The Netherlands
: *****************************o00o***(__)***o00o************* ************
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: A little handy date function
Next Topic: Want to get Array(48) instead of Array(1,48)

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

Current Time: Wed Oct 08 18:40:00 PDT 2025

Total time taken to generate the page: 0.00443 seconds