Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
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/
Hi folks, 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 ?? Any hints would be greatly appreciated !! KP. -- Koon-pong Wong Email : enkpong@en.polyu.edu.hk Department of Electronic Engineering The Hong Kong Polytechnic University Phone : (+852) 2766 6201 Hung Hom, Kowloon FAX : (+852) 2362 8439 Hong Kong Office: DE503d
Koon-Pong Wong wrote: > > Hi folks, > > 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 ?? Koon-Pong - You might be interested in a program I wrote called SHOW_IMG that allows you to display a wide variety of medical images in a variety of different window configurations. This program can read many different medical image formats, so long as the images are square, with dimensions of either {64, 128, 256 or 512}; the image data must be in raw 8-bit or 16-bit format; there can be an initial header of unknown size, the image reader will skip over it appropriately. You say that your images are FLTARR. Is this after pre-processing? As far as I understand it, SPECT images in raw form are usually 16-bit signed integer data. You can get this program and many other routines related to medical imaging at: ftp://bial8.ucsd.edu pub/software/idl/share You can download just the SHOW_IMG program and it's required routines, or get a larger set of routines. There's a README file listing the routines and their use. All are written for UNIX, most should work on Windows/Mac without much work. All routines/programs have .doc documentation files; you can use my LHELP program to view these easily. Hope this helps. Dave -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ David S. Foster Univ. of California, San Diego Programmer/Analyst Brain Image Analysis Laboratory foster@bial1.ucsd.edu Department of Psychiatry (619) 622-5892 8950 Via La Jolla Drive, Suite 2240 La Jolla, CA 92037 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~