Page MenuHomePhabricator

mitkLookuptable get color uses int parameter instead of double
Closed, ResolvedPublic

Description

void mitk::LookupTable::GetColor(int x, double rgb[3])
internally simply calls
this->GetVtkLookupTable()->GetColor(x,rgb)
which expects "x" to be of type double. Probably a copy past error from the method right below
void mitk::LookupTable::GetTableValue(int x, double rgba[4])

Solution:
change method to
void mitk::LookupTable::GetColor(double x, double rgb[3])

Event Timeline

I changed the interface and added documentation.

Core modification: This is a trivial bug. The function only worked because the compiler automatically converts int to double. All I did regarding function is to change the interface from:
void mitk::LookupTable::GetTableValue(int x, double rgba[4])
to
void mitk::LookupTable::GetColor(double x, double rgb[3])

Release fix: I think we can integrate this in the current release. I tested all color maps - no issues.

User kilgus has pushed new remote branch:

bug-18622-FixGetValue

Branch is ready to merge once the flags are set.

I made a mistake in my previous comment the interface is changed from:
void mitk::LookupTable::GetColor(int x, double rgba[3])
to
void mitk::LookupTable::GetColor(double x, double rgb[3])

[7029bd]: Merge branch 'bug-18622-FixGetValue'

Merged commits:

2015-04-08 15:47:19 Thomas Kilgus [1f2c8c]
Fixed the interface error and added documentation for the wrapper methods.