; $Id: display.pro,v 6.0 11/06/2004$ ; ; (c) 2004 Javier G Corripio ; Javier.Corripio@ethz.ch ; open source ;+ ; NAME: ; DISPLAY ; ; PURPOSE: ; display an image in real pixel dimensions with an optional colorbar ; ; USAGE ; DISPLAY, image [,/colorbar] ; ; ; MODIFICATION HISTORY: ; Written by: Javier G. Corripio before June, 2004 ; modified after June 2004 :) ; ; EXAMPLE ; cd, 'e:/arolla' ; dem=read_tiff('arolla.tif') ; DISPLAY, dem, /colorbar, title='Arolla elevation range' ; ;- PRO display,image, COLORBAR=colorbar, _extra=extra On_error, 2 IF (n_params() LT 1) THEN BEGIN message, 'USAGE: DISPLAY, image [,/colorbar, + TV keywords]',/INFO message, 'image can also be a tiff image file name and path',/INFO RETURN ENDIF img=image typ = 'TIFF' IF size(image,/type) EQ 7 THEN BEGIN img = Query_Image(image, Type=typ) img = Read_Image(image) ENDIF device, get_decomposed=thisdecomposed device, decomposed=0 dim = size(size(img,/dimensions),/dimensions) dim=dim[0] IF dim EQ 3 THEN thisTRUE = 1 ELSE IF dim EQ 2 THEN thisTRUE=0 ELSE BEGIN print, 'INCORRECT NUMBER OF DIMENSIONS' RETURN ENDELSE wnum=!d.window+1 IF typ EQ 'TIFF' THEN order=1 ELSE order = 0 switchcolorbar=1 sz=size(img,/dimensions) xwsize = sz(dim-2) ywsize = sz(dim-1) IF N_ELEMENTS(colorbar) EQ 0 THEN switchcolorbar = 0 xwaddition = MAX([150, xwsize *.2]) if switchcolorbar then xwsize = xwsize + xwaddition window,wnum,xsize=xwsize,ysize=ywsize tvscl,img,true=thistrue,order=order,_extra=extra if switchcolorbar then begin mini = MIN(img) maxi= MAX(img) colorbar, range=[mini,maxi], /vertical,$ title=cbtitle, POSITION=[0.90, 0.15, 0.95, 0.95],charsize=1.25,_extra=extra endif device, decomposed=thisdecomposed end