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

Home » Public Forums » archive » array index, data coordinates, rotate direction, ...
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
array index, data coordinates, rotate direction, ... [message #45276] Wed, 24 August 2005 10:56
mmiller3 is currently offline  mmiller3
Messages: 81
Registered: January 2002
Member
Dear IDL gang,

I deal with medical images and display with direct graphics using
tv. These image are stored in arrays that are N x M pixels, and
each pixel is A mm x B mm in size. I'm trying to figure out how
to set up the display so that "cursor, /data" returns positions
in mm on this image. I do this with plot:

A = 0.5
B = 0.5
N = 256
M = 336

image = REPLICATE(1, N) # FINDGEN(M)

window, xsize=N, ysize=M, /free
TV, bytscl(image)

xs = A*indgen(N)
ys = B*indgen(M)
plot, A*indgen(N), B*indgen(M), $
/noerase, $
/nodata, $
xstyle=5, $
ystyle=5, $
position=[0,0,1,1], $
xrange=[min(xs),max(xs)], $
yrange=[min(ys),max(ys)]


cursor, x, y, /device
print, x, y

cursor, x, y, /normal
print, x, y

cursor, x, y, /data
print, x, y

But now I want to rotate my image and display it:

window, xsize=M, ysize=N, /free
TV, bytscl(rotate(image,1))

It would be simple enough to use the same scheme with plot,
swaping the axes, but it gets cumbersome if I want to make
something flexible that works with any value of the direction
parameter for rotate. So my question is, does anyone have a
handy way to convert an array index in a rotated array back to
the pre-rotated index, for all values of the direction parameter.
I suppose it really boils down to "has anyone done this for me
already?" :-)

My second question is, is there a handy way to mix rotate
directions with calls to plot and cursor (or anything else that
will set up the data coordinates) that will allow me to get the
position and coordinates back for any point in an array while
automagically taking the rotate direction parameter into account?

Mike
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: if there is a command "clear lot" in IDLWAVE like "Ctrl+Y" in Windows
Next Topic: Re: if there is a command "clear lot" in IDLWAVE like "Ctrl+Y" in Windows

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

Current Time: Wed Oct 08 17:40:09 PDT 2025

Total time taken to generate the page: 0.00582 seconds