[Insight-users] Problems trying to update ImageFileReader.

Iván Macía imacia at vicomtech.es
Wed May 10 07:23:55 EDT 2006


Hi Fran,
 
To get information about the error, use the GetDescription() method of
ExceptionObject, something like
 
try
{
    reader->Update();
}
catch(itk::ExceptionObject& expt)
 {
  AfxMessageBox(expt.GetDescription());
 }
 
Hope that helps
 
Iván
 

   _____  

De: insight-users-bounces+imacia=vicomtech.es at itk.org
[mailto:insight-users-bounces+imacia=vicomtech.es at itk.org] En nombre de Fran
Vázquez
Enviado el: martes, 09 de mayo de 2006 18:34
Para: insight-users at itk.org
Asunto: [Insight-users] Problems trying to update ImageFileReader. 


 
Hi all !.
 
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.
 
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".
 
I tried to catch the exception using a "try-catch" in this way:
 
try
{
reader->Update();
}
catch(itk::ExceptionObject &err)
{
CString msg;
msg.Format("%s", err);
MessageBox(NULL,msg, "Error", MB_ICONINFORMATION);
}
 
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@".
 
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:
 
reader->SetFileName("D:\personal\fvazquez\itk180\proyectos\ITKHaloCount\Halo
Countv019-1v6\Debug");
 
 
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.
 
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!
 
So these are my two cuestions:
 
1º. How can I convert an "exceptionObject" into a string to use it in the
message box?.
2º. What am I doing wrong when opening the image?.
 
Thank you all in advance.


--
Internal Virus Database is out-of-date.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.5.1/328 - Release Date: 01/05/2006



-- 
Internal Virus Database is out-of-date.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.5.1/328 - Release Date: 01/05/2006
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20060510/e5bd4569/attachment.html


More information about the Insight-users mailing list