[Dcmlib] [Fwd: GDCM eventually replacing DICOMImageIO2]

Jean-Pierre ROUX jean-pierre.roux at creatis.insa-lyon.fr
Fri Jan 28 22:57:53 CET 2005


At 12:08 -0500 28/01/05, Mathieu Malaterre wrote:
>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 ?

The method in CVS version supposes you have a single serie in a given 
directory, and discards any alien file that wouldn't have the same 
'Serie Instance UID' than the first file encountered in the directory.
If the first file is an alien file, *all* the regular files will be discarted.

What I suggested is to return a set (as a std::vector, std::map, 
std::list) of CoherentGdcmFileList, instead of returning a single one.
You would have then
CoherentGdcmFileList[0] = list containing the alien file
CoherentGdcmFileList[1] = list containing the regular(same Serie 
Instance UID)  files

(I used vector notation. Of course, we should have methods such as 
FindFirstCoherentList() and FindNextCoherentList() to hide the 
internal implementation ...)

Bill said it's a common occurence to have several series in the same directory.
You would have :

CoherentGdcmFileList[2] = list containing and other set of coherent 
(same Serie Instance UID) files.

BTW : Bill wrote about the easy to use DICOMSeriesFilenames API.
Could you tell us what it is.
Thx
JP



>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

   Jean-Pierre ROUX
   UMR CNRS 5515-CREATIS
   Laboratoire de Radiologie Experimentale
   Hopital Cardiologique
   28 Avenue du Doyen LEPINE
   B.P. Lyon-Montchat
   69394 Lyon Cedex 03
 
   Tel      : (+33) 04 72 35 74 12
   Fax      : (+33) 04 72 68 49 16
   URL      : http://www.creatis.univ-lyon1.fr
   e-mail   : jpr at creatis.univ-lyon1.fr
								   



More information about the Dcmlib mailing list