Re: Slicer & Colors [message #7326] |
Thu, 31 October 1996 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Deb Summa <summa@lanl.gov> writes:
> I have a 2-d plot (which is a projection of some 3-D data) displayed with
> a colorbar scale underneath. When I invoke the canned slicer on the 3-D
> dataset, the colorbar in all the other windows gets taken over by the
> slicer, which appears to be repeating the same color table 3 times
> within the allocated space. I can avoid this problem by doing my
> slicing first and then doing the 2-D projections, or I can close
> down all the 2-D plot windows before invoking the slicer, but both of these
> 'solutions' are kludges. Does anyone have an idea as to what's going on
> and how to fix it?
Working with colors in IDL can sometimes be frustrating. The problem,
of course, is that there is only one physical color table (on 8-bit systems)
and all the IDL graphics windows take their colors from the same
color table. Since virtually any IDL program can commandeer the color
table, there is no guarantee one program's colors will not interfere
with some other program's colors. That is what is going on here.
You get your colors all set up the way you like them, then run the
SLICER and it reapportions the color table to its own liking.
You have a couple of options. First, you could modify the SLICER
code to be more "color aware". For example, I hardly write a
widget program these days that doesn't have an NCOLORS and
BOTTOM keyword defined for it, so I can tell the program *exactly*
what portion of the color table it can modify for its use. You could
add this capability to the SLICER, so it modified only the colors you
wanted it to modify and left some colors alone for your color bar.
(But, if you have looked at the SLICER code, you may find this
proposal a bit daunting!)
So, you have another, less ideal choice. You could modify your
windows (I presume they are draw widget windows?) so that
when the cursor passed into them, they would restore their
their own color table, and when the cursor passed out, they
would restore SLICER's color table. You could do this, for
example, by setting widget tracking on for your draw widget
windows. (I have reason to believe you know how to do this.)
In this way, you could have the correct colors in your windows
when you wanted them, and the correct colors in SLICER when
that was important. (You won't be able to have both
simultaneously, however.)
A third solution is to use a more "color aware" slicer application.
I have one that you can download, if you like. It is not as powerful
as the SLICER, but I think it is more intuitive to use and it has
animation features that the SLICER lacks. It has NCOLORS and
BOTTOM keywords defined, so you can limit the colors it uses
in the color table, thereby assuring that your programs can
co-exist with it. Another nice feature is that the display window
is fully resizeable and you can send the window contents directly
to a PostScript file. It does not use Common blocks, of course,
so you can have as many versions running as you like. (In fact,
you can open multiple datasets from within the application.)
You can find this application on the machine ftp.frii.com. The
files you want are located in the directory:
pub/dfanning/outgoing/slice_programs
You will want to download three files:
README
slice.pro
sliceadd.sav
Be sure you download the first two files in ASCII transfer mode
and the last file in BINARY transfer mode.
To make this application run in the color aware mode I prefer,
I have had to modify some of IDL's library routines. In particular,
XINTERANIMATE and CW_ANIMATE. The program also uses a number
of my other utiltiy routines. I have collected all of these file
dependencies into an IDL SAVE file, so you simply restore the
"sliceadd.sav" file, compile the "slice.pro" file, and away you go.
In fact, I even provide an example program. So, after downloading the
three files above, to see it work, type:
IDL> RESTORE, 'sliceadd.sav'
IDL> .COMPILE slice
IDL> example
The slice.pro file has a header that gives you complete information
for running the program.
Enjoy!
David
*************************************************
* David Fanning, Ph.D.
* 2642 Bradbury Court, Fort Collins, CO 80521
* Phone: 970-221-0438 Fax: 970-221-4762
* E-Mail: davidf@dfanning.com
*
* Sometimes I go about pitying myself, and all along my
* soul is being blown by great winds across the sky.
* -- Ojibway saying
************************************************
|
|
|