[Insight-users] RE: Getting at private dicom tags

Kris Thielemans kris.thielemans at imperial.ac.uk
Wed Oct 11 21:09:51 EDT 2006


Hi

I solved my own problem (original post 1 month ago). Thought to let you
know.

The bit that I didn't tell you was that I had to read one of the files in
the series to get at the value of the tags:

  typedef itk::GDCMImageIO       ImageIOType; 
  ImageIOType::Pointer dicomIO = ImageIOType::New(); 
  typedef itk::Image< float, 2 >         ImageType2D; 
  typedef itk::ImageFileReader< ImageType2D >        ReaderType2D; 
  ReaderType2D::Pointer reader = ReaderType2D::New();
  reader->SetImageIO( dicomIO ); 
  typedef std::vector<std::string>    FileNamesContainer; 
  FileNamesContainer fileNames = nameGenerator->GetFileNames(
seriesItr->c_str());
  reader->SetFileName( fileNames[0].c_str() );
  reader->Update(); 

Only then can I call dicomIO->GetMetaDataDictionary() as I said in my
original post.

So, where was the problem?

I had set
   nameGenerator->SetLoadPrivateTags ( true );

But I had NOT set
  dicomIO->SetLoadPrivateTags(true); 

I guess I thought that this was done by the nameGenerator business but as
that one doesn't know about dicomIO, that was rather stupid.

Now you know.

Oh, maybe I really didn't have to read this file to get the dictionary after
all? Do I?

Kris

> -----Original Message-----
> From: Thielemans, Kris [mailto:kris.thielemans at imperial.ac.uk]
> Sent: 15 September 2006 18:07
> To: insight-users at itk.org
> Subject: Getting at private dicom tags
> 
> Hi
> 
> I need to get the value of a private tag (frame number in GE gated PET 
> data). I know for sure that the tag is there (for instance using 
> dcmtk's dcmdump).
> 
> I've modified the example IO/DicomSeriesReadPrintTags to what's 
> happening, e.g. I've added
> 
>   nameGenerator->SetLoadPrivateTags ( true );
>   nameGenerator->AddSeriesRestriction("0009|10D8" );
> 
> This works in the sense that the value of the frame_number now gets 
> added to the 'seriesIdentifier'. However, when I try to get at its 
> value using
> 
>   typedef itk::MetaDataDictionary   DictionaryType;
>   const  DictionaryType & dictionary =
> dicomIO->GetMetaDataDictionary();
>   DictionaryType::ConstIterator tagItr = dictionary.Find( "0009|10D8" 
> );
> 
> this function tells me that it cannot find the tag. (It can find some 
> e.g. "0020|0011" SeriesNumber or patientName.
> 
> Indeed, the output of (my modified) DicomSeriesReadPrintTags shows no 
> private tags.
> 
> Is there a way around this?
> 
> Thanks
> 
> Kris Thielemans
> Hammersmith Imanet, part of GE Healthcare
> 





More information about the Insight-users mailing list