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

Home » Public Forums » archive » Re: Fractional SHIFT
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: Fractional SHIFT [message #28348 is a reply to message #28345] Mon, 03 December 2001 13:34 Go to previous messageGo to previous message
tam is currently offline  tam
Messages: 48
Registered: February 2000
Member
For 1-D you could try the interpol function rather than interpolate...
It seems to extrapolate beyond the grid which seems to be what you want.
You need to specify both x and y values. I.e., you'll

new = INTERPOL(xvals, yvals, xvalues_to_interpolate_at)

Personally I've always found the behavior of interpolate to be
more useful, but typically I'm worried about going over the edge
of an image....

Tom McGlynn

trouble wrote:
>
> Hi,
>
> Does anyone have a method for doing non-integer shifts ? Interpolate
> doesn't wrap in the way SHIFT does and my hack (based on MOD) is a bit
> dodgy.
>
> To shift orig by 1.5 pixels:
>
> orig = FINDGEN(10)
>
> index = FINDGEN(10)
> delta = 1.5
> index2 = (index+delta) MOD 10
>
> new = INTERPOLATE(orig,index2,/GRID)
>
> PRINT,new
>
> 1.50000 2.50000 3.50000 4.50000 5.50000
> 6.50000
> 7.50000 8.50000 9.00000 0.500000
>
> The 2nd last element of new is wrong (should be 9.5).
>
> Does anyone know a robust way ?
>
> Ciao.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: DICOM writer
Next Topic: Windows XP

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

Current Time: Thu Oct 16 19:06:23 PDT 2025

Total time taken to generate the page: 0.23783 seconds