18 #ifndef __otbAttributesMapLabelObject_h
19 #define __otbAttributesMapLabelObject_h
40 template<
class TLabelObject>
55 return labelObject->GetAttribute(m_AttributeName.c_str());
59 void SetAttributeName(
const char * name)
61 m_AttributeName = name;
64 const char * GetAttributeName()
const
66 return m_AttributeName.c_str();
86 template<
class TLabelObject,
class TMeasurementVector>
92 inline TMeasurementVector
operator()(
const TLabelObject *
object)
const
96 unsigned int attrIndex = 0;
97 typename AttributesListType::const_iterator attrIt =
m_Attributes.begin();
100 newSample[attrIndex] =
object->GetAttribute(attrIt->c_str());
154 template <
class TLabel,
unsigned int VImageDimension,
class TAttributesValue>
173 itkStaticConstMacro(ImageDimension,
unsigned int, VImageDimension);
203 m_Attributes[name] = value;
212 this->SetAttribute(name.c_str(), value);
221 if (it != m_Attributes.end())
227 itkExceptionMacro(<<
"Could not find attribute named " << name <<
".");
234 unsigned int GetNumberOfAttributes()
const
236 return m_Attributes.size();
242 std::vector<std::string> GetAvailableAttributes()
const
244 std::vector<std::string> attributesNames;
248 while (it != m_Attributes.end())
250 attributesNames.push_back(it->first);
253 return attributesNames;
261 Superclass::CopyAttributesFrom(lo);
264 const Self * src =
dynamic_cast<const Self *
>(lo);
299 Superclass::PrintSelf(os, indent);
300 os << indent <<
"Attributes: " << std::endl;
302 it != m_Attributes.end(); ++it)
304 os << indent << indent << it->first <<
" = " << it->second << std::endl;
309 void operator =(
const Self&);