Discussion:
[vtkusers] Clarification and help using vtkLookupTable
Neel Patel 0-0-0
2017-08-08 00:04:43 UTC
Permalink
Hi All,

I'm trying to use vtkLookupTable to add color in my image, something
like what they show on the weather forecasts. From what I understand,
SetRange(0,255) means that any pixel value in the image that is in between
the min and max, will be assigned a value that has been set by
SetTableValue(0, 0, 0, 0, 0) and SetTableValue(255, 255, 255, 255, 1). To
test this out I made a simple lookupTable where everything except for 0 was
given a rgb value of 255, 0, 0;

vtkLookupTable table = vtkLookupTable.New();
table.SetRange(0, 255);
table.SetTableValue(0, 0, 0, 0, 0);

for (int i = 1; i < 255; i++)
{
table.SetTableValue(i, 255, 0, 0, 0.3);
}
table.SetRampToLinear();
table.Build();

This however still gives me and image with red, green, and blue showing up
instead of just red. Also just to note this is on top of a black/white
image, so there aren't any other places from which the colors could come
from. Any help would be appreciated. Thanks.

Regards,
Neel Patel





--
View this message in context: http://vtk.1045678.n5.nabble.com/Clarification-and-help-using-vtkLookupTable-tp5744313.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
David E DeMarle
2017-08-08 09:45:49 UTC
Permalink
Take out the calls to set ramp and especially build. Build replaces all of
the value:colors you've set with automatically generated ones.
Post by Neel Patel 0-0-0
Hi All,
I'm trying to use vtkLookupTable to add color in my image, something
like what they show on the weather forecasts. From what I understand,
SetRange(0,255) means that any pixel value in the image that is in between
the min and max, will be assigned a value that has been set by
SetTableValue(0, 0, 0, 0, 0) and SetTableValue(255, 255, 255, 255, 1). To
test this out I made a simple lookupTable where everything except for 0 was
given a rgb value of 255, 0, 0;
vtkLookupTable table = vtkLookupTable.New();
table.SetRange(0, 255);
table.SetTableValue(0, 0, 0, 0, 0);
for (int i = 1; i < 255; i++)
{
table.SetTableValue(i, 255, 0, 0, 0.3);
}
table.SetRampToLinear();
table.Build();
This however still gives me and image with red, green, and blue showing up
instead of just red. Also just to note this is on top of a black/white
image, so there aren't any other places from which the colors could come
from. Any help would be appreciated. Thanks.
Regards,
Neel Patel
--
View this message in context: http://vtk.1045678.n5.nabble.
com/Clarification-and-help-using-vtkLookupTable-tp5744313.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/
opensource/opensource.html
http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
http://public.kitware.com/mailman/listinfo/vtkusers
Neel Patel 0-0-0
2017-08-08 14:32:04 UTC
Permalink
Got it. I assumed that build created the table with all the set values.
Thanks David!



--
View this message in context: http://vtk.1045678.n5.nabble.com/Clarification-and-help-using-vtkLookupTable-tp5744313p5744320.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Franks
2018-10-29 13:21:37 UTC
Permalink
Dear Mr. Patel
I have the same problem as you. I saw your problem, but still don't
understand why it works like that. Could you do me a favour to have a look
and tell me your understanding about *SetRange()*.
Thank you, and I look forward to hearing from you.
Best regards,
Franks



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Franks
2018-11-03 03:28:35 UTC
Permalink
I have the same problem as Neel. I read your answer, but still don't
understand why it works like that. Could you do me a favour to have a look
and tell me what does *SetRange()* work.
Thank you, and I look forward to hearing from you.
Best regards,
Frank
Post by David E DeMarle
Take out the calls to set ramp and especially build. Build replaces all of
the value:colors you've set with automatically generated ones.
On Aug 7, 2017 8:04 PM, "Neel Patel 0-0-0" &lt;
Post by Neel Patel 0-0-0
Hi All,
I'm trying to use vtkLookupTable to add color in my image, something
like what they show on the weather forecasts. From what I understand,
SetRange(0,255) means that any pixel value in the image that is in between
the min and max, will be assigned a value that has been set by
SetTableValue(0, 0, 0, 0, 0) and SetTableValue(255, 255, 255, 255, 1). To
test this out I made a simple lookupTable where everything except for 0 was
given a rgb value of 255, 0, 0;
vtkLookupTable table = vtkLookupTable.New();
table.SetRange(0, 255);
table.SetTableValue(0, 0, 0, 0, 0);
for (int i = 1; i < 255; i++)
{
table.SetTableValue(i, 255, 0, 0, 0.3);
}
table.SetRampToLinear();
table.Build();
This however still gives me and image with red, green, and blue showing up
instead of just red. Also just to note this is on top of a black/white
image, so there aren't any other places from which the colors could come
from. Any help would be appreciated. Thanks.
Regards,
Neel Patel
--
View this message in context: http://vtk.1045678.n5.nabble.
com/Clarification-and-help-using-vtkLookupTable-tp5744313.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at http://www.kitware.com/
opensource/opensource.html
http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
http://public.kitware.com/mailman/listinfo/vtkusers
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.vtk.org/Wiki/VTK_FAQ
Search the list archives at: http://markmail.org/search/?q=vtkusers
http://public.kitware.com/mailman/listinfo/vtkusers
--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
Andras Lasso
2018-11-03 17:14:34 UTC
Permalink
Probably the most efficient way of learning exact behavior of simple classes is to read their source code.

vtkLookupTable is a really simple one and its source code is available here:
https://github.com/Kitware/VTK/blob/master/Common/Core/vtkLookupTable.cxx

Andras

-----Original Message-----
From: vtkusers <vtkusers-***@public.kitware.com> On Behalf Of Franks
Sent: Friday, November 2, 2018 11:29 PM
To: ***@vtk.org
Subject: Re: [vtkusers] Clarification and help using vtkLookupTable

I have the same problem as Neel. I read your answer, but still don't understand why it works like that. Could you do me a favour to have a look and tell me what does *SetRange()* work.
Thank you, and I look forward to hearing from you.
Best regards,
Frank
Post by David E DeMarle
Take out the calls to set ramp and especially build. Build replaces
all of the value:colors you've set with automatically generated ones.
On Aug 7, 2017 8:04 PM, "Neel Patel 0-0-0" &lt;
Post by Neel Patel 0-0-0
Hi All,
I'm trying to use vtkLookupTable to add color in my image,
something like what they show on the weather forecasts. From what I
understand,
SetRange(0,255) means that any pixel value in the image that is in
between the min and max, will be assigned a value that has been set
by SetTableValue(0, 0, 0, 0, 0) and SetTableValue(255, 255, 255, 255,
1). To test this out I made a simple lookupTable where everything
except for 0 was given a rgb value of 255, 0, 0;
vtkLookupTable table = vtkLookupTable.New();
table.SetRange(0, 255);
table.SetTableValue(0, 0, 0, 0, 0);
for (int i = 1; i < 255; i++)
{
table.SetTableValue(i, 255, 0, 0, 0.3);
}
table.SetRampToLinear();
table.Build();
This however still gives me and image with red, green, and blue
showing up instead of just red. Also just to note this is on top of a
black/white image, so there aren't any other places from which the
colors could come from. Any help would be appreciated. Thanks.
Regards,
Neel Patel
--
View this message in context: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble&amp;data=02%7C01%7Classo%40queensu.ca%7Cf443d9033aaf448c833408d6413c720f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636768125213390066&amp;sdata=Gr5TWFZL9U8pp5Dt9OtA0h%2BqhjqtFJcgOPZkFPtTmu4%3D&amp;reserved=0.
com/Clarification-and-help-using-vtkLookupTable-tp5744313.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
Powered by
https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&am
p;data=02%7C01%7Classo%40queensu.ca%7Cf443d9033aaf448c833408d6413c720
f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636768125213390066&amp
;sdata=xKCvyP7b1fzlB7CY14vKNEMzZ57wfNnfn3IokUb0GRY%3D&amp;reserved=0
Visit other Kitware open-source projects at
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.k
itware.com%2F&amp;data=02%7C01%7Classo%40queensu.ca%7Cf443d9033aaf448
c833408d6413c720f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636768
125213390066&amp;sdata=K5Sha9ew1zZ3uimPY0L%2BDk1JPv9Zf1GdYut0SHaMw4E%
3D&amp;reserved=0
opensource/opensource.html
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.v
tk.org%2FWiki%2FVTK_FAQ&amp;data=02%7C01%7Classo%40queensu.ca%7Cf443d
9033aaf448c833408d6413c720f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C
0%7C636768125213390066&amp;sdata=rT3yPFdComh%2BWQFBOgo8vYgfSgKvIUozhY
%2BTrblTrFA%3D&amp;reserved=0
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkm
ail.org%2Fsearch%2F%3Fq%3Dvtkusers&amp;data=02%7C01%7Classo%40queensu
.ca%7Cf443d9033aaf448c833408d6413c720f%7Cd61ecb3b38b142d582c4efb2838b
925c%7C1%7C0%7C636768125213390066&amp;sdata=3CK1X5hAIJCIn6Lu0NjX6i%2F
rq61WKKj3r3q131nGNMY%3D&amp;reserved=0
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpubli
c.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&amp;data=02%7C01%7Class
o%40queensu.ca%7Cf443d9033aaf448c833408d6413c720f%7Cd61ecb3b38b142d58
2c4efb2838b925c%7C1%7C0%7C636768125213390066&amp;sdata=JFhq5aqab5TP%2
BVA5dZWvbVXD6tLY4x0gJ9oTJn5sf%2Bk%3D&amp;reserved=0
_______________________________________________
Powered by
https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&amp
;data=02%7C01%7Classo%40queensu.ca%7Cf443d9033aaf448c833408d6413c720f%
7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636768125213390066&amp;sd
ata=xKCvyP7b1fzlB7CY14vKNEMzZ57wfNnfn3IokUb0GRY%3D&amp;reserved=0
Visit other Kitware open-source projects at
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.ki
tware.com%2Fopensource%2Fopensource.html&amp;data=02%7C01%7Classo%40qu
eensu.ca%7Cf443d9033aaf448c833408d6413c720f%7Cd61ecb3b38b142d582c4efb2
838b925c%7C1%7C0%7C636768125213390066&amp;sdata=zSv2RJkpcvZInQHLsgnHK2
xF5Mbj8dAHD2piThqfAVo%3D&amp;reserved=0
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vt
k.org%2FWiki%2FVTK_FAQ&amp;data=02%7C01%7Classo%40queensu.ca%7Cf443d90
33aaf448c833408d6413c720f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7
C636768125213390066&amp;sdata=rT3yPFdComh%2BWQFBOgo8vYgfSgKvIUozhY%2BT
rblTrFA%3D&amp;reserved=0
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkma
il.org%2Fsearch%2F%3Fq%3Dvtkusers&amp;data=02%7C01%7Classo%40queensu.c
a%7Cf443d9033aaf448c833408d6413c720f%7Cd61ecb3b38b142d582c4efb2838b925
c%7C1%7C0%7C636768125213390066&amp;sdata=3CK1X5hAIJCIn6Lu0NjX6i%2Frq61
WKKj3r3q131nGNMY%3D&amp;reserved=0
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic
.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&amp;data=02%7C01%7Classo%
40queensu.ca%7Cf443d9033aaf448c833408d6413c720f%7Cd61ecb3b38b142d582c4
efb2838b925c%7C1%7C0%7C636768125213390066&amp;sdata=JFhq5aqab5TP%2BVA5
dZWvbVXD6tLY4x0gJ9oTJn5sf%2Bk%3D&amp;reserved=0
--
Sent from: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&amp;data=02%7C01%7Classo%40queensu.ca%7Cf443d9033aaf448c833408d6413c720f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636768125213390066&amp;sdata=cFaWLyy1Ofe82rlhMqKaG7hKoKXkSU69%2BUYIcvTX7Nw%3D&amp;reserved=0
_______________________________________________
Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&amp;data=02%7C01%7Classo%40queensu.ca%7Cf443d9033aaf448c833408d6413c720f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636768125213390066&amp;sdata=xKCvyP7b1fzlB7CY14vKNEMzZ57wfNnfn3IokUb0GRY%3D&amp;reserved=0

Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&amp;data=02%7C01%7Classo%40queensu.ca%7Cf443d9033aaf448c833408d6413c720f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636768125213390066&amp;sdata=zSv2RJkpcvZInQHLsgnHK2xF5Mbj8dAHD2piThqfAVo%3D&amp;reserved=0

Please keep messages on-topic and check the VTK FAQ at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&amp;data=02%7C01%7Classo%40queensu.ca%7Cf443d9033aaf448c833408d6413c720f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636768125213390066&amp;sdata=rT3yPFdComh%2BWQFBOgo8vYgfSgKvIUozhY%2BTrblTrFA%3D&amp;reserved=0

Search the list archives at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&amp;data=02%7C01%7Classo%40queensu.ca%7Cf443d9033aaf448c833408d6413c720f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636768125213390066&amp;sdata=3CK1X5hAIJCIn6Lu0NjX6i%2Frq61WKKj3r3q131nGNMY%3D&amp;reserved=0

Follow this link to subscribe/unsubscribe:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtkusers&amp;data=02%7C01%7Classo%40queensu.ca%7Cf443d9033aaf448c833408d6413c720f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636768125213390066&amp;sdata=DnXjuCp5k%2Fv89Vn7jM5QZ3HfyiVzINHqlLU8TnnNwJI%3D&amp;reserved=0
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers

Loading...