Coyote's BIG Idea [message #74518] |
Mon, 24 January 2011 06:03  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
I guess in a 25 year career I have had one or two BIG ideas.
They usually come to me in the shower. But, since I'm not
taking showers while I'm in the final stages of getting this
book out the door, this one sneaked up on me while I was bleary-
eyed at my desk.
Andrew Cool asked me a question about FSC_Window last
night. He wanted to programmatically get the window
index number of the resizeable graphics window so he
could add commands to it. (He was making a movie of
a time-series, of all things.) So I built a little
query routine that allowed me to return information
about all the FSC_Window apps on the display. It took
about 5 minutes to write that, and another 5 minutes
to write a selection routine so you could choose which
of the FSC_Window apps you wanted to add commands to.
And then it hit me. If I can select which FSC_Window
I want to add commands to, then I can treat these
FSC_Window apps just like normal graphics windows.
A couple of quick modifications to the Coyote Graphics
routines, and I now have a system of commands that work
in resizeable graphics windows *exactly* like normal
graphics commands work in traditional graphics windows.
WOW!!! *And* automatic PostScript file generation. *And*
the ability to make raster files of the window content.
This is friggin' UN-BE_LEAVE-A-BLE!
Anyway, I still have a some work to do this morning.
But I was up at 5:30 AM working on this to make sure
it was as good an idea this morning as it seemed last
night. It may be even better than I thought!
I'll let you know when you can play with this, but...Goodness! :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Coyote's BIG Idea [message #74634 is a reply to message #74518] |
Wed, 26 January 2011 08:36  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> Oh, dear. Hold off on this for a few minutes longer.
> I've done this incorrectly for one thing. But TVImage
> is *much* more difficult to handle than other routines,
> primarily because it doesn't erase itself (it acts like
> the TV command).
OK, I think this is done correctly now. You can download
the update here:
http://www.idlcoyote.com/programs/tvimage.pro
The problem is that TVImage acts like the TV command
and doesn't erase itself. This is a problem in resizeable
graphics windows, obviously. And yet, it is one of the
very nice features of the TV command, too. It makes it
possible to use images along with other graphics commands.
So, here is how this works. I want to maintain the idea
of working with FSC_Windows just like you work with
other IDL graphics windows. So, if you want to display
an image, you can simply set the Window keyword as you
normally would:
IDL> TVImage, image, /KEEP_ASPECT, MARGIN=0.1, /WINDOW,
This will automatically set the ERASEIT keyword, so that
when the window is resized, only the image appears, not
left-over garbage from the previous display.
Similarly, if you have a plot in the window:
IDL> FSC_Plot, Loaddata(1), /WINDOW
And you issue the TVImage command:
IDL> TVImage, image, /KEEP_ASPECT, MARGIN=0.1, /WINDOW
The image will take the place of the plot command in
the window, as other commands do. The ERASEIT keyword
is also set.
But, if you want to add an image to a display, you don't
set the WINDOW keyword, but rather the ADDCMD keyword.
This automatically sets the WINDOW keyword for you, but
it also sets the ERASEIT keyword to 0 and *adds* the command
to the FSC_Window, rather than replacing the commands that
are already there.
IDL> FSC_Plot, Loaddata(1), /Window
IDL> TVImage, image, /KEEP_ASPECT, MARGIN=0.3, /ADDCMD
In this case the image appears with the plot, and both
resize together.
Unfortunately, if you try to add a command to an FSC_Window
when an FSC_Window doesn't exist, you thrown an error. So,
you have to be a bit careful about which keyword you use.
I can't get out of this box without some VERY ugly code, so
I'm going to think about this some more. In the meantime, just
use the keywords as they are supposed to be used. ;-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Coyote's BIG Idea [message #74635 is a reply to message #74518] |
Wed, 26 January 2011 08:02  |
dplatten
Messages: 32 Registered: December 2007
|
Member |
|
|
Hi David,
Thanks for the really quick response and the changes to the routine.
I agree with the TVSCL comment - I only use it to get a quick idea about an image. It's being replaced by your routines in my code.
Regards,
David
|
|
|
Re: Coyote's BIG Idea [message #74636 is a reply to message #74518] |
Wed, 26 January 2011 07:45  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> OK, done. You can find the update TVImage file here:
>
> http://www.idlcoyote.com/programs/tvimage.pro
>
> To add an image to an FSC_Window, just set the Window
> keyword:
>
> IDL> TVImage, image, /Keep_Aspect, /Window
Oh, dear. Hold off on this for a few minutes longer.
I've done this incorrectly for one thing. But TVImage
is *much* more difficult to handle than other routines,
primarily because it doesn't erase itself (it acts like
the TV command).
I'll have to think about this for a few minutes. In
any case the current version doesn't work the way
I expect it to work eventually. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Coyote's BIG Idea [message #74639 is a reply to message #74518] |
Wed, 26 January 2011 07:27  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
dplatten writes:
> I have a question though - probably me being dim - but which
> command do I use to display an image in one of your new
> resizable windows? The equivalent of TVSCL, image?
By the way, I recommend in my new book that the TVSCL
command be banished from the face of the Earth. Well,
maybe I didn't put it exactly that way, but that's
how I feel about it.
Good for noodling around. But that's about it. One of
several controversial ideas in the book, no doubt.
No sense pulling your punches when you get to be
my age. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Coyote's BIG Idea [message #74641 is a reply to message #74518] |
Wed, 26 January 2011 07:15  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> This reminds me, though, that I haven't added a WINDOW
> keyword to TVImage to send it directly to an FSC_Window
> application. I'll do that now.
OK, done. You can find the update TVImage file here:
http://www.idlcoyote.com/programs/tvimage.pro
To add an image to an FSC_Window, just set the Window
keyword:
IDL> TVImage, image, /Keep_Aspect, /Window
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Coyote's BIG Idea [message #74642 is a reply to message #74518] |
Wed, 26 January 2011 07:05  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
dplatten writes:
> I have a question though - probably me being dim - but which command do I use to display an image in one of your new resizable windows? The equivalent of TVSCL, image?
You can use:
TVImage, image, ..., /Scale
Or,
TVScale, image, ...
TVScale is just a simple wrapper that calls TVImage
with the SCALE keyword set.
This reminds me, though, that I haven't added a WINDOW
keyword to TVImage to send it directly to an FSC_Window
application. I'll do that now. At the moment, you will
have to add this to FSC_Window like this:
FSC_Window, 'TVImage', image, /Scale, /ADDCMD
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Coyote's BIG Idea [message #74644 is a reply to message #74518] |
Wed, 26 January 2011 06:43  |
dplatten
Messages: 32 Registered: December 2007
|
Member |
|
|
Dear David,
I think that these new routines are great. I have them working for various data plots.
I have a question though - probably me being dim - but which command do I use to display an image in one of your new resizable windows? The equivalent of TVSCL, image?
Many thanks,
David Platten
|
|
|