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

Home » Public Forums » archive » Re: Zooming in place
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: Zooming in place [message #46050] Thu, 03 November 2005 18:30 Go to next message
ronn is currently offline  ronn
Messages: 123
Registered: April 1999
Senior Member
Sorry for coming in late to this discussion, but Rick mentioned that
doing an in place zoom in OG would be easy. And indeed it is! At least
for images :) Just cut and copy the code below and you will have a
simple zoom in place program for images. Left mouse is a factor of 2,
right mouse is 3 and middle is 4.

The trick is to have two views where one is transparent and moveable.
I suspect that you could do something similiar with regular OG plots,
but I haven't tried it.

For the curious, I got this idea driving down a back country road and
looking in the rear view mirror. I realized that by putting one view
inside another I could display whatever I wanted! And yes, this does
prove that I think about IDL way too much....

-Ronn

cut here and save to KROGwindow.pro ------------------------------

pro krogDrawEvent,event
;event handler
widget_control,event.top,get_uvalue=statePtr

case event.press of
0 :
1 : (*statePtr).zoomFactor = 2
4 : (*statePtr).zoomFactor = 3
2 : (*statePtr).zoomFactor = 4
else :
endcase

if event.press ge 1 then begin
widget_control, event.id, draw_motion_event=1 ;turn on motion
(*statePtr).oView2->setProperty,hide=0 ;show the zoom view
;create an instance of the image view
(*statePtr).oWin->draw,(*statePtr).oView,/create_instance ;
;get the data location
r = (*statePtr).oWin->pickdata((*statePtr).oView,(*statePtr).oImage,
$
[event.x,event.y],xyzLoc)
;offset is the corner of the zoom lens
offset = (*statePtr).kernalSize/2
;calculate the zoom lens effect based upon which mouse is clicked
zoomParam = (*statePtr).kernalSize/(*statePtr).zoomFactor
;change the zoom view properties
(*statePtr).oView2->setProperty, $

location=[event.x-(*statePtr).kernalSize/2,event.y-(*statePt r).kernalSize/2],
$

viewplane_rect=[xyzLoc[0]-(zoomParam/2),xyzLoc[1]-(zoomParam /2), $
zoomParam,zoomParam]
;only draw the changing part
(*statePtr).oWin->draw,(*statePtr).oView2,/draw_instance

endif else if event.release ge 1 then begin
;set everything back to normal
(*statePtr).oView2->setProperty,hide=1 ;hide the zoom view
widget_control, event.id, draw_motion_event=0
(*statePtr).oWin->draw,(*statePtr).oView
endif else if event.type eq 2 then begin
;get the data location
r = (*statePtr).oWin->pickdata((*statePtr).oView,(*statePtr).oImage,
$
[event.x,event.y],xyzLoc)
offset = (*statePtr).kernalSize/2 ;offset is the corner of the zoom
lens
;calculate the zoom lens effect based upon which mouse is clicked
zoomParam = (*statePtr).kernalSize/(*statePtr).zoomFactor
;change the zoom view properties
(*statePtr).oView2->setProperty, $

location=[event.x-(*statePtr).kernalSize/2,event.y-(*statePt r).kernalSize/2],
$

viewplane_rect=[xyzLoc[0]-(zoomParam/2),xyzLoc[1]-(zoomParam /2), $
zoomParam,zoomParam]
(*statePtr).oWin->draw,(*statePtr).oView2,/draw_instance
endif

return & end

;{{:|{{:|{{:|{{:|{{:|{{:|{{:|{{:|{{:|{{:|{{:|{{:|{{:|{{:|

pro krOGwindow, image
;testing routine for an Object Graphics zoom lens
;Ronn Kling
;Kling Research and Software, inc
;www.rlkling.com
;www.kilvarock.com

if n_params() eq 0 then begin
file = dialog_pickfile(title='CHOOSE A TRUE COLOR IMAGE')
if file eq '' then return
image = read_image(file)
endif
device, get_screen_size=scrSize
sz = size(image,/dimen)
aspectRatio = sz[2]/float(sz[1])
xsize = (scrSize[1]-30)/aspectRatio
ysize = (scrSize[1]-30)
base = widget_base(column=1)
drawId = widget_draw(base,xsize=xsize, ysize=ysize, /button_events, $
graphics_level=2,event_pro='krogDrawEvent', $
renderer=1)
widget_control, base,/realize
widget_control, drawId, get_value=oWin
;create a viewplane that is the same size as the input image
oView = obj_new('IDLgrView',viewplane_rect=[0,0,sz[1],sz[2]])
oModel = obj_new('IDLgrModel')
oImage = obj_new('IDLgrImage',image,interleave=0) ;does assume 3,m,n
image
oModel->add, oImage
oView->add, oModel
;draw the image
oWin->draw,oView

;create a second view that is the size of our zoom lens
kernalSize = 200
zoomFactor = 2.0
oView2=
obj_new('IDLgrView',dimen=[kernalSize,kernalSize],/transpare nt,viewplane_rect=[0,0,kernalSize/zoomFactor,kernalSize/zoom Factor])
oModel2 = obj_new('IDLgrModel')
;have to add the image object in as an alias since it is already part
;of the model above
oModel2->add, oImage,/alias
oView2->add, oModel2

statePtr = ptr_new({drawId:drawId, oWin:oWin, oView:oView, $
oView2:oView2, oImage:oImage,
kernalSize:kernalSize, $
zoomFactor:zoomFactor})
widget_control, base,set_uvalue=statePtr

xmanager,'krOGwindow',base,/no_block
return & end
Re: Zooming in place [message #46052 is a reply to message #46050] Thu, 03 November 2005 16:27 Go to previous messageGo to next message
pravesh.subramanian is currently offline  pravesh.subramanian
Messages: 21
Registered: August 2005
Junior Member
Wow.... Lots of inputs...! Thank you so much, folks.I really appreciate
it.
Re: Zooming in place [message #46104 is a reply to message #46052] Wed, 02 November 2005 00:32 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
a@nothing.com writes:


> Of course there is the Undo/Redo system but you are probably looking for
> something like the Window->Reset Dataspace Ranges. Would that be OK?

Gosh, it is all right there. Odd that I can never find
it when I want it. Did you write this stuff? Or, how
did you learn about it?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Zooming in place [message #46105 is a reply to message #46104] Wed, 02 November 2005 00:13 Go to previous messageGo to next message
AJ is currently offline  AJ
Messages: 5
Registered: April 2003
Junior Member
Of course there is the Undo/Redo system but you are probably looking for
something like the Window->Reset Dataspace Ranges. Would that be OK?


"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1dd14aaec223e106989688@news.frii.com...
> AJ writes:
>
>> But the nice nifty "Data Range" manipulator (left from the Zoom
manipulator)
>> does exactly that, combining a rubberband zooming with nice + and - for
the
>> individual axis, or even for both axis (+ and - signs) !
>
> Oh, right. But I quickly get lost! How in the world
> do I get back to where I started? :-(
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Zooming in place [message #46111 is a reply to message #46105] Tue, 01 November 2005 13:00 Go to previous messageGo to next message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Mon, 31 Oct 2005 17:38:29 -0500, Paul Van Delst wrote:

> JD Smith wrote:
>>
>> Just my $0.02 on the "best" algorithm for in-place zooming. My viewer
>> (which might be released one of these days) lets you select a zoom
>> region with a rubber-band, or just click to double the zoom. The final
>> selected region is zoomed up in integer multiples to maximally fill the
>> display window, and the rest of the window defaults to some neutral
>> background color. Single right clicks zoom you out one step, and double
>> right-clicks zoom you out "all the way". Works fairly well, in
>> practice.
>
> I like that approach (the either rubber-band or simple
> click-to-double-zoom).
>
> One GUI who's functionality I have always wanted in IDL for both regular
> old x-y plots and images is that of map zooms like you see at yahoo or
> msn. You can click and zoom (with a little indicator on the side telling
> you your "zoom level") or you can turn off the zoom once you've achieved
> your required level and the click just recenters the display (or you have
> buttons at the N-S-E-W edges, and corners). One thing I always find when
> looking at data in IDL is that once I've zoomed (via rubber-band) to the
> level I want, I would like to traverse my plot. The only way I can do that
> now is to unzoom (right button click) and then zoom in again on a
> different part of my plot. It works, but unfortunately I no longer have
> the luxury of time to further develop my simple tool (I thought the yearly
> maintenance fee would be a good substitute but, alas, that scenario hasn't
> eventuated), and, jeez, this is the 21st century for pete's sake. :o)
> When I look over the shoulder of matlab users they're zooming and moving
> and bee-bopping all over the place! I think I'm developing data-language
> envy :o( actually, :o)

Actually my tool takes care of that as well. When you are zoomed
in, you can middle-click drag to pan right around inside the zoomed image.
Very useful, and better in my opinion than tiny little versions of the
image to pan the view rect inside. This is just for images, mind you, not
plots.

JD
Re: Zooming in place [message #46112 is a reply to message #46111] Tue, 01 November 2005 11:50 Go to previous messageGo to next message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
Paul Van Delst wrote:
> Rick Towler wrote:
>> Paul Van Delst wrote:
>>
>>> One GUI who's functionality I have always wanted in IDL for both
>>> regular old x-y plots and images is that of map zooms like you see at
>>> yahoo or msn. You can click and zoom (with a little indicator on the
>>> side telling you your "zoom level") or you can turn off the zoom once
>>> you've achieved your required level and the click just recenters the
>>> display (or you have buttons at the N-S-E-W edges, and corners). One
>>> thing I always find when looking at data in IDL is that once I've
>>> zoomed (via rubber-band) to the level I want, I would like to
>>> traverse my plot. The only way I can do that now is to unzoom (right
>>> button click) and then zoom in again on a different part of my plot.
>>> It works, but unfortunately I no longer have the luxury of time to
>>> further develop my simple tool (I thought the yearly maintenance fee
>>> would be a good substitute but, alas, that scenario hasn't
>>> eventuated), and, jeez, this is the 21st century for pete's sake.
>>> :o) When I look over the shoulder of matlab users they're zooming
>>> and moving and bee-bopping all over the place! I think I'm developing
>>> data-language envy :o( actually, :o)
>>
>>
>>
>> Can you say "iTools"?
>
>
> I refrained from it in my original post, but, yes I can: @*$^@%$#%&!
>
> :o)
>
> I've found the iTools stuff to be some of the most counter-intuitive
> GUIs I have ever used for displaying data. And it's just too slow. We
> get PC upgrades about every 3 or so years - I've got about 1 year to go
> and just using iPlot to zoom a 10^6 point y=x^2 plot is agonizingly slow
> compared to my simple, brain-dead wplot routine. I don't think it's
> reasonable for me to have to get a new PC just so some new features work
> fast enough when I know similar functionality is already available (from
> v5 onwards). And, frankly, given the heritage of iTools, I'm not
> surprised. Can anyone say Insight? Or Live_Tools?
>
> I was going to continue my rant (blood pressure rising...) about all the
> effort on the OO stuff at the expense of just about everything else, but
> my iPlot just finished displaying (sans axes I might add....oh, there
> they are). So, I'm going to zoom in, go get a coffee while that
> cogitation is occurring, and then print the plot to a PostScript
> file.... hang on, there's no PS option. Bummer.

I have to admit I was trolling a bit.

I knew I would at least get a small rise out of David. :) (He really
didn't bite though. I think he is still high from his T-shirt
experience.) Whether you love 'em or hate 'em, the iTools are RSI's
response to gui based plot editors like MATLAB's figure window and let's
be honest, something like this is sorely needed in IDL. Task 10
computer literate, but not so familiar with IDL or MATLAB, people with
generating 10 figures forcing them to create the first 2 in IDL and
MATLAB respectively and I bet that without iTools all 10 will do the
last 8 in MATLAB.

And I agree Paul that iTool performance is abysmal (FTR, I'm running 6.1
and I know performance enhancements have been made in 6.2) but I think
your jab at the OO/OG system is a bit unfair. IDL needed a new graphics
subsystem and I couldn't imagine developing an application today without
OG. I think what has been overlooked are the "value added" routines for
object graphics. Classes and functions that sit somewhere in between
the OG primitives and iTools that allow the more casual user to exploit
OG in a manner similar to the DG system. For example, an IDLgrPlot
subclass that actually provides axes (imagine that). Or an IDLgrView
subclass that automagically displays its contents. Or XOBJVIEW on
steroids. And your dream zoom tool would be easy to implement in OG.
Why it doesn't ship with IDL is beyond me.

But back to iTools. I, maybe foolishly, still think that the
performance and UI issues can be worked out. But maybe they can't be
and iTools will go they way of Live_Tools and many person hours of
development will be wasted and IDL will fall back into its niche
awaiting the next attempt to claw its way out to a broader audience.

-Rick
Re: Zooming in place [message #46115 is a reply to message #46112] Tue, 01 November 2005 08:50 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
AJ writes:

> But the nice nifty "Data Range" manipulator (left from the Zoom manipulator)
> does exactly that, combining a rubberband zooming with nice + and - for the
> individual axis, or even for both axis (+ and - signs) !

Oh, right. But I quickly get lost! How in the world
do I get back to where I started? :-(

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Zooming in place [message #46116 is a reply to message #46115] Tue, 01 November 2005 08:20 Go to previous messageGo to next message
AJ is currently offline  AJ
Messages: 5
Registered: April 2003
Junior Member
But the nice nifty "Data Range" manipulator (left from the Zoom manipulator)
does exactly that, combining a rubberband zooming with nice + and - for the
individual axis, or even for both axis (+ and - signs) !

"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1dd07f24cb46979c989686@news.frii.com...
> Rick Towler writes:
>
>> Can you say "iTools"?
>
> Uh, well, I was just showing an iPlot to my class. Alas,
> the "zoom tool" makes the plot larger and smaller, but
> doesn't zoom into the data at all. Several disappointed
> users here. :-(
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Zooming in place [message #46120 is a reply to message #46116] Tue, 01 November 2005 06:18 Go to previous messageGo to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Rick Towler wrote:
>
>
> Paul Van Delst wrote:
>
>> One GUI who's functionality I have always wanted in IDL for both
>> regular old x-y plots and images is that of map zooms like you see at
>> yahoo or msn. You can click and zoom (with a little indicator on the
>> side telling you your "zoom level") or you can turn off the zoom once
>> you've achieved your required level and the click just recenters the
>> display (or you have buttons at the N-S-E-W edges, and corners). One
>> thing I always find when looking at data in IDL is that once I've
>> zoomed (via rubber-band) to the level I want, I would like to traverse
>> my plot. The only way I can do that now is to unzoom (right button
>> click) and then zoom in again on a different part of my plot. It
>> works, but unfortunately I no longer have the luxury of time to
>> further develop my simple tool (I thought the yearly maintenance fee
>> would be a good substitute but, alas, that scenario hasn't
>> eventuated), and, jeez, this is the 21st century for pete's sake. :o)
>> When I look over the shoulder of matlab users they're zooming and
>> moving and bee-bopping all over the place! I think I'm developing
>> data-language envy :o( actually, :o)
>
>
> Can you say "iTools"?

I refrained from it in my original post, but, yes I can: @*$^@%$#%&!

:o)

I've found the iTools stuff to be some of the most counter-intuitive GUIs I have ever used
for displaying data. And it's just too slow. We get PC upgrades about every 3 or so years
- I've got about 1 year to go and just using iPlot to zoom a 10^6 point y=x^2 plot is
agonizingly slow compared to my simple, brain-dead wplot routine. I don't think it's
reasonable for me to have to get a new PC just so some new features work fast enough when
I know similar functionality is already available (from v5 onwards). And, frankly, given
the heritage of iTools, I'm not surprised. Can anyone say Insight? Or Live_Tools?

I was going to continue my rant (blood pressure rising...) about all the effort on the OO
stuff at the expense of just about everything else, but my iPlot just finished displaying
(sans axes I might add....oh, there they are). So, I'm going to zoom in, go get a coffee
while that cogitation is occurring, and then print the plot to a PostScript file.... hang
on, there's no PS option. Bummer.

paulv

--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
Re: Zooming in place [message #46122 is a reply to message #46120] Mon, 31 October 2005 18:21 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Rick Towler writes:

> Can you say "iTools"?

Uh, well, I was just showing an iPlot to my class. Alas,
the "zoom tool" makes the plot larger and smaller, but
doesn't zoom into the data at all. Several disappointed
users here. :-(

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Zooming in place [message #46124 is a reply to message #46122] Mon, 31 October 2005 16:11 Go to previous messageGo to next message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
Paul Van Delst wrote:

> One GUI who's functionality I have always wanted in IDL for both regular
> old x-y plots and images is that of map zooms like you see at yahoo or
> msn. You can click and zoom (with a little indicator on the side telling
> you your "zoom level") or you can turn off the zoom once you've achieved
> your required level and the click just recenters the display (or you
> have buttons at the N-S-E-W edges, and corners). One thing I always find
> when looking at data in IDL is that once I've zoomed (via rubber-band)
> to the level I want, I would like to traverse my plot. The only way I
> can do that now is to unzoom (right button click) and then zoom in again
> on a different part of my plot. It works, but unfortunately I no longer
> have the luxury of time to further develop my simple tool (I thought the
> yearly maintenance fee would be a good substitute but, alas, that
> scenario hasn't eventuated), and, jeez, this is the 21st century for
> pete's sake. :o) When I look over the shoulder of matlab users they're
> zooming and moving and bee-bopping all over the place! I think I'm
> developing data-language envy :o( actually, :o)

Can you say "iTools"?

:)

-Rick
Re: Zooming in place [message #46125 is a reply to message #46124] Mon, 31 October 2005 14:38 Go to previous messageGo to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
JD Smith wrote:
>
> Just my $0.02 on the "best" algorithm for in-place zooming. My viewer
> (which might be released one of these days) lets you select a zoom region
> with a rubber-band, or just click to double the zoom. The final selected
> region is zoomed up in integer multiples to maximally fill the display
> window, and the rest of the window defaults to some neutral background
> color. Single right clicks zoom you out one step, and double right-clicks
> zoom you out "all the way". Works fairly well, in practice.

I like that approach (the either rubber-band or simple click-to-double-zoom).

One GUI who's functionality I have always wanted in IDL for both regular old x-y plots and
images is that of map zooms like you see at yahoo or msn. You can click and zoom (with a
little indicator on the side telling you your "zoom level") or you can turn off the zoom
once you've achieved your required level and the click just recenters the display (or you
have buttons at the N-S-E-W edges, and corners). One thing I always find when looking at
data in IDL is that once I've zoomed (via rubber-band) to the level I want, I would like
to traverse my plot. The only way I can do that now is to unzoom (right button click) and
then zoom in again on a different part of my plot. It works, but unfortunately I no longer
have the luxury of time to further develop my simple tool (I thought the yearly
maintenance fee would be a good substitute but, alas, that scenario hasn't eventuated),
and, jeez, this is the 21st century for pete's sake. :o) When I look over the shoulder of
matlab users they're zooming and moving and bee-bopping all over the place! I think I'm
developing data-language envy :o( actually, :o)

paulv

--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
Re: Zooming in place [message #46126 is a reply to message #46125] Mon, 31 October 2005 14:05 Go to previous messageGo to next message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Mon, 31 Oct 2005 10:15:29 -0700, David Fanning wrote:

> Pravish writes:
>
>> Zooming in place is one feature that does not seem to be popular with
>> IDL users. It is really strange that we are satisfied with the zoomed
>> image being in another window. That does not allow us to work with the
>> zoomed image. We can just view at the zoom image. I would like to zoom
>> on an image, in place and not in a separate window, and then work on
>> this image and if need be, zoom back. But, I am using a draw widget to
>> work with the image. That might seem to make things more complex.
>>
>> I have seen David's Zimage program and I think I could play around with
>> it and with some modifications, I will be able to use it.
>>
>> Any thoughts on this one?
>
> Zooming in place is one of those things that sound like a good idea until
> you start to implement it. Then you find it burdened with one constraint
> or another that make it more difficult to implement than you initially
> thought it was going to be.
>
> For example, if you allow the user to select the zoomed area, then you
> have problems of selection aspect ratio verses window aspect ratio. If you
> don't allow selection, then you have to determine how to allow the user to
> indicate selection, how much to zoom, etc.
>
> The biggest challenge, though, is going from a device coordinate system to
> the "data" coordinate system of the image in the zoomed window. It it not
> trivial to figure out where exactly you are in the image when you are in a
> display window.
>
> Once you have figured all this out once or twice, it is not something you
> really want to do again. So I would advise writing an image object that
> can do it all for you. Your image will need the ability to set up both a
> "normal" and "zoomed" coordinate system. You will need, probably, both the
> original image and a "display" image. (You might be able to create this on
> the fly.) You will need a method that can convert a point in window space
> to an image coordinate (the image "data" space) and visa versa, which
> means you will need an image that knows where it is in the display window.

Just my $0.02 on the "best" algorithm for in-place zooming. My viewer
(which might be released one of these days) lets you select a zoom region
with a rubber-band, or just click to double the zoom. The final selected
region is zoomed up in integer multiples to maximally fill the display
window, and the rest of the window defaults to some neutral background
color. Single right clicks zoom you out one step, and double right-clicks
zoom you out "all the way". Works fairly well, in practice.

JD
Re: Zooming in place [message #46129 is a reply to message #46126] Mon, 31 October 2005 10:09 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Pravish writes:

> I also see what you mean by the biggest challenge. I have to map
> device coords to the image .It seems somewhat intimidating!!

Well, it doesn't have to be intimidating. All you need is
the appropriate image coordinate system, which you could
get in the most trivial case by drawing a set of axes around
the image. A task that is made trivial, by the way, by most of
the substitute TV commands available on the Internet. Once the data
coordinate system is established, conversion is quick and
easy with CONVERT_COORD.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Zooming in place [message #46130 is a reply to message #46129] Mon, 31 October 2005 09:37 Go to previous messageGo to next message
pravesh.subramanian is currently offline  pravesh.subramanian
Messages: 21
Registered: August 2005
Junior Member
Thanks for the reply , David.

So going back to basics, a zoomed image is a scaling of the image,
right? The best part about IDL is that it is array-oriented. I fix a
default zoom factor, say 2. If the user clicks on some region in the
draw widget, I might want to consider a radius of say 200 pixels
around that point and scale all points in that region. It is easy till
here. But, as you mentioned, conversion from zoomed coord system to the
original system etc will cause more hurdles. The code will become more
dense than I have now :(

I also see what you mean by the biggest challenge. I have to map
device coords to the image .It seems somewhat intimidating!!

Best,
Pravesh
Re: Zooming in place [message #46132 is a reply to message #46130] Mon, 31 October 2005 09:15 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Pravish writes:

> Zooming in place is one feature that does not seem to be popular with
> IDL users. It is really strange that we are satisfied with the zoomed
> image being in another window. That does not allow us to work with the
> zoomed image. We can just view at the zoom image. I would like to zoom
> on an image, in place and not in a separate window, and then work on
> this image and if need be, zoom back. But, I am using a draw widget to
> work with the image. That might seem to make things more complex.
>
> I have seen David's Zimage program and I think I could play around with
> it and with some modifications, I will be able to use it.
>
> Any thoughts on this one?

Zooming in place is one of those things that sound like a good
idea until you start to implement it. Then you find it burdened
with one constraint or another that make it more difficult to
implement than you initially thought it was going to be.

For example, if you allow the user to select the zoomed area,
then you have problems of selection aspect ratio verses window
aspect ratio. If you don't allow selection, then you have to
determine how to allow the user to indicate selection, how much
to zoom, etc.

The biggest challenge, though, is going from a device coordinate
system to the "data" coordinate system of the image in the zoomed
window. It it not trivial to figure out where exactly you are in
the image when you are in a display window.

Once you have figured all this out once or twice, it is not something
you really want to do again. So I would advise writing an image
object that can do it all for you. Your image will need the ability
to set up both a "normal" and "zoomed" coordinate system. You will
need, probably, both the original image and a "display" image. (You
might be able to create this on the fly.) You will need a method that
can convert a point in window space to an image coordinate (the image
"data" space) and visa versa, which means you will need an image that
knows where it is in the display window.

You can build all this yourself (it will take less than a week,
probably), or (if you have some money) you can talk to me about my
Catalyst Library. The tools to do all this (in fact the image object
itself) are already in place. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Zooming in place [message #46197 is a reply to message #46050] Thu, 03 November 2005 18:42 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ronn Kling writes:

> For the curious, I got this idea driving down a back country road and
> looking in the rear view mirror. I realized that by putting one view
> inside another I could display whatever I wanted! And yes, this does
> prove that I think about IDL way too much....

I suddenly realized I knew how to drag direct graphics
text and objects around in a display window, just like they
do in object graphics, when I was standing in the shower
thinking about why I lost that tennis match again. It just
came to me, all in a flash. "Geez", I said to myself, "I
know how to do that!" AnnotateWindow was done in about an hour. I'd
only been thinking about the problem for about five or six years. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Error in Object
Next Topic: point datasets in ENVI: some potentially useful routines and an ROI problem

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

Current Time: Wed Oct 08 13:05:26 PDT 2025

Total time taken to generate the page: 0.00538 seconds