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

Home » Public Forums » archive » !p.multi and tv
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: !p.multi and tv [message #11846 is a reply to message #11753] Fri, 29 May 1998 00:00 Go to previous messageGo to previous message
pit is currently offline  pit
Messages: 92
Registered: January 1996
Member
In article <6kkn02$h39$1@nnrp1.dejanews.com>,
csaute3@alumni.umbc.edu writes:
> In article <6jp3cl$jus$3@gwdu19.gwdg.de>,
> pit@uni-sw.gwdg.de wrote:

>> PRO Tvimg, image, xax, yax, position=pos, box=box, noerase=noerase, $
>> nolabels=nolabels, noscale=noscale, ASPECT=aspect, _EXTRA=extra
> [...]
>
> Tvimg.pro uses a function called "rescale". This is not an IDL function.
> Is this a routine that you wrote?

Yes - I overlooked it while scanning for unresolved routines - sorry:

Peter

-------------------------
FUNCTION Rescale, image, xsize, ysize, scale=scale
;+
; NAME:
; RESCALE
; PURPOSE:
; Expand or shrink a given (1- or 2-dimensional) Array to new size
; CATEGORY:
;
; CALLING SEQUENCE:
; RESULT = RESCALE( IMAGE, [[ XSIZE [, YSIZE]] || SCALE=Scale] )
; INPUTS:
; IMAGE : Original Image
; XSIZE : New dimension for the X-axis
; YSIZE : 1-d case: If ysize is given, a pseudo-2d Array of
; identical rows is returned, else a 1-dim Array of size
; xsize .
; 2-d case: If ysize is given it is taken as the new
; dimension for the Y-axis. If omitted, the Y-axis is
; scaled with the same factor as the X-axis to keep the
; aspect ratio
; KEYWORDS:
; SCALE : (input) 1- or 2-element vector with the scales for x
; and y axis. Overrides YSIZE and YSIZE.
; OUTPUTS:
; RESULT: Rescaled array of same type as IMAGE, size is
; (XSIZE,YSIZE) (1/2-d case, YSIZE given)
; (XSIZE,YOrig*XOrig/XSIZE) (2-d case, YSIZE omitted)
; (XSIZE) (1-d case, YSIZE omitted)
; PROCEDURE:
; Scale-Factors are computed from the Size of the original data
; and the parameters XSIZE and YSIZE. For 1-dim case SPLINE is
; used for interpolation, in 2-d case POLY_2D is used.
; MODIFICATION HISTORY:
; 19-Feb-1993 P.Suetterlin, KIS
;-

on_error, 2 ; Return on error

IF n_params() LT 2 AND NOT keyword_set(scale) THEN BEGIN
message, 'Usage: result = rescale( Image, XSize [, YSize] )'
ENDIF

s=size(image)
IF s(s(0)+1) EQ 8 THEN BEGIN ; Image is ST4-Structure?
pic = image.pic ; Only for my personal
; use
s = size(pic)
ENDIF ELSE pic = image

IF keyword_set(scale) THEN BEGIN
IF n_elements(scale) EQ 1 THEN scale = [scale, scale]
;;; scale overrides xsize/ysize
xsize = s(1)*scale(0)
IF s(0) NE 1 THEN ysize = s(2)*scale(1)
ENDIF

IF s(0) EQ 1 THEN BEGIN ; Image is 1-d Array
line = spline(indgen(s(1)), pic, $
findgen(xsize)/xsize*s(1))
IF n_params() EQ 3 THEN BEGIN ; Expand to 2-dim
scalepic = fltarr(xsize, ysize)
FOR i = 0, ysize-1 DO scalepic(*, i) = line
return, scalepic ; Return 2-dim
ENDIF ELSE return, line ; Return 1-dim
ENDIF ELSE BEGIN
IF n_params() LT 3 AND NOT keyword_set(scale) THEN $ ; Rescale Y by same
ysize = fix(s(2)*(float(xsize)/s(0))+.5) ; amount
P = [[0, 0], [float(s(1))/xsize, 0]] ; Matrices for
Q = [[0, float(s(2))/ysize], [0, 0]] ; Poly_2d
return, poly_2d(pic, P, Q, 1, xsize, ysize)
ENDELSE
END
--------------------------

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~
Peter "Pit" Suetterlin http://www.uni-sw.gwdg.de/~pit
Universitaets-Sternwarte Goettingen
Tel.: +49 551 39-5048 pit@uni-sw.gwdg.de
-- * -- * ...-- * -- * ...-- * -- * ...-- * -- * ...-- * -- * ...-- * --
Come and see the stars! http://www.kis.uni-freiburg.de/~ps/SFB
Sternfreunde Breisgau e.V. Tel.: +49 7641 3492
____________________________________________________________ ______________
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: PostScript and IDL, why object graphics ?
Next Topic: PostScript and IDL,

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

Current Time: Fri Oct 10 17:16:21 PDT 2025

Total time taken to generate the page: 1.76052 seconds