[Dcmlib] [Fwd: GDCM eventually replacing DICOMImageIO2]

Mathieu Malaterre mathieu.malaterre at kitware.com
Fri Jan 28 18:08:34 CET 2005


Jean-Pierre Roux wrote:
> Mathieu Malaterre wrote:
> 
>>
>>
>> -------- Original Message --------
>> Subject: GDCM eventually replacing DICOMImageIO2
>> Date: Fri, 19 Nov 2004 16:21:16 -0500
>> From: Lorensen, William E (Research) <>
>>
>>
>> Folks,
> 
> 
> Hi !
> I just found in my mailbox, an old mail from Bill, and no response (as 
> far I can say)
> SerieHeader::AddFileName()  adds the file to the list only if it has the 
> same Serie UID than the first file, found in the source Directory
> (single level exploration).
> That's a bit hard, IMHO !
> 
> --> We could easyly, without breaking the API, allow a recursive 
> exploration of the root Directory  (just add a bolean in the constructor).
> --> Instead of dropping any file whose 'Serie Instance UID' does not 
> match with the first file, we could return a std::map (key : 'Serie 
> Instance UID', second : a std::list of gdcm::File *)
> Every list should then be dealt with just as CoherentGdcmFileList was.
> 
> Would it help ?

 From gdcmSerieHeader.h:

  /// Ref to the current Serie Instance UID to avoid mixing two series
    /// within the same directory
    std::string    CurrentSerieUID;

 From gdcmSerieHeader.cxx

void SerieHeader::AddFileName(std::string const &filename)
{
    //directly use string and not const char*:
    File *header = new File( filename );
    if( header->IsReadable() )
    {
       // 0020 000e UI REL Series Instance UID
       std::string uid =  header->GetEntryValue (0x0020, 0x000e);
       // if uid == GDCM_UNFOUND then consistenly we should find 
GDCM_UNFOUND
       // no need here to do anything special
       if( CurrentSerieUID == "" )
       {
          // Set the current one
          CurrentSerieUID = uid;
       }
       if( CurrentSerieUID == uid )
       {
          // Current Serie UID and DICOM header seems to match add the file:
          CoherentGdcmFileList.push_back( header );
       }
       else
       {
          gdcmVerboseMacro("Wrong Serie Instance UID should be:" << 
CurrentSerieUID );
       }
    }
    else
    {
       gdcmVerboseMacro("Could not read file: " << filename );
       delete header;
    }
}



Don't you think this will work ? This is currently in ITK, gdcm CVS and 
gdcm 0.6 branch...

Mathieu



More information about the Dcmlib mailing list