[Insight-users] File names containing space

Jean-Pierre Roux jpr at creatis.insa-lyon.fr
Thu Jun 11 09:42:52 EDT 2009


Hi, everybody!

I've got some DICOM files whose name contains a blank space (e.g. : 
IM0025 .dcm)

Even if I replace the " "  by  "\ "  , with the following code :

      std::string temp = dirName + d_name;
      std::string::size_type  spacePosition = temp.find_first_of(' ');
      if (spacePosition != std::string::npos);
               temp.insert(spacePosition, "\\");

the programs hangs :

 itk::ImageIOBase::Pointer genericReader =
      itk::ImageIOFactory::CreateImageIO(temp.c_str(),
                     itk::ImageIOFactory::ReadMode);
    if (!genericReader)
      {
      bbtkError("File format unknown (while reading [" << filename << "])");
      }

When file name doesn't contain any space, it runs OK.
Did I missed anything?

Thx

Jean-Pierre


More information about the Insight-users mailing list