<HTML dir=ltr><HEAD>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.6000.16608" name=GENERATOR></HEAD>
<BODY>
<DIV id=idOWAReplyText50337 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=3>I have problems reading images into my itk-MFC-application.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial>I have two images I use for testing. Both are grey-scale images stored as tif and as bmp respectively. Both images can be loaded nicely with the ImageViewer-Application. </FONT></DIV>
<DIV dir=ltr><FONT face=Arial>I get an access violation error when I execute reader->Update(). when I give a invalide filename to the reader it executes the update command, and gives me an </FONT><FONT face="Times New Roman">ExceptionObject error.</FONT></DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr>Regards, Peter.</DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr><FONT face=Arial></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial></FONT> </DIV>
<DIV dir=ltr><FONT face=Arial>Here is my code</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT> </DIV>
<DIV dir=ltr>CString FileName;<BR>HRESULT hResult;</DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr> CFileDialog dlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST, NULL, this);<BR> <BR> hResult = (int)dlg.DoModal();<BR> if(FAILED(hResult)) {<BR> return;<BR> }</DIV>
<DIV dir=ltr> FileName = dlg.GetFileName();</DIV>
<DIV dir=ltr><BR> typedef itk::Image< unsigned short, 2 > ImageType;</DIV>
<DIV dir=ltr> typedef itk::ImageFileReader< ImageType > ReaderType;<BR> ReaderType::Pointer reader = ReaderType::New();</DIV>
<DIV dir=ltr> reader->SetFileName(FileName);</DIV>
<DIV dir=ltr> <BR> <BR> try { <BR> std::cout << "Writing image: " << "daga" << std::endl;<BR> reader->Update();<BR> } <BR> catch( itk::ExceptionObject & err ) { <BR> <BR> std::cerr << "ERROR: ExceptionObject caught !" << std::endl; <BR> std::cerr << err << std::endl; <BR> } <BR></DIV>
<DIV dir=ltr><FONT face=Arial color=#000000 size=3></FONT> </DIV></DIV>
<DIV id=idSignature17066 dir=ltr>
<DIV><FONT face=Arial color=#000000 size=2>------------------------------------</FONT></DIV>
<DIV><FONT face=Arial color=#000000 size=2>Peter Böttcher, Dr med vet, DipECVS</FONT></DIV>
<DIV><FONT face=Arial color=#000000 size=2><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">European Veterinary Specialist in Surgery</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial color=#000000 size=2><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Fachtierarzt für Kleintierchirurgie</SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial color=#000000 size=2><FONT face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT></FONT><FONT face=Arial><FONT size=2>Klinik für Kleintiere</FONT> <BR><FONT size=2>Universität Leipzig</FONT> <BR><FONT size=2>An den Tierkliniken 23</FONT> <BR><FONT size=2>D-04103 Leipzig (Germany)</FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2>Tel: +49-341-9738700</FONT> <BR><FONT size=2>Fax: +49-341-9738799</FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2>email: <A href="mailto:boettcher@kleintierklinik.uni-leipzig.de">boettcher@kleintierklinik.uni-leipzig.de</A></FONT><BR></FONT></DIV></DIV></BODY></HTML>