[Insight-users] Problems trying to update ImageFileReader II:
problem identified
Luis Ibanez
luis.ibanez at kitware.com
Thu May 11 08:24:17 EDT 2006
Hi Fran,
You are missing to put escape sequences for the "\" characters
in your path. The line:
reader->SetFileName("D:\personal\fvazquez\imagenes\5.jpg");
is seen by the compiler as:
reader->SetFileName("D:personalfvazquezimagenes5.jpg");
because it attempts to interpret "\p", "\i", and "\5".
the correct way of writing this path inside your code is:
reader->SetFileName("D:\\personal\\fvazquez\\imagenes\\5.jpg");
You may find useful to look at a C or C++ introductory book
and read about escape sequences.
Regards,
Luis
====================
Fran Vázquez wrote:
>
> Hi all again !
>
> I have pointed out the bug when updating the ImageFileReader (thanks Iván).
>
> /typedef unsigned char PixelComponentType;/
> /typedef itk::RGBPixel< PixelComponentType > RGBPixelType;/
> /const unsigned int Dimension = 2;/
> //
> /typedef itk::Image< RGBPixelType, Dimension > RGBImageType;/
> /typedef itk::ImageFileReader< RGBImageType > ReaderType;/
> //
> /ReaderType::Pointer reader = ReaderType::New();/
> /reader->SetFileName("D:\personal\fvazquez\imagenes\5.jpg");/
> //
> /try/
> / {/
> / reader->Update();/
> / }/
> /catch(itk::ExceptionObject &err)/
> / {/
> / CString msg;/
> / msg.Format("%s", err.GetDescription());/
> / MessageBox(NULL, msg, "Error", MB_ICONINFORMATION);/
> / } /
>
> When the program reach the "/reader->Update();/" it crashes. The
> ExceptionObject shown in the messagebox is: /"The file doesn't exist.
> D:\personal\fvazquez\imagenes\5.jpg",/ or more exactly: /"The file
> doesn't exist. D:personalvazquezimagenes.jpg",/ with some characters
> missing or wrong.
>
> However the image file exists and the full path is correct, I'm quite
> sure!. In my previous mail I write you an incomplete path (thanks Luis)
> but it was right typed in the code.
>
> Any ideas?.
>
> Thanks in advance.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
More information about the Insight-users
mailing list