<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>the c make file is as follow:<br>CMAKE_MINIMUM_REQUIRED(VERSION 2.4)<br>IF(COMMAND CMAKE_POLICY)<br> CMAKE_POLICY(SET CMP0003 NEW)<br>ENDIF(COMMAND CMAKE_POLICY)<br><br>PROJECT(ImageExamples)<br>FIND_PACKAGE(ITK REQUIRED)<br>INCLUDE(${ITK_USE_FILE})<br>INCLUDE_REGULAR_EXPRESSION("^.*$")<br><br>SET(TEMP ${ITK_BINARY_DIR}/Testing/Temporary)<br><br>ADD_EXECUTABLE(Image2 Image2.cxx )<br>TARGET_LINK_LIBRARIES(Image2 ITKIO)<br><br>SET(IMAGE_EXAMPLES2 ${CXX_TEST_PATH}/ImageExamples2)<br>IF( NOT ITK_DISABLE_CXX_TESTING )<br><br>IF(BUILD_TESTING)<br><br>IF(NOT BORLAND)<br> ADD_TEST(Image2Test ${IMAGE_EXAMPLES}<br> Image2Test ${ITK_SOURCE_DIR}/Examples/Data/BrainMidSagittalSlice.png<br> )<br>ENDIF(NOT BORLAND)<br>ENDIF(BUILD_TESTING)<br>ENDIF( NOT
ITK_DISABLE_CXX_TESTING )<br><br>and the image2.cxx file is :<br>#if defined(_MSC_VER)<br>#pragma warning ( disable : 4786 )<br>#endif<br>#include "itkImage.h"<br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">#include "itkImageFileReader.h"<br>int main( int , char * argv[])<br>{typedef unsigned char PixelType;<br> const unsigned int Dimension = 3;<br><br> typedef itk::Image< PixelType, Dimension > ImageType;<br>typedef itk::ImageFileReader< ImageType > ReaderType;<br>ReaderType::Pointer reader = ReaderType::New();<br>const char * filename = argv[1];<br> reader->SetFileName( filename );<br>reader->Update();<br>ImageType::Pointer image = reader->GetOutput();<br> return 0;}<br><br><div style="font-family:
arial,helvetica,sans-serif; font-size: 13px;"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">De :</span></b> Jean-Pierre Roux <jpr@creatis.insa-lyon.fr><br><b><span style="font-weight: bold;">À :</span></b> insight-users@itk.org<br><b><span style="font-weight: bold;">Envoyé le :</span></b> Jeudi, 11 Juin 2009, 14h42mn 52s<br><b><span style="font-weight: bold;">Objet :</span></b> [Insight-users] File names containing space<br></font><br>Hi, everybody!<br><br>I've got some DICOM files whose name contains a blank space (e.g. : IM0025 .dcm)<br><br>Even if I replace the " " by "\ " , with the following code :<br><br> std::string temp = dirName + d_name;<br> std::string::size_type spacePosition = temp.find_first_of(' ');<br> if (spacePosition != std::string::npos);<br> temp.insert(spacePosition,
"\\");<br><br>the programs hangs :<br><br>itk::ImageIOBase::Pointer genericReader =<br> itk::ImageIOFactory::CreateImageIO(temp.c_str(),<br> itk::ImageIOFactory::ReadMode);<br> if (!genericReader)<br> {<br> bbtkError("File format unknown (while reading [" << filename << "])");<br> }<br><br>When file name doesn't contain any space, it runs OK.<br>Did I missed anything?<br><br>Thx<br><br>Jean-Pierre<br>_____________________________________<br><span>Powered by <a target="_blank" href="http://www.kitware.com">www.kitware.com</a></span><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br><br>Please keep messages on-topic and check the ITK FAQ at: <a
href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br></div></div></div><br>
</body></html>