Re: iTool Redeux [message #37208] |
Wed, 26 November 2003 06:48 |
mmiller3
Messages: 81 Registered: January 2002
|
Member |
|
|
Chris,
Thanks for those examples! After seeing those, my perceptioon of
the potential usefulness of iTools went up by a couple of orders
of magnitude! I'd love to see stuff like that in the
documentation - perhaps a chapter something like "A programmers
guide to programming with itools", rather than "A users guide to
using itools interactively".
Thanks, Mike
--
Michael A. Miller mmiller3@iupui.edu
Imaging Sciences, Department of Radiology, IU School of Medicine
|
|
|
Re: iTool Redeux [message #37214 is a reply to message #37208] |
Tue, 25 November 2003 20:01  |
Chris Torrence
Messages: 5 Registered: March 2001
|
Junior Member |
|
|
Hi,
One further point. If you are interested in simply doing things with iTools
from the command line (rather than creating your own iTool), there are some
good examples in the <IDL_DIR>/examples/demo/demosrc directory.
Specifically, I would look at d_icontour, d_icurvefit, and d_iimage. As an
example, here is the code from d_icurvefit:
; Generate a plot line
n = 50
x = (findgen(n) - 25)/2
yerr = 0.1
y = 2 + 0.1*x + 3*exp(-((x - 1)/2)^2) + yerr*randomn(1,n)
yerror = replicate(yerr, n)
IPLOT, x, y, $
COLOR = [255,0,0], $
ERRORBAR_COLOR = [255,0,0], $
THICK = 2, $
LINESTYLE = 6, $
NAME = 'Gaussian+Linear', $
SYM_INDEX = 4, $
XTITLE = 'Angle !9F!X (degrees)', $
YTITLE = 'Area (m!u2!n)', $
YERROR = yerror, $
/NO_SAVEPROMPT
oSys = _IDLitSys_GetSystem()
oTool = oSys->_GetCurrentTool()
void = oTool->DoAction('Operations/Operations/Filter/Curve Fitting')
oWin = oTool->GetCurrentWindow()
oWin->ClearSelections
void = oTool->DoAction('Operations/Insert/Legend')
This example starts up an iPlot, then fires up the Curve Fitting operation,
and then automatically inserts a legend once the user has hit OK on the
Curve Fit dialog.
With the combination of "DoSetProperty" (see previous post) and "DoAction",
you can perform almost any "interactive" operation directly from the command
line.
-Chris
|
|
|
Re: iTool Redeux [message #37215 is a reply to message #37214] |
Tue, 25 November 2003 16:14  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Chris Torrence writes:
> That being said, it is straightforward (though not necessarily obvious) to
> set the Stretch to Fit from the command line. The following code will do the
> trick:
>
> [Several lines of code omitted.]
>
> The only tricky part is the call to _IDLitSys_GetSystem. All of the other
> methods are documented.
Well, there you go! Not really all that hard once
you know the undocumented trick. I know what I'm
going to submit to the Chairman for this year's
IEPA Test Question. (By the way, the annual IPEA
bacchanal has been pushed back from it's normal
October date this year to give the inductees more
time to study iTools. Good luck!)
I really appreciate your help, Chris. Wish we
heard from you guys a little more often. :-)
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: iTool Redeux [message #37216 is a reply to message #37215] |
Tue, 25 November 2003 15:49  |
Chris[2]
Messages: 39 Registered: August 2003
|
Member |
|
|
Hi David,
There are a lot of properties that are settable from the command line for
the iTools, including all of the properties for the visualization (such as
color), and many of the axis properties (like xtitle, ytitle, etc.).
However, not all properties were thought to be important enough to include,
such as the visualization layer or the dataspace properties. This may change
in future versions of IDL. Actually, there will be a much simpler way to
control the default values for such properties, which is what your user
probably wants.
That being said, it is straightforward (though not necessarily obvious) to
set the Stretch to Fit from the command line. The following code will do the
trick:
iPlot, randomu(s,10), IDENTIFIER=idTool
; Retrieve the system object. Note that this routine is undocumented
; and may change in future versions.
oSys = _IDLitSys_GetSystem()
oTool = oSys->GetByIdentifier(idTool)
; The easiest way to determine the object identifier is to
; look in the visualization browser and trace thru the hierarchy.
void = oTool->DoSetProperty('WINDOW/VIEW_1/VISUALIZATION LAYER', $
'STRETCH_TO_FIT', 1)
; You can do multiple DoSetProperty calls, and then a final call to
CommitActions
; to bundle all of your SetProperty's into a single Undo/Redo action.
oTool->CommitActions
The only tricky part is the call to _IDLitSys_GetSystem. All of the other
methods are documented.
Cheers,
Chris
Research Systems, Inc.
"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1a2d7304f9483d5298975c@news.frii.com...
> Folks,
>
> As it happens, I had an e-mail this morning from an iTool
> user (not a newsgroup reader, too, it seems) who wanted
> to do the simplest thing with an iPlot. He wants to call
> the iPlot tool from his program and he wants the plot to
> come up in "Stretch To Fit" mode. He does not want to
> have to change this each time from the Visualization
> Browser.
>
> A reasonable request, I'm sure you will agree. Something
> a casual IDL user might think he wants to do. I tried the
> obvious thing:
>
> IDL> iPlot, data, /Shrink_To_Fit
>
> No, good. I read the iPlot documentation. Nothing there.
> I poked around for 20 minutes in the iTool code until
> my frustration level reached the boiling point. Then
> I sent an e-mail to RSI support. How do you do this
> simple thing?
>
> I don't wish to embarrass anyone at RSI by publishing
> the answer. But I do want you to know how serious a
> problem this is. Here is the answer:
>
> "...the only way to do this would be to
> write an iTool program. I believe the Help Index
> under iTools- operating tasks- Example: Creating
> an example (hot link) will bring you to the steps
> you need to look at."
>
> There you go. I estimate I might have an answer for
> the poor chap in 4-6 weeks if I drop everything and
> work on this. I don't know how long it is going to
> take him to figure it out on his own.
>
> Cheers,
>
> David
>
> --
> David W. Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Phone: 970-221-0438, E-mail: david@dfanning.com
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|