[Insight-users] A confusion using GetFileNames() with DICOM files...

Simon Harris s.j.harris at imperial.ac.uk
Thu Aug 26 08:28:45 EDT 2004


I got a little confused using the function GetFileNames() to find
the list of filenames in a Dicom set...

Using the example code DicomSeriesReadImageWrite.cxx I first ran
it without entering a series ID code for a dataset that contained
5 series.

I then entered the first series and it ran ok
Entering the second and subsequent series codes however produced
*exactly* the same files out as for the first series. I discovered
that what was happening was a problem with the line

       fileNames = nameGenerator->GetFileNames( argv[3] );

I looked at the GetFileNames() member function and discovered there
are 2 versions

   const std::vector<std::string> &GetFileNames (bool recursive = false);
   const std::vector<std::string> &GetFileNames (const std::string&  
seriesUID,bool recursive = false);

and even though I had supplied a seriesUID, it was actually executing the
first function.

The compiler decided that the c-string provided by argv[3] was closer to a  
bool
than to a c++ string and was using the wrong overloaded function, so  
whatever
seriesUID I attempted to enter, it always used the default first one.

The function works fine if you provide a C++ string (i'm currently trying  
to
modify the example to obtain all the seriesUIDs and their data for a CT  
scan
that's split into different regions) and am iterating through the series
C++ style strings).

Simon.


-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/


More information about the Insight-users mailing list