PRO DISP_IMAGE,A,wid,_EXTRA=extra ;+ ;DISP_IMAGE,A opens a window of the correct size for an image ;array A and displays the image. If A is a RGB image then the ;display is in color. It does not set the palette or the decomposed ;state. ; ;DISP_IMAGE,A,wid displays A in window ID wid. ; ;Keywords are passed through to the TV command. ;- sa=size(A,/dim) CASE N_ELEMENTS(sa) OF 2: BEGIN color=0 ncols=sa[0] nrows=sa[1] END ;DIM=2 3: BEGIN color=1 TRUE=1+(WHERE(sa EQ 3))[0] CASE TRUE OF 0: MESSAGE,'Not monochrome or color image' 1: BEGIN ncols=sa[1] nrows=sa[2] END 2: BEGIN ncols=sa[0] nrows=sa[2] END 3: BEGIN ncols=sa[0] nrows=sa[1] END END ;TRUE END ; DIM=3 ELSE: MESSAGE,'Usage: Array must be a 2D or 3D (color) image' ENDCASE IF n_params() EQ 2 THEN $ WINDOW,wid,xs=ncols,ys=nrows,_EXTRA=extra ELSE $ WINDOW,/free,xs=ncols,ys=nrows,_EXTRA=extra IF color THEN TV,A,TRUE=true,_EXTRA=extra ELSE $ TV,A,_EXTRA=extra END