Sorry. This is probably a simple fix, but I don't understand why it doesn't work. For some reason, with the following code, where fn_image1 is simply argv[1], at reader->Update(), my program always throws an exception.
<br><br> typedef itk::Image < unsigned char, 3 > ImageVType;<br> typedef itk::ImageFileReader < ImageVType > ImageReaderType;<br> ImageReaderType::Pointer reader = ImageReaderType::New();<br> ImageVType::Pointer image;
<br> try <br> {<br> reader->SetFileName( fn_image1 );<br> reader->Update();<br><br> image = reader->GetOutput();<br> }<br> catch(...)<br> {<br> std::cout << "Error while reading in fixed image." << std::endl;
<br> throw;<br> }<br><br>Using the VS 7.0 debugger it points to itkimagefilereader.txx<br><br> // Test if the file can be open for reading access.<br>-> std::ifstream readTester;<br> readTester.open( m_FileName.c_str() );
<br><br>I don't quite understand what the problem is. Compiling other examples, the filereader seems to function normally. Also the file I'm trying to read is in the debug folder, and therefore is in the same path as the compiled executable. Information on how to fix this issue would be appreciated.
<br><br>-Jonathan Wong<br>