[Insight-users] Dicom Image : How to access to all the tags

Gomez, Alberto alberto.gomez at kcl.ac.uk
Tue Mar 9 04:49:53 EST 2010


Hi,

I have had the same problem but I think that there is no solution. It 
depends on the manufacturer of the US acquisition system, and whether 
the tags are private or not, and the data encrypted. Anyway, if you find 
a solution, I will be very much interested.

Thanks,

Alberto

edoardo.belletti at alice.it wrote:
> 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
>
>
>   


-- 

Alberto Gómez

/Division of Imaging Sciences
The Rayne Institute
4th Floor, Lambeth Wing
St Thomas' Hospital
London SE1 7EH /

phone: +44 (0) 20 718 88364
email: alberto.gomez at kcl.ac.uk <mailto:alberto.gomez at kcl.ac.uk>



More information about the Insight-users mailing list