Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible error on python ElevationBandsWithGlyphs example #140

Open
NahomKidane opened this issue Mar 14, 2018 · 3 comments
Open

Possible error on python ElevationBandsWithGlyphs example #140

NahomKidane opened this issue Mar 14, 2018 · 3 comments

Comments

@NahomKidane
Copy link

VTKExamples/Python/Visualization/ElevationBandsWithGlyphs

On ReverseLUT, I think we also need to reverse the annotations. Fixed by add the line "revList = reversed(list(range(t + 1))) after the second t assignment.

def ReverseLUT(lut):
"""
Create a lookup table with the colors reversed.
:param: lut - An indexed lookup table.
:return: The reversed indexed lookup table.
"""
lutr = vtk.vtkLookupTable()
lutr.DeepCopy(lut)
t = lut.GetNumberOfTableValues() - 1
revList = reversed(list(range(t + 1)))
for i in revList:
rgba = [0, 0, 0]
v = float(i)
lut.GetColor(v, rgba)
rgba.append(lut.GetOpacity(v))
lutr.SetTableValue(t - i, rgba)
t = lut.GetNumberOfAnnotatedValues() - 1
------>revList = reversed(list(range(t + 1)))<-------------
for i in revList:
lutr.SetAnnotation(t - i, lut.GetAnnotation(i))
return lutr

@lorensen
Copy link
Owner

lorensen commented Mar 14, 2018 via email

@ajpmaclean
Copy link
Collaborator

ajpmaclean commented Mar 14, 2018 via email

@ajpmaclean
Copy link
Collaborator

@NahomKidane All fixed, please see: #142

Thankyou so much for finding this. The C++ code was correct, however I must have forgotten to update the Python code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants