Re: Image activities mapped to colorbar [message #11890 is a reply to message #11888] |
Wed, 03 June 1998 00:00   |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Koon-Pong Wong (enkpong@encserver.en.polyu.edu.hk) writes:
> I have some data sets of SPECT images that I want to display in a
> window. For example:
>
> IDL> for i=0,30 do tvscl, ImageSeq(*,*,i), i
>
> where "ImageSeq" is a 3D FLTARR which contains a particular slice of the
> brain. Since the images represent the activities in the brain at different
> time, if I display the images with the above way, all of the images would
> be scaled to their own maxima. What I want to do is to display the images
> according to their activities and mapped the activities to a color bar so
> that the first image frame may appear black while the last frame may
> appear grey/white with background still black (assume that I use B/W for
> display). How can I do that ??
Here is the very first rule I teach in my IDL programming
classes:
If color is important to you never, NEVER use TVSCL!
It appears color is important to you here, so what you
have to do is scale the data using the BYTSCL command
and display it with the TV command.
Suppose, for example, that you want to scale the data
into the number of colors you have on your display.
(How many is that? You may not know. You certainly
can't be sure of it. That is *exactly* why you don't
want to be using TVSCL.) But suppose you can count on
200 colors on the monitors your data will typically be
display on.
And suppose that you want to scale the data linearly
between the data values of 10 and 1550. (Let's assume
your data is integer data.) Then you would display the
data like this:
IDL> scaledData = BytScl(ImageSeq, Top=199, Min=10, Max=1550)
IDL> FOR j=0,30 DO TV, scaledData(*,*,j), j
Now you will see *exactly* what you hoped to see!
These ideas are spelled out in excruciating detail in
my IDL Programming Techniques book. :-)
Cheers,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|