[Insight-users] how to read DICOM tags that cannot be expressed in strings

童明 tongm1987 at gmail.com
Mon Nov 28 07:33:49 EST 2011


hi, all:

Any one has experience using ITK to read ECG

curveData from DICOM header file?



I tried the method in the ITK software guide but it turned out not
working. I think the reason is that the tag(5000, 3000) can’t
expressed in string.

Following is my code:

     typedef itk::MetaDataDictionary DictionaryType;

    dicomIO = ImageIOType::New();

     dicomIO->LoadPrivateTagsOn();

      dicomIO->SetMaxSizeLoadEntry( 65535 );

         const DictionaryType & dictionary = dicomIO->GetMetaDataDictionary();

         typedef itk::MetaDataObject< std::string > MetaDataStringType;

         DictionaryType::ConstIterator itr = dictionary.Begin();

         DictionaryType::ConstIterator end = dictionary.End();

      std::string entryId = "5000|3000";

     DictionaryType::ConstIterator tagItr = dictionary.Find(entryId);

    if (tagItr != end)

     {

   MetaDataStringType::ConstPointer entryvalue =

                            dynamic_cast<const MetaDataStringType
*>(tagItr->second.GetPointer());



         if (entryvalue)

         {

                  std::string tagValue = entryvalue->GetMetaDataObjectValue();

                            //const char * cstr = tagValue.c_str();

                  std::cout<<tagValue.size()<<" "<<tagValue<<'\n';

         }

     }

.The string returned is kind of wired and doesn't match to the number
of samples at all.



Any help will be highly appreciated.


-- 
Best Regards!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
童明
清华大学医学院生物医学工程系
硕士研究生
Tong Ming
Department of Biomedical Engineering,
School of Medicine, Tsinghua University
Master Candidate
Tel:152-1095-5604
Email:tongm1987 at gmail.com


More information about the Insight-users mailing list