[Dcmlib] Use DicomDir with vtkGdcmReader

Jean-Pierre Roux jpr at creatis.insa-lyon.fr
Fri Jun 8 13:48:09 CEST 2007


Lazzarato Dr. Gianni wrote:
> Hi Jean-Pierre,
> Your new seriehelper works wonderful, so the duplicate files are correct
> bypassed, thanks a lot.
>
> I have another little question about another kind of dataset:
>
> It has a directory tree with various subdirectory with a file called
> DICOMDIR in the root.
>
> Searching among the users list I find among the other this Mathieu answer:
> http://public.kitware.com/pipermail/vtkusers/2003-November/070545.html
>   
Hi, Gianni.
==>Mathieus's answer was on the use of

vtkDICOMImageReade::SetDirectoryName() method.

not on the use of the 'DicomDir' object.
(when there are multiple Series, you can have either as many 
subdirectories as different SeriesUID (this seems to be *your* case, 
you're a lucky man) or a single directory, with *all* the images 
belonging to *all* the Series (and probabely *all* the Studies ...)

> Using gdcm PRINTDICOMDIR.exe  I see there is one patient and 2 series in
> this dataset.
> Is it possible using vtkGdcmReader to use DicomDir as an argument without
> exploring all the subdirectory searching the series?
>   
==> For the moment, if you don't want to 'parse' all the images of the 
root directory, you can load the gdcm::DicomDir :
- select the gdcm::DicomDirSerie (of the gdcm::DicomDirStudy of the 
gdcm::DicomDirPatient) you want to  deal with,
(have a look at Examples/PrintDicomDir.cxx to see haow to 'navaigate' 
thru a gdcm::DicomDir)
- get the file names, fill a typedef std::vector<File* > FileList of 
your own with the relevant gdcm::File*,
- pass it to the vtkGdcmReader, using the method :

SetCoherentFileList( std::vector<gdcm::File* > *cfl);


==> You may use the methods of gdcm:SerieHelper  to check the file set 
you passed, to sort it, to discard some files, etc.

> I searched along all gdcm example an testing example but I did not find an
> example ( but probably is not possible to do what I figured out?)
>   
==>Something more 'user friendly' is possible (but not yet written):
a method
void vtkGdcmReader::SetDicomDirSerie(gdcm::DicomDirSerie *s)
doing the same thing than :
void vtkGdcmReader::SetDirectory(std::string const &dir, bool 
recursive=false);

==> Mathieu, any comment?

JP
> Ciao 
>
> Gianni
>
>
>
>
>
>
>
>
>   



More information about the Dcmlib mailing list