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

Home » Public Forums » archive » changing contrast and brightness on the fly
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: changing contrast and brightness on the fly [message #25493 is a reply to message #25432] Thu, 21 June 2001 09:55 Go to previous messageGo to previous message
slashell is currently offline  slashell
Messages: 2
Registered: June 2001
Junior Member
Perhaps no one has said this because it's obvious, but just in case:

Level and width (as described by whatshisname above) is a more natural
way to write your code. If people want brightness and contrast, the
connections are as follows:

Higher contrast means a more narrow window
Brighter image means a lower level

I don't know what the convention is for units of contrast and brightness, but
for example:

a = congrid(indgen(2^6,2^6),300,300) ; dummy image with range of 2^12

aMin = min(a,max=aMax) ; get max and min values of raw image

; scale all 12 bits of data into 8 bits of display
; one might call this contrast = 0 (out of 100) and brightness = 50 (out of 100)
tv,bytscl(a)

; now, to display some other contrast and brightness
contrast = 50
brightness = 25

Level = (1-brightness/100.)*(aMax - aMin) + aMin
width = (1-contrast/100.)*(aMax - aMin)

displayMax = level + width/2
displayMin = level - width/2

tv,bytscl(a,min=displayMin,max=displayMax)

Hope this helps,
Sean La Shell

Massachusetts General Hospital
Radiation Oncology
Northeast Proton Therapy Center
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: New book: "Practical IDL Programming"
Next Topic: Re: contour boundaries

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

Current Time: Sun Nov 30 05:58:49 PST 2025

Total time taken to generate the page: 1.12409 seconds