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

Home » Public Forums » archive » Re: rdpix problem
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: rdpix problem [message #3491] Sat, 28 January 1995 05:20
knipp is currently offline  knipp
Messages: 68
Registered: January 1993
Member
Hi Robert

I guess the problem lies within the code to set the cursor back to the
start of the line, without getting a new line.

Try the following modification of RDPIX (apply it to rdpix or better, code a
new my_rdpix):

vvvvvvvvvvvvvvvvvvvvvvvvvvvv SNIP vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv


; $Id: rdpix.pro,v 1.1 1993/04/02 19:43:31 idl Exp $

Pro Rdpix, Image,X0, Y0 ;Read the value of the pixel under the cursor
;Display x,y and the pixel value under the cursor
;+
; NAME:
; RDPIX
;
; PURPOSE:
; Interactively display the X position, Y position, and pixel value
; of the cursor.
;
; CATEGORY:
; Image display.
;
; CALLING SEQUENCE:
; RDPIX, Image [, X0, Y0]
;
; INPUTS:
; Image: The array that represents the image being displayed. This
; array may be of any type. Rather reading pixel values from
; the display, they are taken from this parameter, avoiding
; scaling difficulties.
;
; OPTIONAL INPUT PARAMETERS:
; X0, Y0: The location of the lower-left corner of the image area on
; screen. If these parameters are not supplied, they are
; assumed to be zero.
;
; OUTPUTS:
; None.
;
; COMMON BLOCKS:
; None.
;
; SIDE EFFECTS:
; The X, Y, and value of the pixel under the cursor are continuously
; displayed.
;
; RESTRICTIONS:
; None.
;
; PROCEDURE:
; Instructions are printed and the pixel values are printed as the
; cursor is moved over the image.
;
; Press the left or center mouse button to create a new line of output,
; saving the previous line.
;
; Press the right mouse button to exit the procedure.
;
; MODIFICATION HISTORY:
; DMS, Dec, 1987.
; Rob Montgomery (rob@hao.ucar.edu), 9/21/92;
; Correct indices for case of !order = 1
; Karlheinz Knipp, IPI (knipp@ipi.uni-hannover.de), JAN 28,'95:
; mod: tvrdc --> cursor
; while --> repeat
; string("12b) --> 29 * (string(8b))
;
;-

on_error,2 ;Return to caller if an error occurs
print,'Press left or center mouse button for new output line."
print,'... right mouse button to exit.'
s = size(image)
if s(0) ne 2 then message, 'Image parameter not 2d.'
s(1) = s(1)-1 ;To n-1
s(2) = s(2)-1
!err=0
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) ;this codes a newline
form="($,'x=',i4,', y=',i4,', value=',"+form+",a)"

; kk 950128: -------------------------------------------
formlen = 29 ; kk 950128
ltab = string(8b) ; kk 950128
for i=2,formlen do ltab = ltab + string(8b) ; kk 950128

repeat begin ; ori: !err, while

cursor,x,y,/change,/dev ; ori: tvrdc

if (x le s(1)) and (y le s(2)) and (x ge 0) and (y ge 0) then begin
if (!order eq 1) then yy = s(2) - y else yy = y

if !mouse.button eq 0 $
then print, form=form, x,y,Image(x,yy),ltab $
else print, form=form, x,y,Image(x,yy),cr

endif

; original; --------------------------------------------------------
; tvrdc,x,y,2,/dev
; if (!err and 3) ne 0 then begin ;New line?
; print,form="($,a)",string("12b)
; while (!err ne 0) do begin wait,.1 & tvrdc,x,y,0,/dev & end
; endif
; x = x-x0 & y = y - y0
; if (x le s(1)) and (y le s(2)) and (x ge 0) and (y ge 0) then begin
; if (!order eq 1) then yy = s(2) - y else yy = y
; print,form = form, x,y,Image(x,yy),cr
; endif
; ------------------------------------------------------------ -------

endrep until !mouse.button eq 4

print,form="(/)"
end


^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SNAP ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


It does work under IDL 3.6 / SunOs 4.1.x

Hope this helps

Karl

____________________________________________________________ __________________
__ ____ __
/ // _ \ / / Karlheinz Knipp phone: +49 511 - 762 4922
/ // /_/ // / University of Hannover fax: +49 511 - 762 2483
/ // ____// / Institute for Photogrammetry
/ // / / / Nienburger Str.1
/_//_/ /_/ FRG 30167 Hannover e-mail: knipp@ipi.uni-hannover.de
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: "True" map projections
Next Topic: Getting memory overflow on array concat; why?

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

Current Time: Wed Oct 08 19:15:38 PDT 2025

Total time taken to generate the page: 0.00460 seconds