<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>&nbsp;</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-&gt;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>&nbsp;</DIV>
<DIV dir=ltr>&nbsp;</DIV>
<DIV dir=ltr>Regards, Peter.</DIV>
<DIV dir=ltr>&nbsp;</DIV>
<DIV dir=ltr>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial>Here is my code</FONT></DIV>
<DIV dir=ltr><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV dir=ltr>CString FileName;<BR>HRESULT hResult;</DIV>
<DIV dir=ltr>&nbsp;</DIV>
<DIV dir=ltr>&nbsp;CFileDialog dlg(TRUE, NULL, NULL, OFN_FILEMUSTEXIST, NULL, this);<BR>&nbsp;<BR>&nbsp;hResult = (int)dlg.DoModal();<BR>&nbsp;if(FAILED(hResult)) {<BR>&nbsp;&nbsp;return;<BR>&nbsp;}</DIV>
<DIV dir=ltr>&nbsp;FileName = dlg.GetFileName();</DIV>
<DIV dir=ltr><BR>&nbsp;&nbsp;typedef itk::Image&lt; unsigned short, 2 &gt; ImageType;</DIV>
<DIV dir=ltr>&nbsp; typedef itk::ImageFileReader&lt; ImageType &gt; ReaderType;<BR>&nbsp; ReaderType::Pointer reader = ReaderType::New();</DIV>
<DIV dir=ltr>&nbsp;reader-&gt;SetFileName(FileName);</DIV>
<DIV dir=ltr>&nbsp;<BR>&nbsp;<BR>&nbsp;try { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; "Writing image: " &lt;&lt; "daga" &lt;&lt; std::endl;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reader-&gt;Update();<BR>&nbsp;&nbsp;&nbsp; } <BR>&nbsp;&nbsp;&nbsp; catch( itk::ExceptionObject &amp; err ) { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "ERROR: ExceptionObject caught !" &lt;&lt; std::endl; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; err &lt;&lt; std::endl; <BR>&nbsp;&nbsp;&nbsp; } <BR></DIV>
<DIV dir=ltr><FONT face=Arial color=#000000 size=3></FONT>&nbsp;</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>