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

Home » Public Forums » archive » how to set density slice color using the IDL new graphic
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
how to set density slice color using the IDL new graphic [message #85919] Wed, 18 September 2013 06:12 Go to next message
titan is currently offline  titan
Messages: 59
Registered: March 2006
Member
Hi all,
I'm trying to create a widget where after reading an image it appears and clicking on a butt from gray scale it would turn in an image with only 5 colors one fore each class I have in the image.
the image is a gray scale byte array[600,600] where the pixels have this values=63, 127,191,254,0

I would like to associate a specific color to each of these values


with the old graphic system I did in this way:

PRO read_tiff_widget_density_slice,event
WIDGET_CONTROL,event.top, GET_UVALUE=status

LoadCT, 0, NColors=254
;; example: 255, 0, 0, 255 ; Red in index 255


DEVICE, DECOMPOSED=0
white=WHERE(status.img EQ 63, count)
IF count NE 0 THEN BEGIN
TVLCT,255,255,255, 63
status.img[white]=63
ENDIF


green=WHERE(status.img EQ 127, count)
IF count NE 0 THEN BEGIN
; print, 'count green', count
TVLCT,0,255,0, 127
status.img[green]=127
ENDIF
...
...
...
(the same for all the values)

TV,status.img
WIDGET_CONTROL, event.top, SET_UVALUE=status

END



and the "status" variable is defined as follows:
where "img" is the image
status={fname_map:fname_map,$
map_name_field:map_name_field,$
img:img,$
lon:lon,$
lat:lat}


If I try to use the same approach with the new graphic it does not work anymore and I'm not able to find a workaround.

I hope my problem is clear..

do you have any suggestions??
thanks in advance

cheers
Re: how to set density slice color using the IDL new graphic [message #85921 is a reply to message #85919] Wed, 18 September 2013 06:26 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
titan writes:

> I'm trying to create a widget where after reading an image it appears
and clicking on a butt from gray scale it would turn in an image with
only 5 colors one fore each class I have in the image.
> the image is a gray scale byte array[600,600] where the pixels have this values=63, 127,191,254,0
>
> I would like to associate a specific color to each of these values
>
>
> with the old graphic system I did in this way:

> If I try to use the same approach with the new graphic it does not work anymore and I'm not able to find a workaround.
>
> I hope my problem is clear..
>
> do you have any suggestions??

I was taking an ENVI class last week when the rain started and the class
had to be aborted half way though. But, we did talk about density
slicing, and I thought this would be a great tool for the Coyote
Library. I don't know how to do this with function graphics, but if you
find you have to resort to direct graphics again, I would suggest doing
this with Value_Locate rather than the Where function. It will be MUCH
faster for you. :-)

http://www.idlcoyote.com/code_tips/partition.html
http://www.idlcoyote.com/code_tips/valuelocate.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: how to set density slice color using the IDL new graphic [message #86068 is a reply to message #85921] Mon, 30 September 2013 02:27 Go to previous message
titan is currently offline  titan
Messages: 59
Registered: March 2006
Member
Hi David,
thanks a lot for your suggestion.. I will let you know as soon as I will try it :)

all the best
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Trying to plot geomagnetic coordinates
Next Topic: Extracting plot boundaries

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

Current Time: Wed Oct 08 15:21:25 PDT 2025

Total time taken to generate the page: 0.00539 seconds