19#ifndef vtkLabelMapLookup_h
20#define vtkLabelMapLookup_h
22#include "vtkCommonDataModelModule.h"
24#include <unordered_set>
27VTK_ABI_NAMESPACE_BEGIN
43 this->CachedValue =
static_cast<T
>(values[0]);
44 this->CachedOutValue =
static_cast<T
>(values[0]);
45 this->CachedOutValueInitialized =
false;
51 if (label == this->CachedValue)
56 else if (this->CachedOutValueInitialized && label == this->CachedOutValue)
92 for (
int vidx = 0; vidx < numValues; vidx++)
94 Map.push_back(
static_cast<T
>(values[vidx]));
107 if (std::find(this->Map.begin(), this->Map.end(), label) != this->Map.end())
109 this->CachedValue = label;
114 this->CachedOutValue = label;
115 this->CachedOutValueInitialized =
true;
125 std::unordered_set<T>
Map;
130 for (
int vidx = 0; vidx < numValues; vidx++)
132 Map.insert(
static_cast<T
>(values[vidx]));
145 if (this->Map.find(label) != this->Map.end())
147 this->CachedValue = label;
152 this->CachedOutValue = label;
153 this->CachedOutValueInitialized =
true;
164 const double* values,
vtkIdType numLabels)
171 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