Skip to content
Snippets Groups Projects
Commit ca2bc777 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

MRG

parents c661319f 58b70021
No related branches found
No related tags found
No related merge requests found
......@@ -233,6 +233,8 @@ public:
* \param key The name of the field.
*/
bool HasField(std::string key) const;
/**
* \return the nth field of the node as a std::pair of (key,value).
* \param index the index of the field to return.
......@@ -242,6 +244,12 @@ public:
* \return the number of fields in the node.
*/
// unsigned int GetNumberOfFields() const;
/**
* \return the name of fields in the node.
*/
std::vector<string> GetFieldList() const;
/**
* Clear all fields.
*/
......
......@@ -354,6 +354,8 @@ DataNode<TPrecision, VDimension, TValuePrecision>
return false;
}
/*
template <class TPrecision, unsigned int VDimension, class TValuePrecision>
typename DataNode<TPrecision,VDimension,TValuePrecision>
......@@ -380,6 +382,25 @@ DataNode<TPrecision,VDimension,TValuePrecision>
{
return m_FieldMap.size();
}
*/
template <class TPrecision, unsigned int VDimension, class TValuePrecision>
std::vector<std::string>
DataNode<TPrecision, VDimension, TValuePrecision>
::GetFieldList() const
{
VectorDataKeywordlist keywordlist;
if (this->GetMetaDataDictionary().HasKey(MetaDataKey::VectorDataKeywordlistKey))
{
itk::ExposeMetaData<VectorDataKeywordlist>(this->GetMetaDataDictionary(),
MetaDataKey::VectorDataKeywordlistKey, keywordlist);
return keywordlist.GetFieldList();
}
std::vector<std::string> empty;
return empty;
}
/*
template <class TPrecision, unsigned int VDimension, class TValuePrecision>
void
DataNode<TPrecision,VDimension,TValuePrecision>
......@@ -387,6 +408,9 @@ DataNode<TPrecision,VDimension,TValuePrecision>
{
m_FieldMap.clear();
}*/
template <class TPrecision, unsigned int VDimension, class TValuePrecision>
bool
DataNode<TPrecision, VDimension, TValuePrecision>
......
......@@ -166,6 +166,18 @@ VectorDataKeywordlist
return m_FieldList.size();
}
std::vector<std::string>
VectorDataKeywordlist
::GetFieldList() const
{
std::vector<std::string> res;
for (int i = 0; i < m_FieldList.size(); ++i)
{
res.push_back((m_FieldList[i].first)->GetNameRef());
}
return res;
}
void
VectorDataKeywordlist
::operator =(const Self& p)
......
......@@ -88,6 +88,11 @@ public:
*/
unsigned int GetNumberOfFields() const;
/**
* \return the name of fields in the node.
*/
std::vector<std::string> GetFieldList() const;
/**
* Print the keyword list
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment