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

Home » Public Forums » archive » Interactive plotting
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: Interactive plotting [message #8957 is a reply to message #4970] Tue, 20 May 1997 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
John Harlander writes:

> Can someone point me to a method for interactively extracting and plotting a
> row or a column from two-dimensional data? I recall watching someone do this
> in IDL. The image was put on the screen and the cursor was used to
select the
> row or column.

I will be very disappointed, John, if you don't hear from about
500-600 people who have written this program in one of my
IDL programming classes. :-)

Here is an non-widgetized example program called ROWCOL.
There is an IDL library program called PROFILES that does
about the same thing.

Cheers!

David

------------------------------------------------------------ ---
PRO ROWCOL, image

ON_ERROR, 1

IF N_ELEMENTS(image) EQ 0 THEN MESSAGE, 'You must pass an IMAGE parameter.'

; Get image size.

s = SIZE(image)
xsize = s(1)
ysize = s(2)

; Open an image window the right size. Display image.

WINDOW, XSIZE=xsize, YSIZE=ysize, /FREE, TITLE='Image Window'
imageWindow = !D.WINDOW
TVSCL, image

; Create a window for the profile plots.

WINDOW, XSIZE=500, YSIZE=300, /FREE, TITLE='Profile Window'
profileWindow = !D.WINDOW
col = xsize / 2
row = ysize / 2

; Make the display window the current window.

WSET, imageWindow

; Initialize the !MOUSE.BUTTON system variable.

!MOUSE.BUTTON = 0

; Set window up for two plots.

!P.MULTI = [0, 2, 1, 0, 1]

; Go into your loop.

WHILE !MOUSE.BUTTON NE 4 DO BEGIN

; Draw the profiles in the profile window.

WSET, profileWindow
PLOT, image(col, *), TITLE='Column Profile', $
YRANGE=[MIN(image), MAX(image)], $
XRANGE=[0,xsize], XSTYLE=1, $
XTITLE='Column ' + STRTRIM(col, 2), YTITLE='Pixel Value'
PLOT, image(*, row), TITLE='Row Profile', $
YRANGE=[MIN(image), MAX(image)], $
XRANGE=[0,ysize], XSTYLE=1, $
XTITLE='Row ' + STRTRIM(row,2), YTITLE='Pixel Value'

; Make the image window the current window.

WSET, imageWindow

; Get the cursor location.

CURSOR, col, row, /DEVICE

ENDWHILE

; Turn off !P.MULTI system variable.

!P.MULTI = 0
END
------------------------------------------------------------ --------

----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
Customizable IDL Programming Courses
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
[Message index]
 
Read Message
Read Message
Previous Topic: Increase Traffic...Post Free Links
Next Topic: widget_control, /destroy (buttons)

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

Current Time: Sat Oct 11 14:44:11 PDT 2025

Total time taken to generate the page: 1.43402 seconds