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

Home » Public Forums » archive » display gray image with NaN
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: display gray image with NaN [message #94242 is a reply to message #94240] Sat, 04 March 2017 02:00 Go to previous messageGo to previous message
jpleahy2 is currently offline  jpleahy2
Messages: 1
Registered: March 2017
Junior Member
On Friday, March 3, 2017 at 1:55:26 PM UTC, dashtab...@gmail.com wrote:
> Hello everybody
>
> i have a gray scale image (one band with NaN value) and display it with image() and widget_window().
> i want to show specific values (maybe gt 1000 pixels ) over image with red color.
> like this. http://pasteboard.co/EYXxQWAAW.jpg
>
> Thank you for your help.
> Regards

1) If required, define a colour scale to map your raw data values to pixel values, e.g. for a greyscale RGB should all be the same:
offset = MIN(raw_data)
scale = 255/(1000-offset)
data = BYTE(REBIN(scale*(raw_data - offset),N,M,3))

(doesn't have to be bytes with IMAGE(), but most display devices can only cope with 256 levels per RGB so you might as well).

2) Choose a colour well away from the main colour map to represent NaNs and saturated pixels.
nan_colour = [0,0,1] ; blue NaN
sat_colour = [1,0,0] ; red for values > 1000
nanpix = WHERE(FINITE(raw_data))

3) Flatten array temporarily so the indexing from WHERE will work:
data = REFORM(data, N*M,3)
data[nanpix,*] = nan_colour
satpix = WHERE(raw_data GT 1000)
data[satpix,*] = sat_colour
data = REFORM(data,N,M,3)

4) Display, with options as required:
graphic = IMAGE(data)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: logarithmic axis lables
Next Topic: regression with 95% confidence interval

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

Current Time: Wed Oct 08 13:07:23 PDT 2025

Total time taken to generate the page: 0.00478 seconds