Medical Imaging Interaction Toolkit
2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
|
Go to the documentation of this file.
13 #ifndef mitkGenericLookupTable_h
14 #define mitkGenericLookupTable_h
21 #include <itkDataObject.h>
26 #include <nlohmann/json.hpp>
71 throw std::range_error(
"id does not exist in the lookup table");
103 template <
typename T>
118 #define mitkSpecializeGenericLookupTable(LookupTableName, Type) \
120 class MITKCORE_EXPORT LookupTableName : public GenericLookupTable<Type> \
124 typedef LookupTableName Self; \
125 typedef GenericLookupTable<Type> Superclass; \
126 virtual const char *GetNameOfClass() const { return #LookupTableName; } \
127 LookupTableName() {} \
128 virtual Superclass &operator=(const Superclass &other) { return Superclass::operator=(other); } \
129 virtual ~LookupTableName() {} \
132 MITKCORE_EXPORT std::ostream &operator<<(std::ostream &stream, const LookupTableName & );
139 #define mitkSpecializeGenericLookupTableOperator(LookupTableName) \
141 std::ostream &mitk::operator<<(std::ostream &stream, const LookupTableName &l) \
144 typedef LookupTableName::LookupTableType::const_iterator IterType; \
145 IterType e = l.GetLookupTable().end(); \
146 IterType b = l.GetLookupTable().begin(); \
148 for (IterType i = b; i != e; ++i) \
154 stream << i->first << " -> " << i->second; \
156 return stream << "]"; \
void to_json(nlohmann::json &j, const GenericLookupTable< T > &t)
virtual Self & operator=(const Self &other)
void SetTableValue(IdentifierType id, ValueType value)
const LookupTableType & GetLookupTable() const
virtual const char * GetNameOfClass() const
void from_json(const nlohmann::json &, GenericLookupTable< T > &)
bool operator!=(const Self &lookupTable) const
ValueType GetTableValue(IdentifierType id) const
Find image slices visible on a given plane.
bool ValueExists(IdentifierType id) const
unsigned int IdentifierType
LookupTableType m_LookupTable
bool operator==(const Self &lookupTable) const
std::map< IdentifierType, ValueType > LookupTableType
Template class for generating lookup-tables.
virtual ~GenericLookupTable()