<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1528" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=276132611-01062006><FONT face=Arial
color=#0000ff size=2>Hi Fran,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=276132611-01062006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=276132611-01062006><FONT face=Arial
color=#0000ff size=2>To get information about the error, use the
GetDescription() method of ExceptionObject, something like</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=276132611-01062006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=276132611-01062006><FONT face=Arial
color=#0000ff size=2>try</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=276132611-01062006><FONT face=Arial
color=#0000ff size=2>{</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=276132611-01062006><FONT face=Arial
color=#0000ff size=2> reader->Update();</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=276132611-01062006><FONT face=Arial
color=#0000ff size=2>}</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=276132611-01062006><FONT face=Arial
color=#0000ff size=2>catch(itk::ExceptionObject&
expt)<BR> {<BR> AfxMessageBox(expt.GetDescription());<BR> }</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=276132611-01062006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=276132611-01062006><FONT face=Arial
color=#0000ff size=2>Hope that helps</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=276132611-01062006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=276132611-01062006><FONT face=Arial
color=#0000ff size=2>Iván</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=276132611-01062006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><BR>
<DIV class=OutlookMessageHeader lang=es dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>De:</B>
insight-users-bounces+imacia=vicomtech.es@itk.org
[mailto:insight-users-bounces+imacia=vicomtech.es@itk.org] <B>En nombre de
</B>Fran Vázquez<BR><B>Enviado el:</B> martes, 09 de mayo de 2006
18:34<BR><B>Para:</B> insight-users@itk.org<BR><B>Asunto:</B> [Insight-users]
Problems trying to update ImageFileReader. <BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Hi all !.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I´m developing a GUI using MFC and ITK
1.8.0. components. I have modified manually an existing Visual.NET v
7.1 proyect in order to attach ITK libs and DLL files.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>There is no problem when building/linking the
proyect but when the program reaches de "reader->update()" line it crashes. I
get a window telling me "This aplication has requested the Runtime to terminate
it in an unusual way, please contact with blah, blah, blah".</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I tried to catch the exception using a "try-catch"
in this way:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><EM>try</EM></FONT></DIV>
<DIV><FONT face=Arial size=2><EM>{</EM></FONT></DIV>
<DIV><FONT face=Arial size=2><EM>reader->Update();</EM></FONT></DIV>
<DIV><FONT face=Arial size=2><EM>}</EM></FONT></DIV>
<DIV><FONT face=Arial size=2><EM>catch(itk::ExceptionObject
&err)</EM></FONT></DIV>
<DIV><FONT face=Arial size=2><EM>{</EM></FONT></DIV>
<DIV><FONT face=Arial size=2><EM>CString msg;</EM></FONT></DIV>
<DIV><FONT face=Arial size=2><EM>msg.Format("%s", err);</EM></FONT></DIV>
<DIV><FONT face=Arial size=2><EM>MessageBox(NULL,msg, "Error",
MB_ICONINFORMATION);</EM></FONT></DIV>
<DIV><FONT face=Arial size=2><EM>}</EM></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>However I can't see the message error because I'm
not converting properly the exception object "err" into a string. Instead a
legible string I only get "B@".</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Anyway I supposed it could be a problem with the
image file path, so I tried to type the full path test to prove if it
works:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2><EM>reader->SetFileName("D:\personal\fvazquez\itk180\proyectos\ITKHaloCount\HaloCountv019-1v6\Debug");</EM></FONT></DIV>
<DIV><EM></EM> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>But I only get the same error window. I have read a
mail asking about this same problem but the proposed "try-catch" structure usinf
AFXMessageBox doesn´t work.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I'm trying to open a JPG file. I have no problem
when doing this in a console aplications. What is more, I have tried to use a
thread executing this console aplication and it works!</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>So these are my two cuestions:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>1º. How can I convert an "exceptionObject"
into a string to use it in the message box?.</FONT></DIV>
<DIV><FONT face=Arial size=2>2º. What am I doing wrong when opening the
image?.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thank you all in advance.</FONT></DIV><BR>
<P><FONT size=2>--<BR>Internal Virus Database is out-of-date.<BR>Checked by AVG
Free Edition.<BR>Version: 7.1.385 / Virus Database: 268.5.1/328 - Release Date:
01/05/2006<BR></FONT></P>
<P><FONT face=Arial size=2></FONT></P></BODY></HTML>
<BR>
<P><FONT SIZE=2>--<BR>
Internal Virus Database is out-of-date.<BR>
Checked by AVG Free Edition.<BR>
Version: 7.1.385 / Virus Database: 268.5.1/328 - Release Date: 01/05/2006<BR>
</FONT> </P>