28#ifndef vtkLabelMapLookup_h
29#define vtkLabelMapLookup_h
31#include <unordered_set>
49 this->CachedValue =
static_cast<T
>(values[0]);
50 this->CachedOutValue =
static_cast<T
>(values[0]);
51 this->CachedOutValueInitialized =
false;
57 if (label == this->CachedValue)
62 else if (this->CachedOutValueInitialized && label == this->CachedOutValue)
98 for (
int vidx = 0; vidx < numValues; vidx++)
100 Map.push_back(
static_cast<T
>(values[vidx]));
113 if (std::find(this->Map.begin(), this->Map.end(), label) != this->Map.end())
115 this->CachedValue = label;
120 this->CachedOutValue = label;
121 this->CachedOutValueInitialized =
true;
131 std::unordered_set<T>
Map;
136 for (
int vidx = 0; vidx < numValues; vidx++)
138 Map.insert(
static_cast<T
>(values[vidx]));
151 if (this->Map.find(label) != this->Map.end())
153 this->CachedValue = label;
158 this->CachedOutValue = label;
159 this->CachedOutValueInitialized =
true;
170 const double* values,
vtkIdType numLabels)
177 else if (numLabels < 20)
bool IsLabelValue(T label) override
std::unordered_set< T > Map
LabelSet(const double *values, int numValues)
LabelVector(const double *values, int numValues)
bool IsLabelValue(T label) override
bool IsLabelValue(T label) override
SingleLabelValue(const double *values)
provide an efficient numeric label lookup
virtual ~vtkLabelMapLookup()=default
vtkLabelMapLookup(const double *values, int vtkNotUsed(numValues))
bool CachedOutValueInitialized
static vtkLabelMapLookup< T > * CreateLabelLookup(const double *values, vtkIdType numLabels)
bool IsLabelValueInCache(T label, bool &inLabelSet)
virtual bool IsLabelValue(T label)=0