comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Color tables and edge operators ??
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Color tables and edge operators ?? [message #13718] Thu, 03 December 1998 00:00
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
DI Dubravko Cosic wrote:
>
> Hi,
>
> I have two questions.
> First question.
> After I segment CT image I would like to present segmented regions in
> red. I tried lots of tricks with colors and color tables and did not
> find any succes. Does anyone have some suggestion ?
>
> And second question.
> Where can I find some IDL routines for edge operators like Canny edge
> detector or anything similar.
>
> Thanks in advance
>
> Dubravko

Dubravko - Regarding question #1:

There are two ways to go about this, and both require that you
create a list of indices of your image that correspond to your
"segmented" regions. Once you have done that, you can either:

1. Set the segmented pixels in your image to a particular value,
and then set the color for that value:

tvlct, 255, 0, 0, !d.table_size-1 ; Set color to red

image = bytscl(image, top=!d.table_size-2) ; Reserve color
image(indices) = !d.table_size-1 ; Set pixels to value

This assumes you are using RGB colors.

2. You can create a "red-scale" and a "gray-scale" simultaneously
using my GRAYSCALE.PRO routine. This allows you to view your
segmented regions as red but still see their intensities. We
use this quite a bit. You will also need my BYTE_SCALE.PRO
routine, which lets you scale values and specify a BOTTOM as
well as a TOP value (BYTSCL only supports TOP).

Basically, you split the color table up into two halves, make
the bottom a gray-scale, and the top half a red-scale. Then you
scale the image into the bottom half, and then scale the segmented
pixels into the top half.

bottom = 0 ; Initial grayscale parameters
top = !d.table_size-1

grayscale, bottom, top, split_color=[1,0,0] ; Split color table

segPixels = image(indices) ; First save segmented pixels

image = byte_scale(image, top=!d.table_size/2) ; Gray scale

segPixels = byte_scale(segPixels, bottom=!d.table_size/2+1, $
top=!d.table_size-1)
image(indices) = segPixels ; Put seg pixels into image
tv, image

You can get GRAYSCALE and BYTE_SCALE from:

http://bial8.ucsd.edu pub/software/idl/share/

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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Image wallpapered GUI
Next Topic: Problems with IDL 5.2

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:40:25 PDT 2025

Total time taken to generate the page: 0.00470 seconds