<DIV>
<DIV>Hi <SPAN class=125010008-11052006><FONT face=Arial color=#000000 size=2>Iván,</FONT></SPAN></DIV>
<DIV><SPAN class=125010008-11052006></SPAN>&nbsp;</DIV>
<DIV><SPAN class=125010008-11052006>Thanks for your help. I have replaced the version of ITKCommon.dll and very happy to see that exception never occurs again. However, anther error appears which says:</SPAN></DIV>
<DIV><SPAN class=125010008-11052006></SPAN>&nbsp;</DIV>
<DIV><SPAN class=125010008-11052006>Debug assertion failed!<BR>Program:...\..\..\***.exe<BR></SPAN><SPAN class=125010008-11052006>File:dbgheap.c<BR>Line:1011<BR>Expresion:_CrtIsValidHeapPointer(pUserData)<BR><BR>For your information on how your program can cause an assertion<BR>failure,see the Visual C++ documentations on asserts.<BR></SPAN></DIV>
<DIV><SPAN class=125010008-11052006>I google to find some related info. They said,</SPAN></DIV>
<DIV><SPAN class=125010008-11052006></SPAN>&nbsp;</DIV>
<DIV><SPAN class=125010008-11052006>(1)This is a problem with fltk.<BR>I suppose you are running the example in debug version.<BR>By default ITK is using the release version of fltk libraries so if you run the example in debug it will fail.<BR>Try to run it in Release mode and that should work.<BR>If you want to use the debug version you could modify the project<BR>options by hand<BR>in VC++ and replace fltk.lib by fltkd.lib, fltkgl.lib by fltkgld.lib<BR>...etc...<BR></SPAN></DIV>
<DIV><SPAN class=125010008-11052006>Julien</SPAN></DIV>
<DIV><SPAN class=125010008-11052006>------&gt;But I don't use fltk in this program, though i compiled that before.</SPAN></DIV>
<DIV><SPAN class=125010008-11052006></SPAN>&nbsp;</DIV>
<DIV><SPAN class=125010008-11052006>(2)If you are developing multithread application, be sure to link it with the correct runtime library(/MD, /MT). That what "The pointer MUST come from the 'local' heap." means.<BR>Check what "runtime library" you use. It should be "Multithreaded (debug) DLL"<BR><BR>Roman</SPAN></DIV>
<DIV><SPAN class=125010008-11052006>------&gt;I checked that the setting of "runtime library" is right.</SPAN></DIV>
<P><SPAN class=125010008-11052006>Could you or anybody else give me some advice.</SPAN></P>
<P><SPAN class=125010008-11052006>Thanks for attention!</SPAN></P>
<P><SPAN class=125010008-11052006></SPAN><SPAN class=125010008-11052006>&nbsp;&nbsp; Alexander</P>
<DIV></SPAN>&nbsp;</DIV></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #a0c6e5 2px solid; MARGIN-RIGHT: 0px">
<HR color=#a0c6e5 SIZE=1>
<BR>-----原始邮件-----<BR>发件人:"Iván Macía" <IMACIA@VICOMTECH.ES><BR>发送时间:2006-05-11 16:03:53<BR>收件人:"'Alexander.Wang'" <ZJJYWMY@163.COM>,"'karthik krishnan'" <KARTHIK.KRISHNAN@KITWARE.COM><BR>抄送:"'insight-users'" <INSIGHT-USERS@ITK.ORG><BR>主题:RE: Re: [Insight-users] Display image with ITK+VTK in SDI Applica tion<BR><BR><BR>
<META content="MSHTML 6.00.2800.1528" name=GENERATOR>
<DIV dir=ltr align=left><SPAN class=125010008-11052006><FONT face=Arial color=#0000ff size=2>Hi Alexander,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=125010008-11052006><FONT face=Arial color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=125010008-11052006><FONT face=Arial color=#0000ff size=2>Does this error always show up in Debug mode? Are you using ITK with dynamic libraries?&nbsp;If so this could be due to your application accessing the wrong version of&nbsp;itkCommon.dll (accessing Release version&nbsp;instead of Debug), as both have the same name. This happened to me before.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=125010008-11052006></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=125010008-11052006><FONT face=Arial color=#0000ff size=2>Hope that helps&nbsp;</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=125010008-11052006></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=125010008-11052006><FONT face=Arial color=#0000ff size=2>Iván</FONT>&nbsp;</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>Alexander.Wang<BR><B>Enviado el:</B> jueves, 11 de mayo de 2006 9:51<BR><B>Para:</B> karthik krishnan<BR><B>CC:</B> insight-users<BR><B>Asunto:</B> Re: Re: [Insight-users] Display image with ITK+VTK in SDI Applica tion<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Hi,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks for your warmly help. But it seems not because of the filename's slashes. When i change the filename as the method your proposed, the exception was thrown out as before. And further more, i succeed in displaying image in Win32 console application, using both '\' and '/'. So i think&nbsp;the bug lies somewhere esle.</DIV>
<DIV>Thanks again and i'll appreciate your further help!</DIV>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #a0c6e5 2px solid; MARGIN-RIGHT: 0px">
<HR color=#a0c6e5 SIZE=1>
<BR>-----原始邮件-----<BR>发件人:"Karthik Krishnan" <KARTHIK.KRISHNAN@KITWARE.COM><BR>发送时间:2006-05-10 23:11:42<BR>收件人:"Alexander.Wang" <ZJJYWMY@163.COM><BR>抄送:insight-users@itk.org<BR>主题:Re: [Insight-users] Display image with ITK+VTK in SDI Applica tion<BR><BR><BR><PRE style="WIDTH: 100%; WORD-WRAP: break-word">On Wed, 2006-05-10 at 22:07 +0800, Alexander.Wang wrote:

&gt; Hi users,

&gt;  

&gt; I recently started working on ITK, and I want to display images in

&gt; windows using SDI Application. But there is some problem. When the

&gt; Update() function of imagereader is executing, an exception is thrown

&gt; out which says" Unhandles exception in ***.exe (KERNEL32.DLL):

&gt; 0xE06D7363: Microsoft C++ Exception". Does anybody could give me some

&gt; help? Thanks in advance. 

&gt;  

&gt; Sincerely, Alexander



&gt; CString strFile="";

&gt; char szFilter[]="bmp文件(*.bmp)|*.bmp|All files(*.*)|*.*||";

&gt; CFileDialog dlg(TRUE,"bmp",NULL,OFN_HIDEREADONLY|

&gt; OFN_OVERWRITEPROMPT,szFilter,this);

&gt; dlg.m_ofn.lpstrInitialDir=".";

&gt; 

&gt; if(dlg.DoModal()==IDOK)

&gt; {

&gt;  strFile=dlg.GetPathName();

&gt; }

&gt; 

&gt; imageReader2D_1-&gt;SetFileName( strFile );

&gt; 



I suspect the filename's slashes are getting escaped. It should end up

looking like c:/foo/foo.png or like "c:\\foo\\foo.png" You could use

itksys to convert these paths from the native windows style paths.



#include "itksys/SystemTools.hxx"



std::string fname = strFile

itksys::SystemTools::ConvertToUnixSlashes(fname);

if (!itksys::SystemTools::FileExists(fname.c_str()))

  {

  std::cerr &lt;&lt; fname &lt;&lt; " doesn't exist.. check again" &lt;&lt; std::endl;

  }



&gt; //Exception thrown out when executing this expression

&gt; imageReader2D_1-&gt;Update();

&gt; 

&gt; vtkImageViewer* viewer=vtkImageViewer::New();

&gt; vtkRenderWindowInteractor*

&gt; ImgRenderWindowInteractor=vtkRenderWindowInteractor::New();

&gt; 

&gt; connector-&gt;SetInput(imageReader2D_1-&gt;GetOutput());

&gt;  

&gt; HWND hwnd = this-&gt;GetSafeHwnd();

&gt; 

&gt; viewer-&gt;SetParentId(hwnd);

&gt; viewer-&gt;SetPosition(0,0);

&gt; viewer-&gt;SetSize(512,512);

&gt; viewer-&gt;SetupInteractor(ImgRenderWindowInteractor);

&gt;  

&gt; viewer-&gt;SetInput(connector-&gt;GetOutput());

&gt; viewer-&gt;Render();

&gt; 

&gt; viewer-&gt;SetColorWindow(255);

&gt; viewer-&gt;SetColorLevel(128);

&gt; ImgRenderWindowInteractor-&gt;Start();

&gt; 

&gt; //Code End

&gt; 

&gt; 

&gt; 

&gt; 

&gt; 

&gt; 

&gt; 

&gt; 

&gt; 

&gt; 你 不 想 试 试 今 夏 最 “酷” 的 邮 箱 吗 ? 

&gt; 蕴 涵 中 华 传 统 文 化 于 世 界 一 流 科 技 之 中,创 新 Ajax 技 术,

&gt; 126 “D 计 划”火 热 体 验 中 ! 

&gt; _______________________________________________

&gt; Insight-users mailing list

&gt; Insight-users@itk.org

&gt; <A href="http://www.itk.org/mailman/listinfo/insight-users" target=_new>http://www.itk.org/mailman/listinfo/insight-users</A>



</PRE><!-- CoreMail Version 2.5 Copyright (c) 2002-2006 www.mailtech.cn --></BLOCKQUOTE><BR><!-- footer --><BR><BR><BR><BR><BR>
<DIV style="BORDER-BOTTOM: #999 1px solid"></DIV><BR><FONT style="FONT-SIZE: 14px" color=black>你 不 想 试 试 今 夏 最 “酷” 的 邮 箱 吗 ?</FONT> <BR><A style="FONT-SIZE: 13px; COLOR: blue; LINE-HEIGHT: 160%" href="http://www.126.com/" target=_blank>蕴 涵 中 华 传 统 文 化 于 世 界 一 流 科 技 之 中,创 新 Ajax 技 术,126 “D 计 划”火 热 体 验 中 ! </A><BR>
<P><FONT size=2>--<BR>No virus found in this incoming message.<BR>Checked by AVG Free Edition.<BR>Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date: 09/05/2006<BR></FONT></P>
<P><FONT face=Arial size=2></FONT></P><BR>
<P><FONT size=2>--<BR>No virus found in this outgoing message.<BR>Checked by AVG Free Edition.<BR>Version: 7.1.392 / Virus Database: 268.5.5/335 - Release Date: 09/05/2006<BR></FONT></P><!-- CoreMail Version 2.5 Copyright (c) 2002-2006 www.mailtech.cn --></BLOCKQUOTE><br><!-- footer --><br><br><br><br><br><div style="border-bottom:1px solid #999"></div><br>

        <font color="black" style="font-size:14.8px">你 不 想 试 试 今 夏 最 “酷” 的 邮 箱 吗 ?</font>
        <br>
         <a href="http://www.126.com/" target="_blank" style="font-size:13px;line-height:160%;color:blue">蕴 涵 中 华 传 统 文 化 于 世 界 一 流 科 技 之 中,创 新 Ajax 技 术,126 “D 计 划”火 热 体 验 中 !
</a>