GDCMSeriesFileNames SetRecursive

Hello everyone,

I try to read all my dicoms recursively. For this I try to use itk::GDCMSeriesFileNames class (itk version 4.13.1).

itk::GDCMSeriesFileNames::Pointer nameGenerator = itk::GDCMSeriesFileNames::New();

Unfortunately, I have a warning message saying that no series were found.

Did I do something wrong?

Thank you.

Does it work without SetRecursive call? If that is not the issue, can you start with an example which is known to work and gradually modify it to suit your needs?

I forgot to mention: it’s working if I launch my software on a folder containing directly the disoms.

For example:





If I launch my app with childFolder has the directory, the series is read (I have the series UID). If I launch my app with parentFolder, I expected to have the same result, but I have nothing (except the warning telling me that no series were found).

I did the test with and without SetRecursive call and the same results as above appear.

I use this example as starting point.

This is the simple code I use to test:

#include <iostream>
#include <string>
#include <vector>
#include <itkGDCMSeriesFileNames.h>
int main(int argc, char const *argv[])
if (argc < 2)
std::cout << “Usage: " << argv[0] << " dicom_path” << std::endl;
return 0;
itk::GDCMSeriesFileNames::Pointer nameGenerator = itk::GDCMSeriesFileNames::New();
std::vector<std::string> seriesUID = nameGenerator->GetSeriesUIDs();
for (auto & uid : seriesUID)
std::cout << uid << std::endl;
return 0;

@mathieu.malaterre This sounds like either like a limitation or a bug in GDCM.

I found the solution we must call SetRecursive before the SetDirectory!


I agree this is a bug. I am not convinced this lie in GDCM codebase. I would have assumed this was in GDCMSeriesFileNames. Anyway feel free to create an issue and assigned it to me. Thanks for the report.

It is related to GDCMSeriesFileNames::SetInputDirectory. I have made a patch to improve the documentation. That is the easiest.