Re: LOADCT and TVSCL [message #38620] |
Fri, 19 March 2004 10:41  |
Antonio Santiago
Messages: 201 Registered: February 2004
|
Senior Member |
|
|
No Nuno,
if you put 255-i that isn't a vector.
You can do:
v = reverse(indgen(256))
then v is a vector with 255,254,...0 and you can use like a RGB.
Bye :)
Nuno Oliveira wrote:
> Suppose I want to use B-W Linear color table inverted. From white do
> black. I thought this code could do it:
>
> LOADCT, 0
> for i = 0, 255 do TVLCT, 255-i, 255-i, 255-i, i
> TVSCL, img
>
> Doesn't work. I haven't understood well how TVLCT works? What's wrong?
> How can I make it?
>
> Thanks,
>
> Nuno.
>
|
|
|
Re: LOADCT and TVSCL [message #38622 is a reply to message #38620] |
Fri, 19 March 2004 09:28   |
Michael Wallace
Messages: 409 Registered: December 2003
|
Senior Member |
|
|
> Suppose I want to use B-W Linear color table inverted. From white do
> black. I thought this code could do it:
>
> LOADCT, 0
> for i = 0, 255 do TVLCT, 255-i, 255-i, 255-i, i
> TVSCL, img
>
> Doesn't work. I haven't understood well how TVLCT works? What's wrong?
> How can I make it?
Try sending arrays to tvlct instead...
i = 255 - indgen(256) ; create an array from 255 to 0
tvlct, i, i, i ; use this array for red, green and blue
|
|
|
Re: LOADCT and TVSCL [message #38718 is a reply to message #38622] |
Fri, 19 March 2004 11:20  |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
Michael Wallace wrote:
>> Suppose I want to use B-W Linear color table inverted. From white do
>> black. I thought this code could do it:
>>
>> LOADCT, 0
>> for i = 0, 255 do TVLCT, 255-i, 255-i, 255-i, i
>> TVSCL, img
>>
>> Doesn't work. I haven't understood well how TVLCT works? What's wrong?
>> How can I make it?
>
>
>
> Try sending arrays to tvlct instead...
>
> i = 255 - indgen(256) ; create an array from 255 to 0
> tvlct, i, i, i ; use this array for red, green and blue
You could also leave the color table alone and manipulate the image instead.
IDL> img = BYTSCL(hanning(200,200), top = 150B) + 30B
IDL> loadCT, 0
IDL> tvscl, img
IDL> tvscl, 255B - img, 210, 0
Liam Gumley's IMDISP and David Fanning's TVIMAGE have this "inverting"
capability built-in via keywords.
ben
|
|
|