Pro Rdpixk, Image,X0, Y0,xo,yo,ifact,icount,img,xp,yp ;Read the value of the pixel of ;the ORIGINAL image that happens to be under the ;cursor. ;Display x,y and the pixel value under the cursor ;of a ZOOM-ed image. Write the coordinates to a file ;as well as to the screen. ; NAME: ; RDPIXk ; PURPOSE: ; Display the X, Y, and pixel value of the cursor on a ZOOM-ed image, ; as well as the values of the corresponding spectral images. ; write the coordinates to a file. ; CATEGORY: ; Image display ; CALLING SEQUENCE: (NOTE: this procedure is called only from within ; specdisplay.) ; RDPIXK, Image [, X0, Y0],xo,yo,ifact,icount,img ; INPUTS: ; Image = Zoomed image. ; xo,yo = location of lower left corner of zoomed image in the ; pixel-space of the original image. ; ifact = the scaling factor by which the image has been zoomed. ; icount = a book-keeping term which, if 0, signifies that this is ; the first time rdpix2 has been called during a particular session ; of zoom2. ; img = the original, NON-scaled-for-display image. ; OPTIONAL INPUT PARAMETERS: ; X0, Y0 = Optional location of lower left corner of image area on ; screen. ; OUTPUTS: ; None. ; COMMON BLOCKS: ; None. ; SIDE EFFECTS: ; The X, Y and value of pixel under the cursor are constantly ; displayed. Cursor values indicate values of the original image. ; The "Scaled value" idicates the value scaled to an integer from ; 0 to 32000, such as would be done to the image for processing of the ; image with SRS. ; Pressing left or center mouse button, makes a new line of output, ; saving the old to both the screen and a file. ; Pressing right mouse button exits the procedure, giving control ; back to zoom2. ; RESTRICTIONS: ; None. ; PROCEDURE: ; Straightforward. ; MODIFICATION HISTORY: ; J.Ingalls 1991 ; K. Tsetsenekos 1997 - altered to allow analysis of spectral images ;- ;+ ; common block1,redweight,blueweight,greenweight,red1,blue1,green1 rw=redweight & bw=blueweight & gw=greenweight print,'RDPIX ENGAGED' print,'Please Wait' print,' ' ;- ; first determine the scaled image: ; min_img=min(img) max_img=max(img)-min_img newimage=img-min_img newimage=(32000/max_img)*newimage inewimage=fix(newimage) ; ;if (icount eq 0)then begin ;openw,unit,'stars.ppos',/get_lun ;endif else begin openw,unit,'stars.ppos',/append,/get_lun ;endelse print,'Press left mouse button to pan ' print,'... center mouse button for new output line.' print,'... right mouse button to exit.' print,' ' s = size(image) if s(0) ne 2 then begin print,'Rdpix -- Image parameter not 2d' return end s(1) = s(1)-1 ;To n-1 s(2) = s(2)-1 !err=0 x1=-1 & y1=-1 ;Previous values if n_elements(x0) le 0 then x0 = 0 if n_elements(y0) le 0 then y0 = 0 if s(s(0)+1) ge 4 then form = 'F' else form = 'I' cr = string("15b) ;form="($,'x=',i4,', y=',i4,', value=',f9.3,', scaled value=',i5,a,a)" ;form="($,'x=',i4,', y=',i4,', value=',e9.3,a,a)" ;form="($,'x=',i4,', y=',i4,', red value=',i4,', red weight=',i2,', green value=',i4,', green weight=',i2,', blue value=',i4,', blue weight=',i2,a,a)" form="($,'x=',i4,', y=',i4,', red weight=',i2,', green weight=',i2,', blue weight=',i2,a,a)" form2="(2i6)" new_wind=-1 old_wind=!d.window ierase = 0 ;erase plot window flag while !err ne 4 do begin tvrdc,x,y,2,/dev if (!err eq 2) then begin ;New line? ; since tvrdc sees pixels as being of only one size, the x and y ; coordinates that it sees must be divided by ifact, the zooming factor, ; to get a coordinate in the pixel space of the original image. ; This must occur in conjunction with the addition of the ; vector (xo,yo) to the zoomed image, which tvrdc sees as beginning with ; pixel (0,0). printf,unit,form=form2,x/ifact+xo,y/ifact+yo print,form="($,a)",string("12b) if new_wind lt 0 then begin ;Make new window? window,/free,xsiz=512,ysiz=512 new_wind=!d.window endif else begin wset,new_wind if ierase then erase ;Erase it? ierase = 0 endelse cart_conv,0,0,70,x,y,spectrum,waves plot,waves,spectrum wset,old_wind while (!err ne 0) do begin wait,.1 & tvrdc,x,y,0,/dev & end endif if (!err eq 1) then begin b=' ' print,string(format='(a51)',b) print,'Click on point you want to pan to.' cursor,xp,yp,3,/dev xp=xp/ifact+xo yp=yp/ifact+yo goto,done endif x = x-x0 & y = y - y0 if !order ne 0 then yy = (s(2) > !d.y_vsize) - 1 - y $ else yy = y ; if (x le s(1)) and (yy le s(2)) and (x ge 0) and $ ; (y ge 0) then $ ix=fix(x/ifact)+xo iy=fix(y/ifact)+yo ; iy=iy < 527 ; ix=ix < 527 ; red=red1(ix,iy) & blue=blue1(ix,iy) & green=green1(ix,iy) ; print,form=form,ix,iy,red,rw,green,gw,blue,bw,cr,string(15b) print,form=form,ix,iy,rw,gw,bw,cr,string(15b) ; print,form=form,ix,iy,img(ix,iy),cr,string(15b) ; print,x,y,img(ix,iy),cr,string(15b) x1 = x & y1=y endwhile print,form="(/)" print,'RDPIX MODE DISENGAGED' if (new_wind ge 0) then wdelete,new_wind print,form="(/)" done: free_lun,unit end