[Insight-users] gdcm 2.0 - single tag/key

Mathieu Malaterre mathieu.malaterre at gmail.com
Mon Dec 8 03:40:34 EST 2008


On Sun, Dec 7, 2008 at 5:07 PM, Rashindra Manniesing
<r.manniesing at erasmusmc.nl> wrote:
>
> I am using gdcm 2.0 in itk now, and I was wondering how to read an
> user-defined single tag/key pair from the header other than provided by
> the dicomapphelper.

What is dicomapphelper ? there is no such beast in gdcm AFAIK.

In ITK/GDCM:

    std::string tagkey = "0008|1050";
    std::string labelId;
    if( itk::GDCMImageIO::GetLabelFromTag( tagkey, labelId ) )
      {
      std::string value;
      std::cout << labelId << " (" << tagkey << "): ";
      if( dicomIO->GetValueFromTag(tagkey, value) )
        {
        std::cout << value;
        }
      else
        {
        std::cout << "(No Value Found in File)";
        }
      std::cout << std::endl;
      }
    else
      {
      std::cerr << "Trying to access inexistant DICOM tag." << std::endl;
      }


2cts
-- 
Mathieu


More information about the Insight-users mailing list