[Insight-users] Dicom Image : How to access to all the tags
edoardo.belletti at alice.it
edoardo.belletti at alice.it
Mon Mar 8 17:35:55 EST 2010
Hi Insight-users,
I have a problem: I don't know how can I access to all the tags present in a dicom image.
With the code used in the example of the manual (Examples/IO/DicomImageReadPrintTags.cxx) not all the tags are printed and for accuracy in the output there isn't the tag "SequenceOfUltrasoundReagions" that interest me. But I know that in the file which I run this tag is present.
How can I access to this tag?
I hope I was understandable.
In particular the piece of code is:
typedef itk::MetaDataDictionary DictionaryType;
const DictionaryType & dictionary = dicomIO->GetMetaDataDictionary();
typedef itk::MetaDataObject< std::string > MetaDataStringType;
DictionaryType::ConstIterator itr = dictionary.Begin();
DictionaryType::ConstIterator end = dictionary.End();
while( itr != end )
{
itk::MetaDataObjectBase::Pointer entry = itr->second;
MetaDataStringType::Pointer entryvalue = dynamic_cast<MetaDataStringType *>( entry.GetPointer() );
if( entryvalue )
{
std::string tagkey = itr->first;
std::string labelId;
bool found = itk::GDCMImageIO::GetLabelFromTag( tagkey, labelId );
std::string tagvalue = entryvalue->GetMetaDataObjectValue();
if( found )
{
std::cout << "(" << tagkey << ") " << labelId;
std::cout << " = " << tagvalue.c_str() << std::endl;
if (tagkey == "0018|6011")
std::cout << "\n\nTROVATO!!!!!\n\n";
}
else
{
std::cout << "(" << tagkey << ") " << "Unknown";
std::cout << " = " << tagvalue.c_str() << std::endl;
}
}
++itr;
}
Thank you vary much
Edoardo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100308/8c4a7110/attachment.htm>
More information about the Insight-users
mailing list