Commit 2c86574b authored by Zack Galbreath's avatar Zack Galbreath
Browse files

use SetMaxDiscreteValues for categorical color map

Use the new function vtkAbstractArray::SetMaxDiscreteValues within
vtkTreeHeatmapItem.  This allows us to properly color categorical
datasets that contain more than 32 distinct values.

Within this commit, we also change the color set that we're using for
the categorical color map.  The accent set is pretty, but it only has
8 different values.  Instead we'll use qualitative set3 because it
has 12 values.

Finally, we fix a bug in vtkTreeHeatmapItem so that our NaN color
(grey) is used appropriately by our categorical lookup table.

Change-Id: I53bc9f13240be8c0c10b5dbc77bdcca1ea0fa2a1
parent 02ffb7ac
b572f6b4bf5f1433fdeeb65c941784b7 4d361f7186ba6ebacc94ea7c8e9b5c64
...@@ -534,6 +534,7 @@ void vtkTreeHeatmapItem::AccumulateProminentCategoricalDataValues(vtkIdType colu ...@@ -534,6 +534,7 @@ void vtkTreeHeatmapItem::AccumulateProminentCategoricalDataValues(vtkIdType colu
// add each distinct value from this column to our master list // add each distinct value from this column to our master list
vtkNew<vtkVariantArray> distinctValues; vtkNew<vtkVariantArray> distinctValues;
stringColumn->SetMaxDiscreteValues(stringColumn->GetNumberOfTuples() - 1);
stringColumn->GetProminentComponentValues(0, distinctValues.GetPointer()); stringColumn->GetProminentComponentValues(0, distinctValues.GetPointer());
for (int i = 0; i < distinctValues->GetNumberOfTuples(); ++i) for (int i = 0; i < distinctValues->GetNumberOfTuples(); ++i)
...@@ -549,8 +550,8 @@ void vtkTreeHeatmapItem::AccumulateProminentCategoricalDataValues(vtkIdType colu ...@@ -549,8 +550,8 @@ void vtkTreeHeatmapItem::AccumulateProminentCategoricalDataValues(vtkIdType colu
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void vtkTreeHeatmapItem::GenerateCategoricalDataLookupTable() void vtkTreeHeatmapItem::GenerateCategoricalDataLookupTable()
{ {
this->ContinuousDataLookupTable->ResetAnnotations(); this->CategoricalDataLookupTable->ResetAnnotations();
this->ContinuousDataLookupTable->SetNanColor(0.75, 0.75, 0.75, 1.0); this->CategoricalDataLookupTable->SetNanColor(0.75, 0.75, 0.75, 1.0);
// make each distinct categorical value an index into our lookup table // make each distinct categorical value an index into our lookup table
for (int i = 0; i < this->CategoricalDataValues->GetNumberOfTuples(); ++i) for (int i = 0; i < this->CategoricalDataValues->GetNumberOfTuples(); ++i)
...@@ -561,7 +562,7 @@ void vtkTreeHeatmapItem::GenerateCategoricalDataLookupTable() ...@@ -561,7 +562,7 @@ void vtkTreeHeatmapItem::GenerateCategoricalDataLookupTable()
} }
vtkNew<vtkColorSeries> colorSeries; vtkNew<vtkColorSeries> colorSeries;
colorSeries->SetColorScheme(vtkColorSeries::BREWER_QUALITATIVE_ACCENT); colorSeries->SetColorScheme(vtkColorSeries::BREWER_QUALITATIVE_SET3);
colorSeries->BuildLookupTable(this->CategoricalDataLookupTable.GetPointer()); colorSeries->BuildLookupTable(this->CategoricalDataLookupTable.GetPointer());
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment